<br><br><div class="gmail_quote">On Thu, Feb 12, 2009 at 7:38 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.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>
On Thu, Feb 12, 2009 at 11:18:02AM -0800, Eliot Miranda wrote:<br>
&gt;<br>
&gt; AFAICT you can produce a 64-bit VM that runs a 32-bit image with this<br>
&gt; technique, but you can&#39;t get a VM that runs both.<br>
<br>
Actually, I think that it probably *is* possible to make a Squeak<br>
VM that will run both 32 and 64 bit images, although performance may<br>
be poor and the plugins would be problematic. The basic idea is to<br>
move BytesPerWord and BaseHeaderSize into run time variables rather<br>
than compile time macros (i.e. move them from class variables in<br>
ObjectMemory to instance variables in ObjectMemory), and set the<br>
values at image load time. Everything else should just work.</blockquote><div><br></div><div>You&#39;ll have to change&nbsp;oopForPointer/pointerForOop to account for the different widths of an oop. &nbsp;e.g. if the heap is origined at 0 then in a 64-bit image the oop 4 maps to byte address 8, but in a 32-bit image it maps to byte address 4.</div>
<div><br></div><div>You&#39;ll have to change the readers and writers (e.g.&nbsp;oopAtPointer/oopAtPointerPut) to test BytesPerWord and fetch/store 64 or 32 bits as required.</div><div><br></div><div>At least.</div><div><br></div>
<div>It won&#39;t be particularly sprightly :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I&#39;ve been meaning to do this for quite some time but have not gotten<br>

around to trying it.<br>
<br>
Dave<br>
<br>
</blockquote></div><br>