<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 13, 2015 at 8:59 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> <br><br>
&gt; On 13.01.2015, at 17:30, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; On 13.01.2015, at 03:29, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I was driving home this afternoon and it popped into my head. I am quite<br>
&gt;&gt;&gt; sure the the problem is due to the change in floating point word<br>
&gt;&gt;&gt; ordering<br>
&gt;&gt;&gt; in the Cog image format (6505). If you trace an image that is running<br>
&gt;&gt;&gt; under<br>
&gt;&gt;&gt; a Cog VM on a little endian host, the Float objects will require special<br>
&gt;&gt;&gt; handling to put them back into the original canonical format (which is<br>
&gt;&gt;&gt; not<br>
&gt;&gt;&gt; the native machine order on a little endian machine).<br>
&gt;&gt;<br>
&gt;&gt; But the word accessors in Float handle that I thought? Or don&#39;t they, in<br>
&gt;&gt; 64 bits?<br>
&gt;&gt;<br>
&gt;&gt; - Bert -<br>
&gt;&gt;<br>
&gt;<br>
&gt; This issue would be that the in-memory representation of the float objects<br>
&gt; (which contain two 4-byte words of data) have the words reversed (i.e. put<br>
&gt; into machine word order) when running on Cog on a little endian machine.<br>
&gt; That in-memory representation is the thing being written out to disk<br>
&gt; during the trace. The tracer thinks that it is writing objects with fields<br>
&gt; in the original (format 6504, non-Cog) format, and it does not know when<br>
&gt; it encounters a Float object that it needs to swap the data words. The<br>
&gt; reason that it does not know this is that nobody has implemented it yet<br>
&gt; :-)<br>
&gt;<br>
&gt; Dave<br>
<br>
I know that. I also know that Float&gt;&gt;basicAt: uses primitive 38 which is designed to always answer the words of a Float as if they were stored in big-endian order, no matter what the actual memory order is.<br></blockquote><div><br></div><div>And  Float&gt;&gt;basicAt:put: uses primitive 39.  I had to add these to Cog so that the VM was free for the underlying platform to choose the most efficient representation.  It is a shame that we&#39;re saddled with a bug-endian order since large integers are little endian.  But don&#39;t sweat the petty stuff, pet the sweaty stuff...</div></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>