<br><br><div class="gmail_quote">On Fri, May 25, 2012 at 8:46 PM, Santiago Bragagnolo <span dir="ltr">&lt;<a href="mailto:santiagobragagnolo@gmail.com" target="_blank">santiagobragagnolo@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">Hi All<br><br>Im analyzing primtives to use them for the concrete type inference project.<br><br>Im currently working with primitiveArrayBecomeOneWayCopyHash<br>
<br><br>primitiveArrayBecomeOneWayCopyHash<br>       &quot;Similar to primitiveArrayBecomeOneWay but accepts a third argument whether to copy<br>
       the receiver&#39;s identity hash over the argument&#39;s identity hash.&quot;<br><br>       | copyHashFlag arg rcvr |<br>       copyHashFlag := self booleanValueOf: (self stackTop).<br>       arg := self stackValue: 1.<br>

       rcvr := self stackValue: 2.<br>       self success: (self become: rcvr with: arg twoWay: false copyHash: copyHashFlag).<br>       successFlag ifTrue: [ self pop: 2 ].<br><br><br>Well, i&#39;m seeing that pop:2, in a method which don&#39;t receive any argument</blockquote>
<div><br>yes it receieves! two arguments indeed<br>if you see #initializePrimitiveTable you see the number of this primitive is 249. So if you browse your iamge, you find:<br><br>Array &gt;&gt; #elementsForwardIdentityTo: otherArray copyHash: copyHash<br>
    &quot;This primitive performs a bulk mutation, causing all pointers to the elements of this array to be replaced by pointers to the corresponding elements of otherArray.  The identityHashes remain with the pointers rather than with the objects so that the objects in this array should still be properly indexed in any existing hashed structures after the mutation.&quot;<br>
    &lt;primitive: 249&gt;<br>    self primitiveFailed<br><br><br>so poping 2 means you will let &quot;self&quot; in the top, so it will actually be the return value. <br>the last time I was hacking in this side of the moon was one year ago...so some validation from someone else would be nice :)<br>
 </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">. If pop was 1, i could think in self, but is 2, so the questions are:<br>
<br>1) what is pop:2 in this context<br>2) why? there&#39;s any generalization or rules for understand the stack manage?<br><br></blockquote><div><br>The rule is that you have to always take care of balance the stack. Be careful to pop according to what you push ;)<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">Thanks!<span class="HOEnZb"><font color="#888888"><br><br>Santiago. <br><br><br><br>
</font></span><br>_______________________________________________<br>
VM-beginners mailing list<br>
<a href="mailto:VM-beginners@lists.squeakfoundation.org">VM-beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners</a><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>