[Vm-dev] Why spaceOkay test needed?
Adrian Lienhard
adi at netstyle.ch
Mon Aug 20 16:21:47 UTC 2007
Out of curiosity, does anybody know why in...
primitiveNew
"Allocate a new fixed-size instance. Fail if the allocation would
leave less than lowSpaceThreshold bytes free. May cause a GC"
| class spaceOkay |
class := self stackTop.
"The following may cause GC!"
spaceOkay := self sufficientSpaceToInstantiate: class indexableSize: 0.
self success: spaceOkay.
successFlag ifTrue: [ self push: (self instantiateClass: self
popStack indexableSize: 0) ]
... there is the call to #sufficientSpaceToInstantiate:indexableSize:
although #instantiateClass:indexableSize: also indirectly calls
#sufficientSpaceToAllocate:?
Both, the primitive fallback code and the vm code signal the low
space sem in case of failure.
Adrian
More information about the Vm-dev
mailing list