[Vm-dev] About the image
eliot.miranda at gmail.com
Wed Aug 18 16:59:47 UTC 2010
On Wed, Aug 18, 2010 at 8:33 AM, Andreas Raab <andreas.raab at gmx.de> wrote:
> On 8/18/2010 2:21 AM, Bert Freudenberg wrote:
>> On 18.08.2010, at 04:48, Andreas Raab wrote:
>>> On 8/17/2010 6:54 PM, Eliot Miranda wrote:
>>>> In the VW VM I added code to choose a class in the
>>>> specialObjectsArray (Array) and search it for a byte object with the
>>>> characters 'Array' and use that as the class name index. Similarly its
>>>> class was searched for an object equal to Array and that slot was used
>>>> as the thisClass index. I see I was too lazy to do that in
>>>> StackInterpreter>>initializeInterpreter but I should, and should
>>>> introduce classNameIndex and thisClassIndex and use them in place of the
>>>> hard-coded constants. That way one can save immediately after
>>>> adding/removing the behavior inst var and have the VM get things right
>>>> on start-up.
>>> That's one option. An alternative is to provide the class name index via
>>> the splObjsArray and default to 5 if not present.
>> I like Elliot's option better. Not having to maintain that index means
>> there is one thing less to worry about. If the added flexibility of an
>> explicit index is needed later, it could still be added at that point.
> I'm not entirely sure about that. You do have to maintain the information
> that after adding an ivar you'll have to save and restart the image or else
> strange things will happen. This effect is nowhere documented. With the
> index you could automate the process (using the ClassBuilder notification)
> so that if Class chnages shape it updates the splObj entry automatically.
That's a fair point, but changing the shape of Behavior is an edge case
anyway, and the VM code with the specialObjectsArray approach is ugly
self integerValueFor: (self splObj: ClassNameIndexIndex)
and much more fragile (e.g. if this entry gets damaged then no
One could just as easily document the VM behavior by changing the
ClassBuilder to notify that when the name and thisClass inst vars change
their index the programmer should save quit and resume, as make the
ClassBuilder update a specialObjectsArray entry.
> - Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev