<div dir="ltr">Hi Clement,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 6, 2014 at 4:42 AM, Clément Bera <span dir="ltr">&lt;<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>So I tried and it worked.</div><div><br></div>In Opal to remove the usage of #==, I removed it from the special selector array in the method:<div>
IRBytecodeGenerator class&gt;&gt;specialSelectorsArray<div>

<span style="white-space:pre-wrap">        </span>^ #(#+ 1 #- 1 #&lt; 1 #&gt; 1 #&lt;= 1 #&gt;= 1 #= 1 #~= 1 #* 1 #/ 1 #\\ 1 #@ 1 #bitShift: 1 #// 1 #bitAnd: 1 #bitOr: 1 #at: 1 #at:put: 2 #size 0 #next 0 #nextPut: 1 #atEnd 0 #== 1 nil 0 #blockCopy: 1 #value 0 #value: 1 #do: 1 #new 0 #new: 1 #x 0 #y 0)</div>


<div><br></div><div>Then I ran:</div><div>IRBytecodeGenerator initialize.</div><div>OpalCompiler recompileAll.</div><div><br></div><div>Then in my example:</div><div><br></div><div style="font-family:arial,sans-serif;font-size:13px">


A&gt;&gt;==</div><div style="font-family:arial,sans-serif;font-size:13px">    ^ true</div><div class="im"><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>a := A new.</div>

<div>b := A new.</div></div></div><div><span style="font-family:arial,sans-serif;font-size:13px">a == b</span>  answered true, so it worked.</div><div><br></div><div>I don&#39;t like all these messages with no lookup. I don&#39;t even know if this permits to earn performance now that we have inline caches.</div>
</div></div></blockquote><div><br></div><div>Well, the arithmetic selectors *really* pay their way.  Try your experiment with #+ through #~= and I bet you&#39;ll see slower loops.  I think there&#39;s a compromise, which is to only inline the arithmetic selectors.  That&#39;s what we did with the VisualWorks VM, HPS.  There one can set a hidden flag in the image which directs the JIT (HPS only has a JIT) not to inline #== (VW does not inline #class), and change the flag with a primitive.  We could (and I think should) do the same.  Note that currently only #== and #class are inlined for all objects.  The arithmetic selectors #+ et al and #&lt; et al are only inlined by the JIT for SmallInteger, and executed without lookup in the interpreter for SmallInteger x Float.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">

<div>@Frank Shearar<br></div><div>Just a detail, #timesRepeat: is not inlined any more by default in Pharo 3.0 because there were conflicts with a stream library. Anyway it didn&#39;t provide a lot of performance (just removed 1 indirection). </div>


<div><br></div><div><br></div><div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/6 Frank Shearar <span dir="ltr">&lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On 6 January 2014 11:11, Nicolai Hess &lt;<a href="mailto:nicolaihess@web.de" target="_blank">nicolaihess@web.de</a>&gt; wrote:<br>



&gt; 2014/1/6 Clément Bera &lt;<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hello,<br>
&gt;&gt;<br>
&gt;&gt; here I have a class<br>
&gt;&gt;<br>
&gt;&gt; A&gt;&gt;==<br>
&gt;&gt;     ^ true<br>
&gt;&gt;<br>
&gt;&gt; Now:<br>
&gt;&gt; a := A new.<br>
&gt;&gt; b := A new.<br>
&gt;&gt; a == b &quot;Answers false&quot;<br>
&gt;&gt; a perform: #== with: b &quot;Answers true&quot;<br>
&gt;&gt;<br>
&gt;&gt; Do I have to remove the usage of the byte code for #== in the compiler to<br>
&gt;&gt; be able to override == ?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; No, a==b should be used for &quot;are the same Objects&quot; (pointing to the same<br>
&gt; object) and not &quot;are equal&quot;.<br>
&gt; Look for example at the commentn for ProtoObject&gt;&gt;==<br>
<br>
</div></div>Given the kinds of things Clément does, I suspect he knows full well<br>
the difference between #== and #=.<br>
<br>
My understanding is that the compiler inlines #== sends like it does<br>
with #timesRepeat: and ifTrue:ifFalse:. So yes, you&#39;d need to fiddle<br>
with the compiler for any #== overrides to actually run.<br>
<br>
(I&#39;m keen for Marcus to show us how exactly to do that in Opal!)<br>
<br>
frank<br>
<br>
&gt; Nicolai<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>