[Vm-dev] Why "object becomeForward: 3" is not working?

Eliot Miranda eliot.miranda at gmail.com
Thu Mar 17 21:16:13 UTC 2016


Hi Denis,

> On Mar 17, 2016, at 6:35 AM, Denis Kudriashov <dionisiydk at gmail.com> wrote:
> 
> So to implement becomeForward: with integer argument it is needed to scan all references to receiver and change pointers body to hold integer value.
> Am I right?

If you were to implement it at the image level, yes.  But you don't want to do that right?  Let's imagine you were asking the question about the VM.  Then the answer is:

Half right :-).  That's what happened before Spur.  Now what happens is that the object gets modified into a forwarding pointer to the object it becomes.  In a two-way become we create two copies of the objects and make the originals point to the other copy, unless they are the same size, in which case we exchange their contents.  (remember that bug with zero-sized objects which was due to a C compiler aliasing bug?)


In any case, the becomeForward:copyHash: false case should not fail for immediate targets.  I'll make it so soon.  But you're welcome to try yourself ;-)

_,,,^..^,,,_ (phone)

> 
> 2016-03-17 13:52 GMT+01:00 David T. Lewis <lewis at mail.msen.com>:
>> 
>> On Thu, Mar 17, 2016 at 09:57:51AM +0100, Denis Kudriashov wrote:
>> >
>> > Hi.
>> >
>> > I investigate that #becomeForward: is not working for SmallInteger args. It
>> > is mentioned in method comment:
>> >
>> > Fails if either argument is a SmallInteger.
>> >
>> >
>> > I guess that it is not working for any immediate argument. For example it
>> > is failed for Character too.
>> >
>> > So I am interesting why it is not supported?
>> 
>> The become mechanism is swapping references to objects, such that the
>> object pointers that pointed to one object are all now pointing to another.
>> An immediate object such as SmallInteger is hiding its value within the
>> object pointer itself (so it not really a pointer when used in this way).
>> The immediate object "pointer" is therefore not able to participate in
>> reference swapping.
>> 
>> Dave
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160317/cfdfa85b/attachment.htm


More information about the Vm-dev mailing list