<div dir="ltr">Things work fine provided the become is one-way and hashes are not copied. &nbsp;Simply change<div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;(self containOnlyOops: array1 and: array2) ifFalse: [^false]</div><div><br></div><div>in ObjectMemory&gt;&gt;become:with:twoWay:copyHash: to<br>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>(twoWayFlag or: [copyHashFlag])</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ifTrue: [(self containOnlyOops: array1 and: array2) ifFalse: [^false]]</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>ifFalse: [(self containOnlyOops: array1) ifFalse: [^false]].</div><div><br></div><div>along with the obvious implementation of&nbsp;containOnlyOops:.</div><div>
If so,</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| foo bar |</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>foo := 1@2.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>bar := { foo. foo }.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>foo becomeForward: 0 copyHash: false.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{ foo. bar }</div><div>produces</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#(0 #(0 0))</div>
</div><div><br></div><div class="gmail_quote">On Thu, Sep 18, 2008 at 9:09 AM, Rob Withers <span dir="ltr">&lt;<a href="mailto:reefedjib@yahoo.com">reefedjib@yahoo.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>
----- Original Message ----- From: &quot;Paolo Bonzini&quot; &lt;<a href="mailto:bonzini@gnu.org" target="_blank">bonzini@gnu.org</a>&gt;<br>
To: &quot;The general-purpose Squeak developers list&quot; &lt;<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>&gt;<br>
Sent: Tuesday, September 16, 2008 3:59 PM<br>
Subject: [squeak-dev] Re: becomeForward: alternative<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Rob Withers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am trying to becomeForward with an object and a small integer. &nbsp;This<br>
of course doesn&#39;t work. &nbsp;Is there an alternative that would allow me to<br>
do this?<br>
</blockquote>
<br>
There&#39;s actually no reason why the *destination* of a becomeForward:<br>
cannot be a SmallInteger. &nbsp;It&#39;s a VM bug in my opinion.<br>
<br>
</blockquote>
<br></div></div>
Thanks, Paolo.<br>
<br>
I tried looking into this a bit and here is what I have found. &nbsp;First off, this will only work with<br>
 &nbsp; #elementsForwardIdentityTo: anArrayWithSmallIntegers copyHash: false.<br>
It would not work to copy the source hash to a SmallInteger.<br>
<br>
Next is understanding forwarding blocks and the process of remapping objects using them. &nbsp;There are three steps:<br>
 &nbsp; 1) #prepareForwardingTableForBecoming:with:twoWay: &nbsp;&quot;create and init forwarding blocks, and install into original headers&quot;<br>
 &nbsp; 2) #mapPointersInObjectsFrom:to: &nbsp;&quot;point pointers to forwarded oop&quot;<br>
 &nbsp; 3) #restoreHeadersAfterForwardBecome: &quot;restore original headers&quot;<br>
The question seems to come down to the following. &nbsp;Can forwarding blocks point to SmallIntegers?<br>
<br>
Rob<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Paolo<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div><br></div></div>