Hi Mariano,<br><br><div class="gmail_quote">On Thu, Dec 22, 2011 at 1:12 AM, Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>></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 "suspicious" 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'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 "rcvr := self internalStackValue: argumentCount." at the beginning of #lookupInMethodCacheSel:class: will cause the problem. So, the following even fails:<br>
<br>lookupInMethodCacheSel: selector class: class<br> "This method....."<br><br> | hash probe rcvr |<br> <inline: true><br> <asmLabel: false><br> rcvr := self internalStackValue: argumentCount.<br>
hash := selector bitXor: class. "shift drops two low-order zeros from addresses"<br>......<br><br><br>Weird ehh, because you use #internalStackValue: along StackInterpreter in a lot of other places and you don't have problems there. <br>
</div></div></blockquote><div><br></div><div>Turns out it's not weird at all. Since lookupInMethodCacheSel:class: is used outside of interpret in findNewMethodInClass: and in callback lookup it can't be inlined and hence can't access localSP. If you want to get the receiver you'll need to use stackValue: *and* you'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'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>