<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2014-05-07 13:16 GMT+02:00 Helmut Rohregger <span dir="ltr">&lt;<a href="mailto:helmut.rohregger@gmail.com" target="_blank">helmut.rohregger@gmail.com</a>&gt;</span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I am interested in the squeak class format word, which is an instance variable of every squeak class object. I could not find much info about it...<br>
<br>
The low 2 bits are size bits - size of what? header?<br>
Behavior&gt;&gt;instSize shows how to fetch the number of instance variables for an object.<br>
Thats it...<br>
<br>
For example, the format for &#39;Object&#39; is 2, for &#39;Array&#39; its 6402, for &#39;MethodContext&#39; its 29070.<br>
Can anybody tell me what additional info is stored in this format word?<span class=""><font color="#888888"><br>
<br>
- Helmut<br>
<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">It&#39;s all in image.<br></div><div class="gmail_extra">Search for inst var write of format<br><br>ClassDescription&gt;&gt;superclass: aClass methodDictionary: mDict format: fmt<br>
ClassBuilder&gt;&gt;privateNewSubclassOf: newSuper from: oldClass<br>ClassBuilder&gt;&gt;computeFormat: type instSize: newInstSize forSuper: newSuper ccIndex: ccIndex<br>ClassBuilder&gt;&gt;format: nInstVars variable: isVar words: isWords pointers: isPointers weak: isWeak<br>
<br></div><div class="gmail_extra">You will find from highest bits to lowest bits of the SmallInteger:<br><br></div><div class="gmail_extra">2 bits for instanceSize high bits<br></div><div class="gmail_extra">5 bits for compactClassIndex (there are 32 possiblie compact classes)<br>
</div><div class="gmail_extra">4 bits for instanceSpecification<br></div><div class="gmail_extra">6 bits for instanceSize low bits<br></div><div class="gmail_extra">1 bit = 0 unused (alignment for wordSize in 32bits)<br><br>
</div><div class="gmail_extra">Note that instanceSize = number of instance variables + 1.<br><br></div><div class="gmail_extra">In memory, there is one more bit for representing the SmallInteger:<br></div><div class="gmail_extra">
1 bit = 1 (=SmallInteger)<br><br></div><div class="gmail_extra">Thus, the low 8 bits represent the size in bytes of a Word-oriented object (variableWord: or pointers...)<br>(assuming the object has at most 63 inst.var. and assuming a 32bits image)<br>
</div></div>