<br><br><div class="gmail_quote">On Wed, Feb 18, 2009 at 5:09 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@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;">
<br>
A headerTypeBytes ivar used in Interpreter, but initialized only once<br>
during its lifetime - in readImageFromFile: f HeapSize:<br>
desiredHeapSize StartingAt: imageOffset),<br>
and with same constants:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;headerTypeBytes at: 0 put: BytesPerWord * 2. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;3-word header (type 0)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;headerTypeBytes at: 1 put: BytesPerWord. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;2-word header (type 1)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;headerTypeBytes at: 2 put: 0. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;free chunk (type 2)&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;headerTypeBytes at: 3 put: 0. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;1-word header (type 3)&quot;<br>
<br>
I think this initialization could be put into static var declaration,<br>
in #declareCVarsIn:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;aCCodeGenerator<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var: #headerTypeBytes<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;declareC: &#39;static sqInt headerTypeBytes[4] = { blablabla}&#39;.</blockquote><div><br></div><div>Make this &nbsp;declareC: &#39;static const sqInt headerTypeBytes[4] = { blablabla}&#39;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^^^^^</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
<br>
then we don&#39;t have to pollute already complex #readImageFromFile:...<br>
method with odd stuff like this.<br>
<br>
It maybe not worth much attention for Squeak VM, but for Hydra, i<br>
found that this ivar placed into Interpreter struct (which means that<br>
each instance of interpreter will having separate &nbsp;headerTypeBytes).<br>
There are tons of ivars in ObjectMemory and Interpreter and its hard<br>
to track all, which worth keeping on a per-interpreter basis :)<br>
<font color="#888888"><br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
</font></blockquote></div><br>