Hi,
When you look at the #internalActivateNewMethod you can see the VM checking for freeContexts:
internalActivateNewMethod
… (needsLarge = 0 and: [freeContexts ~= NilContext]) ifTrue: [newContext := freeContexts. freeContexts := self fetchPointer: 0 ofObject: newContext] ifFalse: ["Slower call for large contexts or empty free list" self externalizeIPandSP. newContext := self allocateOrRecycleContext: needsLarge. self internalizeIPandSP]. …
Then in the #allocateOrRecycleContext you can see another check:
allocateOrRecycleContext: needsLarge "Return a recycled context or a newly allocated one if none is available for recycling." | cntxt | needsLarge = 0 ifTrue: [freeContexts ~= NilContext ifTrue: [cntxt := freeContexts. freeContexts := self fetchPointer: 0 ofObject: cntxt. ^ cntxt]] …
… needsLarge = 0 ifTrue: [cntxt := self instantiateContext: (self splObj: ClassMethodContext) sizeInBytes: SmallContextSize] …
So why there is so many check for nothings. The best would be to have the #allocateOrRecycleLargeContext: method?
Mth
vm-dev@lists.squeakfoundation.org