<br><br><div class="gmail_quote">On Fri, Apr 6, 2012 at 10:53 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">
<div><div></div><div class="h5"><br>
On 6 April 2012 19:26, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Apr 6, 2012 at 9:45 AM, Igor Stasenko &lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 6 April 2012 18:37, Hans-Martin Mosner &lt;<a href="mailto:hmm@heeg.de">hmm@heeg.de</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Am 06.04.2012 16:41, schrieb Guillermo Polito:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Hi!<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I was wandering what are the implications of a class being compact or not.<br>
&gt;&gt; &gt; And also what happens if a class has it&#39;s format thinking it&#39;s compact but<br>
&gt;&gt; &gt; it&#39;s not in the compact classes array?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;m looking at the implications of bootstrapping a smalltalk inside the<br>
&gt;&gt; &gt; same environment, and having two CompiledMethod classes, two Array classes,<br>
&gt;&gt; &gt; etc, brings me to this issue :).<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks!<br>
&gt;&gt; &gt; Guille<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Compact classes must be in the compact classes array so their instances know their correct class.<br>
&gt;&gt; &gt; If you want to bootstrap an image inside another one, do it without compact classes.<br>
&gt;&gt; &gt; You can always add them later when needed (which is somewhat questionable, because their space-saving advantage has a corresponding speed disadvantage).<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; yes, basically you can &quot;convert/copy&quot; any compact class to non-compact<br>
&gt;&gt; one. And construct a valid class object with methods etc.<br>
&gt;&gt; Everything will be fine unless you want to also create and use<br>
&gt;&gt; instances of such classes. Then you are in trouble.<br>
&gt;&gt; So, as long as you can guarantee that you don&#39;t run any code with<br>
&gt;&gt; those classes which involves instantiation,<br>
&gt;&gt;<br>
&gt;&gt; there will be no problems.<br>
&gt;<br>
&gt;<br>
&gt; Um, no.  Only for certain classes can you freely convert between compact and uncompact.  The various VMs assume some classes are always compact (because its faster to check their class).<br>
&gt;<br>
<br>
&gt; In the Interpreter BlockContext and MethodContext must be at indices 13 and 14.<br>
&gt;<br>
</div></div>What i meant is that you can replicate both of those i.e. create a<br>
uncompact BlockContext&#39; and MethodContext&#39;<br>
and can compile methods for them.. but should avoid instantiation.<br></blockquote><div><br></div><div>Right.  And you can create compact versions that use unused indices in the array, the last 15 being unused.  Then later you could post-process rearrange compact class indices, getting rid of the old ones at the earlier indices.</div>
<div> </div><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>
<br>
&gt; In the Stack and Cog VMs the following classes must be at the corresponding indices<br>
&gt; Array at 3<br>
&gt; LargeNegativeInteger at 4<br>
&gt; LargePositiveInteger at 5<br>
&gt; Float at 6<br>
&gt; MethodContext at 14<br>
&gt;<br>
&gt; Further, the Stack and Cog VM determines the index of class ByteString at startup and uses it in debug printing, stack dump generation etc.<br>
&gt;<br>
&gt; If one needs to freely alter the compactClassesArray with a Stack or Cog VM one needs to generate a special VM where the various compact class indices (ClassArrayCompactIndex, et al, see ObjectMemory class&gt;initializeCompactClassIndices) are zero.  This should work, but hasn&#39;t been tested.<br>

&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; Cheers,<br>
&gt;&gt; &gt; Hans-Martin<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Best regards,<br>
&gt;&gt; Igor Stasenko.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; best,<br>
&gt; Eliot<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko.<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>