<br><br><div class="gmail_quote">On Wed, Dec 21, 2011 at 2:04 PM, 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>Hi guys. I am migrating some old stuff I have about tracing object usage to the latest version of Cog. I have in StackInterpreter a method which looks like this:<br><br>traceObjectUsage: anOop<br>    ((self isIntegerObject: anOop) not and: [hasToTrace])<br>

        ifTrue: [ <br>            objectMemory setExperimentalBitOf: anOop to: true.<br>            ]<br><br>So I have also added #setExperimentalBitOf:to:  to ObjectMemory, and I have added the instVar &#39;hasToTrace&#39; to the StackInterpreter. So now from some methods of StackInterpreter, I add sends to this method to trace OOPs. This is working fine, but there is one particular method where I cannot do it. The method is #lookupInMethodCacheSel:class:  and I am trying to do something like:<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>   <span style="background-color:rgb(255,255,0)"> self traceObjectUsage: class.</span><br>

  <span style="background-color:rgb(255,255,0)">  rcvr := self internalStackValue: argumentCount.</span><br style="background-color:rgb(255,255,0)"><span style="background-color:rgb(255,255,0)">    self traceObjectUsage: rcvr.</span><br>

    hash := selector bitXor: class.  &quot;shift drops two low-order zeros from addresses&quot;<br> .......<br><br>In this particular method, the problem is with the two lines:<br>  <span style="background-color:rgb(255,255,0)">  rcvr := self internalStackValue: argumentCount.</span><br style="background-color:rgb(255,255,0)">


<span style="background-color:rgb(255,255,0)">    self traceObjectUsage: rcvr.</span><br>
<br>If I DO NOT put those two lines, then it compiles perfect. If I put those lines, I have a compilation error:<br><br>Undefined symbols:<br>  &quot;_lookupInMethodCacheSelclass&quot;, referenced from:<br>      _lookupreceiver in gcc3x-cointerpmt.c.o<br>

      _handleMNUInMachineCodeToclassForMessage in gcc3x-cointerpmt.c.o<br>      _ceSendsupertonumArgs in gcc3x-cointerpmt.c.o<br>      _ceSendFromInLineCacheMiss in gcc3x-cointerpmt.c.o<br>      _ceSendAborttonumArgs in gcc3x-cointerpmt.c.o<br>

      _interpret in gcc3x-cointerpmt.c.o<br>      _interpret in gcc3x-cointerpmt.c.o<br>      _sendInvokeCallbackStackRegistersJmpbuf in gcc3x-cointerpmt.c.o<br>      _sendInvokeCallbackContext in gcc3x-cointerpmt.c.o<br>

  &quot;_findNewMethodInClass&quot;, referenced from:<br>      _primitivePerform in gcc3x-cointerpmt.c.o<br>      _primitiveObjectperformwithArgumentslookedUpIn in gcc3x-cointerpmt.c.o<br>      _primitiveInvokeObjectAsMethod in gcc3x-cointerpmt.c.o<br>

ld: symbol(s) not found<br>collect2: ld returned 1 exit status<br>make[2]: *** [/Users/mariano/Pharo/VM/git/cogVMBlessedSSH/blessed/results/CogMTVM.app/Contents/MacOS/CogMTVM] Error 1<br>make[1]: *** [CMakeFiles/CogMTVM.dir/all] Error 2<br>

make: *** [all] Error 2<br><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.  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><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>