Hi Stefan,<br><br><div class="gmail_quote">On Mon, Dec 12, 2011 at 12:53 AM, Stefan Marr <span dir="ltr">&lt;<a href="mailto:squeak@stefan-marr.de">squeak@stefan-marr.de</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 Dave,<br>
Hi Eliot:<br>
<div class="im"><br>
On 12 Dec 2011, at 02:42, David T. Lewis wrote:<br>
<br>
&gt; I think you are missing some arguments for the primitive in your<br>
&gt; #performSuper methods.<br>
<br>
</div>Thanks Dave, indeed. Was certainly to late for me yesterday.<br>
I forget the class, in which the lookup is supposed to be started.<br>
<br>
Eliot, well, there was another argument, which was probably interpreted as the lookup class but was just a SmallInteger instead. Guess that was causing the crash.<br></blockquote><div><br></div><div>The problem was that you declared a primitive with too few arguments and this interacted badly with the VMs interpreted frame format.  You have a method</div>
<div>Object&gt;performSuper: aSymbol with: anObject </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Send the selector, aSymbol, to the receiver with anObject as its argument.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>Fail if the number of arguments expected by the selector is not one.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>Primitive. Optional. See Object documentation whatIsAPrimitive.&quot;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;primitive: 100&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>^ self perform: aSymbol withArguments: (Array with: anObject) inSuperclass: self class superclass</div><div><br></div><div>which only declares two arguments even though primitive 100, perform:withArguments:inSuperclass: requires three.  So when the primitive attempted to access the receiver it actually fetched the field below, which happens to be the interpreted frames&#39; saved ip which is null in this case. So the VM dies trying to follow a null pointer when it tries to fetch the receiver&#39;s class (since 0 is not a SmallInteger).</div>
<div><br></div><div>0xbff5d7a4 I OstCompilerTestDomain(OstDomain)&gt;requestSuperExecutionOf:on: 367331552: a(n) OstCompilerTestDomain</div><div>0xbff5d7b4:   rcvr/clsr: 0x15e508e0     =a(n) OstCompilerTestDomain</div><div>
0xbff5d7b0:        arg0: 0x14d482ec     =#xx_omni_x_b</div><div>0xbff5d7ac:        arg1: 0x15e508c8     =a(n) OstCompilerTestSubjectSub</div><div>0xbff5d7a8:   caller ip: 0x1380fc8e=327220366</div><div>0xbff5d7a4:    saved fp: 0xbff5d7c4=-1074407484</div>
<div>0xbff5d7a0:      method: 0x1531683c     0x1531683c 355559484: a(n) CompiledMethod</div><div>0xbff5d798:intfrm flags:      0x201=513  numArgs: 2  hasContext: 0  isBlock: 0</div><div>0xbff5d79c:     context: 0x1383c004     =nil</div>
<div><b>0xbff5d794:    saved ip:        0x0 0</b></div><div>0xbff5d790:    receiver: 0x15e508e0     =a(n) OstCompilerTestDomain</div><div>0xbff5d78c:        stck: 0x15e508c8     =a(n) OstCompilerTestSubjectSub</div><div>0xbff5d788:        stck: 0x14d482ec     =#xx_omni_x_b </div>
<div><br></div><div><br></div><div>It dies at this line in primitivePerformInSuperclass trying to access the receiver&#39;s header:</div><div><div><div><b>32747           if (((ccIndex = (((usqInt) (longAt(rcvr))) &gt;&gt; 12) &amp; 31)) == 0) {</b></div>
<div>32748                   currentClass = (longAt(rcvr - BaseHeaderSize)) &amp; AllButTypeMask;</div><div>32749                   goto l1;</div></div></div><div><br></div><div>Now the VM has support for checking primitive argument counts, and it will fail a primitive if the number of arguments dropped from the stack is incorrect.  But it can only check the number of arguments after the primitive has run.  So alas since the crash happens before the prtimitive has finished you are, in the classic phrase, SOL.  Sorry :)</div>
<div><br></div><div>BTW, the saved ip is the bytecode address at which to resume execution in the interpreter.  The return address of the next frame will be e.g. ceReturnToInterpreter so that when a machine code frame returns to an interpreted frame it returns to a trampoline which then reenters the interpreter and resumes execution at the bytecode pointed to by saved ip.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>From the RoarVM interpreter I understand that the lookup class is not crosschecked for being a class. I think it did work on the interpreter for me, because my patched DNU handler is &#39;a bit to robust&#39;, and does not exactly what it is supposed to do.<br>

<div><div></div><div class="h5"><br>
<br>
Thanks<br>
Stefan<br>
<br>
--<br>
Stefan Marr<br>
Software Languages Lab<br>
Vrije Universiteit Brussel<br>
Pleinlaan 2 / B-1050 Brussels / Belgium<br>
<a href="http://soft.vub.ac.be/~smarr" target="_blank">http://soft.vub.ac.be/~smarr</a><br>
Phone: <a href="tel:%2B32%202%20629%202974" value="+3226292974">+32 2 629 2974</a><br>
Fax:   <a href="tel:%2B32%202%20629%203525" value="+3226293525">+32 2 629 3525</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>