[squeak-dev] Re: [Vm-dev] About primitive for cleaning compiled method cache

Igor Stasenko siguctua at gmail.com
Thu Mar 14 08:52:06 UTC 2013


On 14 March 2013 09:29, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 2013/3/14 Igor Stasenko <siguctua at gmail.com>:
>> as a follow-up.. given the implementation of at:put:
>> i expected that following would work correctly:
>>
>> | x y |
>> B methodDict removeKey: #foo ifAbsent: [ ].
>> x := B new bar.
>> B methodDict at: #foo put: (B>>#zork).
>> B methodDict at: #foo put: (B>>#zork).
>> y := B new bar.
>> {  x. y }
>>
>> (a second at:put: shall trigger flushing the cache)..
>>
>> yet it gives same answer:
>>  #('foo' 'foo')
>>
>> Conclusion: primitive 116 is NOT enough.
>>
>> While method's comment says otherwise:
>>
>> flushCache
>>         "Tell the interpreter to remove all references to this method from
>> its method lookup cache, if it has one. This primitive must be called
>> whenever a method is redefined or removed.
>>         NOTE:  Only one of two selective flush methods (Symbol or
>> CompiledMethod) needs to be used."
>>
>>         <primitive: 116>
>>
>> --
>> Best regards,
>> Igor Stasenko.
>>
>
> Yes the comment is for old VM and obsolete.
> But see Behavior>>basicAddSelector:withMethod: and basicRemoveMethod,
> they invoke primitive 119 unconditionnally.
>
yes, that makes invoking 116 unnecessary at all.
I am for putting this critical behavior into method dictionary..
then there is guarantee that no matter how you play with class(es) it
will flush things properly.

> Misunderstanding in this area is dangerous, so it's time to properly
> document and clean if necessary, and kill false assumptions.
>
> Nicolas
>



-- 
Best regards,
Igor Stasenko.


More information about the Squeak-dev mailing list