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

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Mar 14 08:29:28 UTC 2013


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.

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

Nicolas


More information about the Squeak-dev mailing list