[squeak-dev] Contexts must only be created with newForMethod: ...

Chris Muller ma.chris.m at gmail.com
Mon Aug 1 18:27:26 UTC 2011

.. but #newForMethod: requires more in the API than it really uses.
It only checks the methods #frameSize to determine what basicSized
MethodContext to create - it doesn't actually set its method from the
one passed in.

newForMethod: aMethod
        --- (comment snipped for brevity) ---
	^ super basicNew: aMethod frameSize

So, would it be ok to relax MethodContext class>>basicNew: to something like:

  basicNew: size
        ^ (size = CompiledMethod smallFrameSize or: [ size =
CompiledMethod fullframeSize ])
               ifTrue: [ super basicNew: size ]
               ifFalse: [ self error: 'Contexts must be ',
CompiledMethod smallFrameSize, ' or ', CompiledMethod fullframeSize, '
bytes.' ]

More information about the Squeak-dev mailing list