[Vm-dev] Re: A trick to speedup #become: (but not becomeForward:)

Igor Stasenko siguctua at gmail.com
Sun Jul 31 22:15:27 UTC 2011

On 31 July 2011 20:03, Levente Uzonyi <leves at elte.hu> wrote:
> On Sun, 31 Jul 2011, Igor Stasenko wrote:
>> I found that similar primitive could be implemented to behave
>> analogically to becomeForward:
>> (to copy memory contents of one object over another one).
>> This is not strictly equivalent to becomeForward, since
>> if you have objects x , y
>> and forwarding x -> y
>> then all who were pointing to x will point to y.
>> While with copy-over, obviously the pointers remain unchanged. But it
>> may be not too important, since
>> the most often use case for #becomeForward: is like:
>> newObject := SomeClass new.
>> newObject initAndFillContents bla bla.
>> SomeGlobalObject becomeForward: newObject
>> ( and newObject is not used anywhere outside this scope)
> primitiveCopyObject (#168, Object >> #copyFrom:) can be used for this
> already. It only works for pointer objects of the same class and same size,
> but I guess this covers most use cases. New features (if any) should be
> added to this primitive IMHO.
Yes, thanks for reminder.
I modified this prim to relax requirements (so it is not necessary
that source and dest should be of same format and even more - of same
but it is necessary that their header types and size in memory are the same.

(i added the code to
> Btw +1 from me for your #become: speedup idea.
> Levente

Best regards,
Igor Stasenko AKA sig.

More information about the Vm-dev mailing list