Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.793.mcz ==================== Summary ==================== Name: System-eem.793 Author: eem Time: 2 February 2016, 11:48:18.26222 am UUID: 5d65cf5d-0564-4825-90d0-569661e6ae3e Ancestors: System-dtl.792 Implement a reasonable lowSpaceLimit for the Stack and Cog VMs. David, this /should/ be back-ported to 4.6. =============== Diff against System-dtl.792 =============== Item was changed: ----- Method: SmalltalkImage>>lowSpaceThreshold (in category 'memory space') ----- lowSpaceThreshold + "Answer the low space threshold. When the amount of free memory (after garbage collection) + falls below this limit, the system is in serious danger of completely exhausting memory and + crashing. This limit should be made high enough to allow the user open a debugger to diagnose + a problem or to save the image. In a stack-based VM such as Cog contexts for activations in + the stack zone will have to be created as the debugger opens, requiring additional headroom." - "Return the low space threshold. When the amount of free memory (after garbage collection) falls below this limit, the system is in serious danger of completely exhausting memory and crashing. This limit should be made high enough to allow the user open a debugger to diagnose a problem or to save the image." + | slotsForDebugger slotsForContextsOnStackPages | + slotsForDebugger := 65536. "Arbitrary guess" + slotsForContextsOnStackPages := + (self vmParameterAt: 42) + ifNil: [0] + ifNotNil: + [:numStackPages| | headerSize numActivationsPerPage maxContextSize | + numActivationsPerPage := 40. "Design goal of the Cog VM" + headerSize := 2. "64-bytes for Spur" + maxContextSize := MethodContext instSize + CompiledMethod fullFrameSize + headerSize. + numStackPages * numActivationsPerPage * maxContextSize]. + ^slotsForDebugger + slotsForContextsOnStackPages * self wordSize! - thisContext isPseudoContext - ifTrue: [^ 400000 "Enough for JIT compiler"] - ifFalse: [^ 200000 "Enough for interpreter"]! |
Oops, this change locks up the image on a non-Cog VM.
If we are going to rely on a numbered VM parameter for this, then we should either change vmParameterAt: to answer nil on failure, or use an exception handler to protect for the case of someone referring to a parameter at 42 when the size of the VM parameter array might be something less than that. I think that answering nil for vmParamterAt: on primitive failure would be a reasonable change. As an aside, I also think it might be better overall to use an an explicit named primitive for something like this, because that would avoid the need for VM implementors to coordinate their understanding of the size and meaning of the VM parameter array. Dave On Tue, Feb 02, 2016 at 07:48:39PM +0000, [hidden email] wrote: > Eliot Miranda uploaded a new version of System to project The Trunk: > http://source.squeak.org/trunk/System-eem.793.mcz > > ==================== Summary ==================== > > Name: System-eem.793 > Author: eem > Time: 2 February 2016, 11:48:18.26222 am > UUID: 5d65cf5d-0564-4825-90d0-569661e6ae3e > Ancestors: System-dtl.792 > > Implement a reasonable lowSpaceLimit for the Stack and Cog VMs. David, this /should/ be back-ported to 4.6. > > =============== Diff against System-dtl.792 =============== > > Item was changed: > ----- Method: SmalltalkImage>>lowSpaceThreshold (in category 'memory space') ----- > lowSpaceThreshold > + "Answer the low space threshold. When the amount of free memory (after garbage collection) > + falls below this limit, the system is in serious danger of completely exhausting memory and > + crashing. This limit should be made high enough to allow the user open a debugger to diagnose > + a problem or to save the image. In a stack-based VM such as Cog contexts for activations in > + the stack zone will have to be created as the debugger opens, requiring additional headroom." > - "Return the low space threshold. When the amount of free memory (after garbage collection) falls below this limit, the system is in serious danger of completely exhausting memory and crashing. This limit should be made high enough to allow the user open a debugger to diagnose a problem or to save the image." > > + | slotsForDebugger slotsForContextsOnStackPages | > + slotsForDebugger := 65536. "Arbitrary guess" > + slotsForContextsOnStackPages := > + (self vmParameterAt: 42) > + ifNil: [0] > + ifNotNil: > + [:numStackPages| | headerSize numActivationsPerPage maxContextSize | > + numActivationsPerPage := 40. "Design goal of the Cog VM" > + headerSize := 2. "64-bytes for Spur" > + maxContextSize := MethodContext instSize + CompiledMethod fullFrameSize + headerSize. > + numStackPages * numActivationsPerPage * maxContextSize]. > + ^slotsForDebugger + slotsForContextsOnStackPages * self wordSize! > - thisContext isPseudoContext > - ifTrue: [^ 400000 "Enough for JIT compiler"] > - ifFalse: [^ 200000 "Enough for interpreter"]! > |
Free forum by Nabble | Edit this page |