[Vm-dev] Re: A trick to speedup #become: (but not becomeForward:)
leves at elte.hu
Sun Jul 31 18:03:54 UTC 2011
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.
Btw +1 from me for your #become: speedup idea.
> It is clear in such case, copying newObject contents ->
> SomeGlobalObject will be enough for developer's intents,
> and therefore an additional primitive which copies bytes from one
> object to another could also be useful.
> And yes, i'd like to hear your concerns about these primitives in
> addition to what Andreas said.
> Since i think we should introduce them into VMs to dramatically
> speedup become :)
> Best regards,
> Igor Stasenko AKA sig.
More information about the Vm-dev