<br><br><div class="gmail_quote">On Thu, Mar 22, 2012 at 7:26 AM, Camillo Bruni <span dir="ltr">&lt;<a href="mailto:camillobruni@gmail.com">camillobruni@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On 2012-03-22, at 15:06, Stefan Marr wrote:<br>
<br>
&gt;<br>
&gt; On 22 Mar 2012, at 14:45, Camillo Bruni wrote:<br>
&gt;<br>
&gt;&gt; let&#39;s have some fun and do<br>
&gt;&gt;<br>
&gt;&gt; Object subclass: #Behavior<br>
&gt;&gt;      uses: TPureBehavior<br>
&gt;&gt;      instanceVariableNames: &#39;superclass methodDict format layout&#39;<br>
&gt;&gt;      classVariableNames: &#39;ObsoleteSubclasses&#39;<br>
&gt;&gt;      poolDictionaries: &#39;&#39;<br>
&gt;&gt;      category: &#39;Kernel-Classes&#39;<br>
&gt;&gt;<br>
&gt;&gt; proceed over the several warnings not to change Behavior and BOOM! :D<br>
&gt;<br>
&gt; Check classNameIndex and thisClassIndex in the VM implementation.<br>
&gt; They are typically the hardcoded indices into the expected object layout of Class objects.<br>
&gt;<br>
&gt; And you just changed the layout -&gt; BOOM! magic ;)<br>
&gt;<br>
&gt; I don&#39;t know how much overhead it is to examine such kind of indices dynamically, but we do deduce indices based on inst var names to be able to support the different object layouts.<br>
&gt; For my stuff, I do that at VM startup, which would not help you.<br></div></blockquote><div><br></div><div>They would be expensive to recompute all the time (they&#39;re used in debug printing).  But they&#39;re not expensive to compute. So they could be recomputed easily.  See below.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
&gt; David did it dynamically for the Process class and checked the object identity of the class I think, to know when to update the index table after a layout change.<br>
<br>
</div>right. I guess I will have to move it to some further position...<br>
although I have an old image with:<br>
<br>
Behavior subclass: #ClassDescription<br>
        layout: PointerLayout<br>
        uses: TClassAndTraitDescription<br>
        slots: {<br>
                #instanceVariables =&gt; Slot.<br>
                #organization =&gt; Slot.<br>
                #layout =&gt; Slot.<br>
        }<br>
        classSlots: {}<br>
        globals: &#39;&#39;<br>
        category: #&#39;Kernel-Classes&#39;<br>
<br>
<br>
which works under said Cog version :/. I guess I will just have to find some older VM which will support the changes<br></blockquote><div><br></div><div>I think we should make the VM work for this.   classNameIndex and thisClassIndex should only be used for debug printing, at least thats my intent, and it would be possible to flush them and recompute them as a side-effect of e.g. a flushCache primitive.</div>
</div><div><br></div>Camilo, would you create a reproducible case for me, an image that applies this change at start-up?  Thanks.<div><br></div><div>Also, can we please get into the habit of cc&#39;ing vm-dev for issues that touch on the VM?  I ask this so that subsequent searching for VM issues can be confined to a search of vm-dev archives.  Again AdvThanksance.<br>
-- <br>best,<div>Eliot</div><br>
</div>