<br><br><div class="gmail_quote">On Wed, Aug 18, 2010 at 8:33 AM, Andreas Raab <span dir="ltr">&lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
On 8/18/2010 2:21 AM, Bert Freudenberg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 18.08.2010, at 04:48, Andreas Raab wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 8/17/2010 6:54 PM, Eliot Miranda wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In the VW VM I added code to choose a class in the<br>
specialObjectsArray (Array) and search it for a byte object with the<br>
characters &#39;Array&#39; and use that as the class name index.  Similarly its<br>
class was searched for an object equal to Array and that slot was used<br>
as the thisClass index.  I see I was too lazy to do that in<br>
StackInterpreter&gt;&gt;initializeInterpreter but I should, and should<br>
introduce classNameIndex and thisClassIndex and use them in place of the<br>
hard-coded constants.  That way one can save immediately after<br>
adding/removing the behavior inst var and have the VM get things right<br>
on start-up.<br>
</blockquote>
<br>
That&#39;s one option. An alternative is to provide the class name index via the splObjsArray and default to 5 if not present.<br>
</blockquote>
<br>
I like Elliot&#39;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.<br>

</blockquote>
<br></div></div>
I&#39;m not entirely sure about that. You do have to maintain the information that after adding an ivar you&#39;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.<br>
</blockquote><div><br></div><div>That&#39;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</div><div>    self integerValueFor: (self splObj: ClassNameIndexIndex)</div>
<div>and much more fragile (e.g. if this entry gets damaged then no printCallStack)</div><div><br></div><div>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.</div>
<div><br></div><div>best</div><div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Cheers,<br><font color="#888888">
  - Andreas<br>
</font></blockquote></div><br>