[Vm-dev] Why spaceOkay test needed?

Adrian Lienhard adi at netstyle.ch
Mon Aug 20 18:38:07 UTC 2007


On Aug 20, 2007, at 18:37 , Andreas Raab wrote:

> Adrian Lienhard wrote:
>> 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:?
>
> Where does it do that?

instantiateClass:indexableSize: ->  
allocate:headerSize:h1:h2:h3:doFill:with: -> allocateChunk: ->  
sufficientSpaceToAllocate:

Adrian


More information about the Vm-dev mailing list