hasInstVarRef

Adrian Lienhard adi at netstyle.ch
Fri Sep 21 14:36:49 UTC 2007


ok, the image I was looking at didn't include the method in  
CompiledMethod.

On Sep 21, 2007, at 16:22 , Hans-Martin Mosner wrote:

> Bergel, Alexandre wrote:
>> Hi Adrian,
>>
>> I wish to know whether a compiled method references any variable.
> The problem is that methods which just return the value of an instance
> variable are compiled specially with a primitive index which  
> corresponds
> to the index of the instance variable plus some offset.
> These methodes don't have ordinary bytecodes to read and return the
> instance variable.
> The implementation of #hasInstVarRef is incomplete, it should  
> definitely
> handle this case.

Yep. Also, there's a duplication with CompiledMethod>>readsField:,  
which handles the quick return case correctly. In previous versions  
of Squeak, MethodContext implemented #hasInstVarRef but now it  
delegates to its method. While for a method context the  
implementation seems correct to me, it is not for a compiled method  
(as Alex has noted). I would revert the change and use #readsField:  
instead for CompiledMethods.

Cheers,
Adrian



More information about the Squeak-dev mailing list