<div dir="ltr">Hi Ben,<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 3, 2016 at 2:30 PM, Ben Coman <span dir="ltr">&lt;<a href="mailto:btc@openinworld.com" target="_blank">btc@openinworld.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class=""><br>
On Fri, Jun 3, 2016 at 6:33 PM, Ben Coman &lt;<a href="mailto:btc@openinworld.com">btc@openinworld.com</a>&gt; wrote:<br>
<br>
&gt; where  OwnedLock&gt;&gt;experiment1   is...<br>
&gt;     | result |<br>
&gt;     result := OrderedCollection new: 20.<br>
&gt;     result myAdd: 0.<br>
<br>
</span>btw, OrderedCollection&gt;&gt;myAdd:<br>
is direct copy of OrderderedCollection&gt;&gt;add:<br>
just so [set break selector...] can distinguish these from every send<br>
of add: in the image.<br>
<span class=""><br>
<br>
&gt; The current VM produces a result of...<br>
&gt;      OrderedCollection(0 11 12 21 22 13 14 24 8 9)<br>
&gt;<br>
&gt; but I&#39;m hoping to get something like...<br>
&gt;      OrderedCollection(0 11 12 21 22 14 23 24 8 9)<br>
<br>
<br>
</span>After loading my &#39;ownedlock-reader.image&#39; with an unchaged VM,<br>
then adding these two lines to transferTo:<br>
<span class=""><br>
&gt;     objectMemory<br>
&gt;         storeInteger: SuspendedPrimitiveFailCodeIndex<br>
&gt;         ofObject: oldProc<br>
&gt;         withValue: primFailCode.<br>
&gt;     primFailCode := objectMemory<br>
&gt;        fetchInteger: SuspendedPrimitiveFailCodeIndex<br>
&gt;        ofObject: newProc.<br>
<br>
</span>then executing...    OwnedLock new experiment1 !<br>
I get an AssertionFailure in...<br>
<br>
Spur32BitMMLESimulator&gt;&gt;fetchPointer: fieldIndex ofObject: objOop<br>
    self assert: (self isForwarded: objOop) not.<br>
    self assert: (fieldIndex &gt;= 0 and: [fieldIndex &lt; (self<br>
numSlotsOfAny: objOop)<br>
           or: [fieldIndex = 0 &quot;forwarders and free objs&quot;]]).<br>
    ^super fetchPointer: fieldIndex ofObject: objOop<br>
<br>
where...<br>
  objOop  ==&gt;<br>
      16r2D2490: a(n) OwnedLock<br>
           16r41A280 nil   16r41A280 nil   16r41A280 nil<br>
<br>
  fieldIndex  ==&gt;  3<br>
<br>
  self numSlotsOfAny: objOop  ==&gt;  3<br>
<br>
<br>
One thing I&#39;m curious about is why the &quot; &lt; &quot; and not a &quot; &lt;= &quot; ?<br>
    super fetchPointer: fieldIndex ofObject: objOop<br>
successfully returns...   16r41A280: a(n) UndefinedObject<br></blockquote><div> </div><div>Can you print the class definition of OwnedLock ?</div><div><br></div><div>Maybe I am wrong but it looks like it&#39;s because it&#39;s 0-based so the fieldIndex can be between 0 and 2 if numSlots is 3. That would imply a bytecode compiler bug if that object is fixed-sized.</div><div><br></div><div>When you try:</div><div>objectMemory</div><div><span style="font-size:12.8px">      storePointer: 3</span><br style="font-size:12.8px"><span style="font-size:12.8px">      ofObject: objOop</span><br style="font-size:12.8px"><span style="font-size:12.8px">      withValue: objOop</span><br></div><div><br></div><div>And then print objOop with printOop, is the 3rd field edited ?</div><div>If not, what if you put 2 as 1st argument ?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
<br>
btw, here is the call stack...<br>
   -16r106C [] in OwnedLock&gt;experiment1 16r2D2490: a(n) OwnedLock<br>
   -16r104C BlockClosure&gt;on:do: 16r2D29C8: a(n) BlockClosure<br>
   -16r1024 [] in OwnedLock&gt;experiment1 16r2D2490: a(n) OwnedLock<br>
   -16r1008 [] in BlockClosure&gt;newProcess 16r2D27E8: a(n) BlockClosure<br>
<br>
and the ext head frame...<br>
   -16r106C [] in OwnedLock&gt;experiment1 16r2D2490: a(n) OwnedLock<br>
   -16r1064/3559:   rcvr/clsr:   16r2D29C8 a BlockClosure<br>
   -16r1068/3558:cllr ip/ctxt:   16rA3F922=10746146<br>
   -16r106C/3557:    saved fp:    -16r104C=-4172<br>
   -16r1070/3556:      method:   16r81EF10 a CompiledMethod<br>
   -16r1074/3555:       flags:  16r1010001=16842753  numArgs: 0<br>
hasContext: true  isBlock: true<br>
   -16r1078/3554:     context:   16r2D29F8=2959864<br>
   -16r107C/3553:    receiver:   16r2D2490 an OwnedLock<br>
   -16r1080/3552:   temp/stck:   16r2D24A8 an OrderedCollection<br>
   -16r1084/3551:   temp/stck:   16r2D2490 an OwnedLock<br>
<br>
and the int head frame...<br>
   -16r108C OwnedLock(Process)&gt;suspend 16r2D2490: a(n) OwnedLock<br>
   -16r1084/3551:   rcvr/clsr:   16r2D2490 an OwnedLock<br>
   -16r1088/3550:cllr ip/ctxt:   16r81EFBB=8515515<br>
   -16r108C/3549:    saved fp:    -16r106C=-4204<br>
   -16r1090/3548:      method:  16r10DF5B0 a CompiledMethod<br>
   -16r1094/3547:       flags:        16r1=1  numArgs: 0  hasContext:<br>
false  isBlock: false<br>
   -16r1098/3546:     context:   16r41A280=4301440<br>
   -16r109C/3545:    receiver:   16r2D2490 an OwnedLock<br>
   -16r10A0/3544:   temp/stck:   16r41A280 nil<br>
<br>
<br>
What is the difference between ext and int  head frames?<br></blockquote><div><br></div><div>Err...</div><div>That&#39;s an interpreter optimization. I am not sure I remember correctly. I think internal stack frame may have an incorrect pc / stack pointer / frame pointer as the value may be in the interpreter and not on stack. External stack frame have always the correct value. Basically if the frame is machine code frame, it is always external. If the frame is an interpreted frame, it is internal if it&#39;s the active stack frame. Or something like that.</div><div><br></div><div>Eliot can you explain again ? I&#39;m pretty sure I am confused.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
One thing I find curious here is &quot;OwnedLock(Process)&gt;suspend&quot;.  Does<br>
this indicate that #suspend was sent to an OwnedLock and looked up the<br>
hierarchy to find the method in Process?<br>
But OwnedLock doesn&#39;t inherit from Process, it inherits from LinkedList.<br>
<br></blockquote><div><br></div><div>Well then the external stack frame was correct and not the internal one.</div><div><br></div><div>I always look at machine code frame and they are always external, so I forgot :-(.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
cheers -ben<br>
</blockquote></div><br></div></div>