Hi Eliot. I am implementing some kind of MethodWrappes/ObjectsAsMethod, whihc basically use the #run:with:in trick.<br>My question is that I am not sure how to implement #flushCache in my wrappers. This method is called by MethodDictionary&gt;&gt;#at:put:  when I want to put back the original CompiledMethod.<br>
<br>MyClass methodDict at: #foo put: MyWrapper withMethod: (MyClass&gt;&gt;#foo). <br>...<br>MyClass methodDict at: #foo put:  wrapper wrappedMethod <br>-&gt;  here it sends #flushCache to my wrapper instance. <br><br>In the StandardVM, I realised that at that moment, there is an entry in the cache that has selector: #foo, method:  my wrapped instance, class: MyClass, etc...<br>
<br>So, to flush this, I have to options:<br><br>MyWrappers&gt;&gt;flushCache<br>self wrappedMethod selector flushCache<br><br>or....<br><br>MyWrappers&gt;&gt;flushCache<br> 
&lt;primitive: 116&gt;<br><br>this is because &quot;self&quot; will be found in the entry as &quot;method&quot; in the cache table...<br><br>So, first, are my assumptions correct? <br><br>Now, in cog I am not sure if both solutions are still valid. If I see CoInterpreterPrimitives&gt;&gt; primitiveFlushCacheByMethod<br>
<br>you do at the end:<br><br>(self methodHasCogMethod: oldMethod) ifTrue:<br>        [cogit unlinkSendsTo: (self cogMethodOf: oldMethod)]<br><br>and <br><br>methodHasCogMethod: aMethodOop<br>    &lt;api&gt;<br>    self assert: (objectMemory isNonIntegerObject: aMethodOop).<br>
    ^self isCogMethodReference: (self rawHeaderOf: aMethodOop)<br><br><br>So, it is not safe if the method is something different than a compiled method. <br><br>Is that correct? should I flush the cache entering by selector instead?  which is the safe way to clean the cache in this case?<br>
<br>thanks<br><br>Mariano<br>