[Squeak-e] Programming the VM
Mark S. Miller
markm at caplet.com
Mon Feb 3 13:00:33 CET 2003
At 12:41 PM 2/3/2003 Monday, Andreas Raab wrote:
>> Ok. My gut feeling is indeed that this is better than dynamic scoping.
>> So we need an extra slot. Time to bring in the VM hacking squad ;-)
>>
>> (FYI: the VM object format is destined to change in Squeak 3.5, for
>> 'real' closures or whatever. So this is the ideal time to request such
>> changes).
>
>I don't know where you heard that the object format is going to be changed
>in 3.5 but adding a pointer to every object is unlikely to be done unless
>you have a Very Good Reason(tm). It will instantly break all plugins and the
>added space and GC overhead is not to be taken lightly.
Ok, here's another way to do it. Instead of modifying the format of a
virtualized object, have the virtualized object point at a virtualized
class instead of the real one. Make the layout changes in the virtualized
class.
Each class "loaded" into a given virtual "machine", ie, each class
that will be instantiated by a given virtualizer, ie, each class that is to
be as-if interpreted by that virtualizer, is itself first virtualized. This
means that a new Behavior object of some kind is allocated, usually sharing
method dictionary with the original class object as well as wrapping the
original class object. (Can two behaviors in Smalltalk share a method
dictionary?) The instance is now just the regular instance, but points at
the virtualized class instead of the real one.
Instances of normal classes would be unchanged, would be normal Squeak
objects, and would be seen by Squeak-E as primitive objects; just as E sees
Java objects.
Could this work? Might it even work without needing any VM changes?
----------------------------------------
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the Squeak-e
mailing list