Hi Mariano,<br><br><div class="gmail_quote">On Thu, Dec 22, 2011 at 1:12 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@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">
 <br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br><br>Moreover, when I ADD those lines, apart from the make error, when translating from SLANG to C, if I open a Transcript I see these &quot;suspicious&quot; lines:<br><br>Removed findNewMethodInClass: because it refers to the local variable localSP of interpret.<br>



But it is either used outside of interpret or exported!!<br>Removed lookupInMethodCacheSel:class: because it refers to the local variable localSP of interpret.<br>But it is either used outside of interpret or exported!!<br>



<br>BUT, none of those methods access localSP. <br><br>Any idea of what can be wrong?<br></blockquote><div><br></div><div>For some reason  lookupInMethodCacheSel:class: is not being inlined.  Since it uses localSP via internalStackValue: it must be always inlined into the body of interpret.  What I don&#39;t know is why adding a send of traceObjectusage: after internalStackValue: causes inlining to fail. </div>

</div></blockquote><div><br><br>Hi Eliot. I did some more tests and it even fails WITHOUT using #traceObjectUsage:  .  Just adding the line &quot;rcvr := self internalStackValue: argumentCount.&quot;  at the beginning of #lookupInMethodCacheSel:class:   will cause the problem. So, the following even fails:<br>

<br>lookupInMethodCacheSel: selector class: class<br>    &quot;This method.....&quot;<br><br>    | hash probe rcvr |<br>    &lt;inline: true&gt;<br>    &lt;asmLabel: false&gt;<br>    rcvr := self internalStackValue: argumentCount.<br>

    hash := selector bitXor: class.  &quot;shift drops two low-order zeros from addresses&quot;<br>......<br><br><br>Weird ehh, because you use #internalStackValue:  along StackInterpreter in a lot of other places and you don&#39;t have problems there. <br>
</div></div></blockquote><div><br></div><div>Turns out it&#39;s not weird at all.  Since  lookupInMethodCacheSel:class: is used outside of interpret in findNewMethodInClass: and in callback lookup it can&#39;t be inlined and hence can&#39;t access localSP.  If you want to get the receiver you&#39;ll need to use stackValue: *and* you&#39;ll need to ensure that stackPointer is updated when calling lookupInMethodCacheSel:class: from internalFindNewMethod (see externalizeFPandSP), which may slow down the interpreter slightly.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>
<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div> You&#39;re going to have to delve into the inliner in Slang.  This is, um, not fun.  I liken it to getting hit on the head with a stick by your guru, except that no enlightenment results.  Good luck.</div>


<div><br></div></div></blockquote><div><br>:(   thanks. <br><br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><div>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>Thanks in advance,<br><br><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>



<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>