<div dir="ltr">Things work fine provided the become is one-way and hashes are not copied. Simply change<div><br></div><div> (self containOnlyOops: array1 and: array2) ifFalse: [^false]</div><div><br></div><div>in ObjectMemory>>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 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"><<a href="mailto:reefedjib@yahoo.com">reefedjib@yahoo.com</a>></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: "Paolo Bonzini" <<a href="mailto:bonzini@gnu.org" target="_blank">bonzini@gnu.org</a>><br>
To: "The general-purpose Squeak developers list" <<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>><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. This<br>
of course doesn't work. Is there an alternative that would allow me to<br>
do this?<br>
</blockquote>
<br>
There's actually no reason why the *destination* of a becomeForward:<br>
cannot be a SmallInteger. It'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. First off, this will only work with<br>
#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. There are three steps:<br>
1) #prepareForwardingTableForBecoming:with:twoWay: "create and init forwarding blocks, and install into original headers"<br>
2) #mapPointersInObjectsFrom:to: "point pointers to forwarded oop"<br>
3) #restoreHeadersAfterForwardBecome: "restore original headers"<br>
The question seems to come down to the following. 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>