<br><br><div class="gmail_quote">On Tue, Aug 17, 2010 at 5:38 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.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><br>
On 17.08.2010, at 13:27, stephane ducasse wrote:<br>
<br>
&gt;&gt;&gt; Hi, I have just began to work at this low level and I have 2 questions:<br>
&gt;&gt;<br>
&gt;&gt; Nice. But you need to give us a little more context. What are you trying to do?<br>
&gt;<br>
&gt; Bootstrap<br>
<br>
</div>Building an image from first principles? Nice :)<br>
<div><br>
&gt; and shaking/documenting the hidden assumptions on the way.<br>
<br>
</div>Excellent!<br>
<div><br>
&gt;&gt;&gt; - What is the minimal object structure I should implement from VM perspective?<br>
&gt;&gt;<br>
&gt;&gt; Normally you do not have to implement this, as the interpreter is shared between all platforms.<br>
&gt;<br>
&gt; yes we know. Nicolas read the chapter of tim but we wanted to check if this is still up to date.<br>
&gt; My original question was more: where can I find the class object VM interpretation (that the first slot should be superclass, format....)<br>
&gt; because I remember that we could not add an instance variable into behavior when we did traits.<br>
<br>
</div>Ah. That&#39;s a more concrete question :)<br>
<br>
I thought the three inst vars in Behavior was all the VM knew and cared about? I&#39;d consider everything else a bug ;)<br></blockquote><div><br></div><div>That&#39;s right.  See all implementors of initializeClassIndices:</div>

<div><br></div><div>BTW, you /can/ add an inst var to Behavior.  Try and evaluate</div><div><br></div><div><div>Object subclass: #Behavior</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>instanceVariableNames: &#39;superclass methodDict format extra&#39;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>classVariableNames: &#39;ObsoleteSubclasses&#39;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>poolDictionaries: &#39;&#39;</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>category: &#39;Kernel-Classes&#39;</div></div><div><br></div><div>Works for me in a 4.1 derived image.</div><div> </div><div><br></div><div>BTW Stéphane,  IMO the VM&#39;s Slang code is far friendlier than the generated C.  The Slang translator is the thing that&#39;s unfriendly.  It doesn&#39;t do much verification and so when it mistranslates it can be hard to figure out what&#39;s going on.  but the Slang/Smalltalk that implements the VM is fine. </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
&gt;&gt;&gt; - Where are defined the 3 formats of objects representation?<br>
&gt;&gt;<br>
&gt;&gt; Not sure what you mean. ObjectMemory&gt;&gt;formatOf: defines the class format bits in the header.<br>
&gt;<br>
&gt; Yes we saw that.<br>
&gt;<br>
&gt;&gt; Or do you mean the 3 header formats? Read the class comment of ObjectMemory.<br>
&gt;&gt;<br>
&gt;&gt; Also, there is a nice explanation in section A.1 of Tim&#39;s chapter in the NuBlue book:<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://www.rowledge.org/tim/squeak/assets/OE-Tour.pdf" target="_blank">http://www.rowledge.org/tim/squeak/assets/OE-Tour.pdf</a><br>
&gt;<br>
&gt; Another question was where can we get a description of the image format.<br>
&gt; I was planning to read the VM C code included the generated one.<br>
<br>
</div>The image is just a header plus a memory dump of the object memory. The header is written in Interpreter&gt;&gt;writeImageFileIO: and read in Interpreter&gt;&gt;readImageFromFile:HeapSize:StartingAt:.<br>
<font color="#888888"><br>
- Bert -</font></blockquote><div><br></div><div>best</div><div>Eliot </div></div>