Hi Guillermo,<br><br><div class="gmail_quote">On Sun, Mar 18, 2012 at 5:46 PM, Guillermo Polito <span dir="ltr">&lt;<a href="mailto:guillermopolito@gmail.com">guillermopolito@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">
What about changing #recreateSpecialObjectsArray so having in mind some classes like Bitmap or Display may not be in the kernel?<br>This only changes some lines like:<br><br>...<br>    newArray at: 5 put: (self at: #Bitmap ifAbsent: [ nil ]).<br>

<br>...<br><br>    newArray at: 13 put: (self at: #Point ifAbsent: [ nil ]).<br><br>...<br><br>    newArray at: 15 put: (self at:  #Display ifAbsent: [ nil ]).<br><br>...<br><br>    newArray at: 34 put: (self at: #Point ifPresent: [ :cls | 0@0] ifAbsent: [ nil ]).<br>
</blockquote><div><br></div><div>The last one isn&#39;t used in Cog (in fact indices 32, 33 &amp; 34 are unused) and probably unused in the Interpreter.  David?</div><div><br></div><div>You may be able to get away with making Bitmap and DIsplay optional.  But Point is dug pretty deep into the VM.  Point is used for the special selector send bytecodes for #x, #y &amp; #@.  For #x &amp; #y there&#39;s a check that the class of the receiver is Point, and if so, evaluate in-line.  So that is fine; if Point is nil then #x will get sent, rather than evaluated inline.  But if the system sends #@ it&#39;ll likely crash, trying to create an object whose class is nil.</div>
<div><br></div><div>To do what you&#39;re proposing properly the VM would need to be modified to be safe.  We should perhaps discuss what the right approach is.  e.g. if Point is in fact nil then #x #y and #@ would all slow down slightly in normal use checking for the possibility of Point being nil.  This isn&#39;t an issue in Cog since these messages are compiled to regular sends; but t=in the regular interpreter and the StackInterpreter (used on e.g. Android) it may be.</div>
<div><br></div><div><br></div><div>A different approach might be to move these classes to Kernel, or to provide rump classes that raise errors when used, e.g.</div><div><br></div><div>newArray at: 13 put: (self at: #Point ifAbsent: [ RumpPoint ]).<br>
</div><div><br></div><div>(the rump of something being what&#39;s left when you take everything away, rump = behind, bottom etc)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br><br>Does anyone know if this should this break something?<br><br>Guille<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>