[squeak-dev] Re: becomeForward: alternative
Rob Withers
reefedjib at yahoo.com
Thu Sep 18 16:44:35 UTC 2008
:-)
I just compiled with:
(twoWayFlag not and: [copyHashFlag not])
ifTrue: [(self containOnlyOops: array1) ifFalse: [^false]]
ifFalse: [(self containOnlyOops: array1 and: array2) ifFalse: [^false]].
but I like your positive logic better. Thanks!
Rob
----- Original Message -----
From: Eliot Miranda
To: The general-purpose Squeak developers list
Sent: Thursday, September 18, 2008 12:41 PM
Subject: Re: [squeak-dev] Re: becomeForward: alternative
Things work fine provided the become is one-way and hashes are not copied. Simply change
(self containOnlyOops: array1 and: array2) ifFalse: [^false]
in ObjectMemory>>become:with:twoWay:copyHash: to
(twoWayFlag or: [copyHashFlag])
ifTrue: [(self containOnlyOops: array1 and: array2) ifFalse: [^false]]
ifFalse: [(self containOnlyOops: array1) ifFalse: [^false]].
along with the obvious implementation of containOnlyOops:.
If so,
| foo bar |
foo := 1 at 2.
bar := { foo. foo }.
foo becomeForward: 0 copyHash: false.
{ foo. bar }
produces
#(0 #(0 0))
On Thu, Sep 18, 2008 at 9:09 AM, Rob Withers <reefedjib at yahoo.com> wrote:
----- Original Message ----- From: "Paolo Bonzini" <bonzini at gnu.org>
To: "The general-purpose Squeak developers list" <squeak-dev at lists.squeakfoundation.org>
Sent: Tuesday, September 16, 2008 3:59 PM
Subject: [squeak-dev] Re: becomeForward: alternative
Rob Withers wrote:
I am trying to becomeForward with an object and a small integer. This
of course doesn't work. Is there an alternative that would allow me to
do this?
There's actually no reason why the *destination* of a becomeForward:
cannot be a SmallInteger. It's a VM bug in my opinion.
Thanks, Paolo.
I tried looking into this a bit and here is what I have found. First off, this will only work with
#elementsForwardIdentityTo: anArrayWithSmallIntegers copyHash: false.
It would not work to copy the source hash to a SmallInteger.
Next is understanding forwarding blocks and the process of remapping objects using them. There are three steps:
1) #prepareForwardingTableForBecoming:with:twoWay: "create and init forwarding blocks, and install into original headers"
2) #mapPointersInObjectsFrom:to: "point pointers to forwarded oop"
3) #restoreHeadersAfterForwardBecome: "restore original headers"
The question seems to come down to the following. Can forwarding blocks point to SmallIntegers?
Rob
Paolo
------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080918/4127c4de/attachment.htm
More information about the Squeak-dev
mailing list
|