<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 1:11 PM, Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I think Eliot already explained this in this vm-dev thread<br>[Vm-dev] About primitive for cleaning compiled method cache<br><a href="http://lists.squeakfoundation.org/pipermail/vm-dev/2013-March/012333.html" target="_blank">http://lists.squeakfoundation.org/pipermail/vm-dev/2013-March/012333.html</a></div></blockquote><div><br></div><div>Right.  <a href="http://lists.squeakfoundation.org/pipermail/vm-dev/2013-March/012359.html">http://lists.squeakfoundation.org/pipermail/vm-dev/2013-March/012359.html</a> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-11-03 19:42 GMT+01:00 Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Nov 3, 2014 at 10:32 AM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi All,<br>
<br>
We have three primitives for three different versions of #flushCache:<br>
- primitive 89 used by Behavior &gt;&gt; #flushCache<br>
- primitive 116 used by CompiledMethod &gt;&gt; #flushCache<br>
- primitive 119 used by Symbol &gt;&gt; #flushCache<br>
<br>
Based on the comment in CompiledMethod &gt;&gt; #flushCache, and Symbol &gt;&gt; #flushCache, primitive 119 is not used since Squeak 2.3, and Symbol &gt;&gt; #flushCache can safely be removed.<br></blockquote><div><br></div></span><div>NO!!!  This is completely wrong.  Symbol&gt;&gt;#flushCache is the one that *must* be there.  The use of 116 is IMO completely bogus.  For the VM to use 116 effectively it must be able to find the selector in the method; in general not possible because the selector is only optional in a method, optionally in the penultimate literal, but perhaps inside the penultimate literal, and perhaps the method is an anonymous accessor only copied into a method dictionary.</div><div>Caches in the VM are based on *selectors* (arguably these may not even be symbols; see below) and flushing entries that refer to a particular compiled method may not correctly update caches on subclass or superclass methods.  Whereas flushing based on selector, even if it does more work, always reliably upates caches correctly.</div><div><br></div><div>In general message selectors can be any object, so one could aggressively shrink by e.g. replacing all selectors by SmallIntegers.  This was done back in the day with the ActiveBook system, an early tablet implemented largely in Smalltalk.  So primitive 119 should IMO be implemented in Object.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
But the method is still in the image, and it is being sent whenever a method is removed or added to a class.<br>
Is the comment wrong, or the method is really not needed?<br></blockquote><div><br></div></span><div> The comment is wrong.</div><span><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Also the last comments in Behavior &gt;&gt; #basicAddSelector:withMethod: and Behavior &gt;&gt; #basicRemoveSelector: suggest that either the method&#39;s or the selector&#39;s cache should be flushed, but not both, which is actually the case in both methods.<br>
The comment in Symbol &gt;&gt; #flushCache suggests the same. So what&#39;s the truth? Do we still need primitive 119?</blockquote><div><br></div></span><div>Yes, we do, and only it should be used in Behavior &gt;&gt; #basicAddSelector:withMethod: and Behavior &gt;&gt; #basicRemoveSelector:.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><font color="#888888"><br>
<br>
Levente<br>
<br><span><font color="#888888">
</font></span></font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>best,<div>Eliot</div></div>
</font></span></div></div>
<br><br>
<br></blockquote></div><br></div>
</div></div><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>