<div dir="ltr">Hi David,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 12:18 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">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>
I know that &quot;unsigned&quot; means &quot;unsigned int&quot;. That is the intent.<br>
<br>
With the primitive as currently implemented, that variable must be 32<br>
bits, otherwise the shift left can successfully produce a five byte large<br>
integer that is truncated to four without failing the primitive. This<br>
change is to fix the current implementation of the primitive in the case<br>
of sizeof(sqInt) == 8.<br></blockquote><div><br></div><div>OK, then it is fixing it in a way that will break a 64-bit implementation that uses 64-bit SmallIntegers.   Personally I find the method defective (for reasons already stated), and will be rewriting it soon.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Dave<br>
<div class="HOEnZb"><div class="h5"><br>
&gt;  Hi David,<br>
&gt;<br>
&gt;    and another issue is that &quot;unsigned&quot; is shorthand for &quot;unsigned int&quot;,<br>
&gt; so<br>
&gt; if you wanted to generalize the method to handle integers of the system&#39;s<br>
&gt; word size (as is the case with 64-bit Spur which will have 61-bit<br>
&gt; SmallIntegers, unlike the 31-bit SmallIntegers in 64-bit Squeak) you&#39;d<br>
&gt; want<br>
&gt; to use &quot;usqInt&quot;, not &quot;unsigned&quot;.<br>
&gt;<br>
&gt; On Sat, Sep 6, 2014 at 8:45 PM, &lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; David T. Lewis uploaded a new version of VMMaker to project VM Maker:<br>
&gt;&gt; <a href="http://source.squeak.org/VMMaker/VMMaker-dtl.350.mcz" target="_blank">http://source.squeak.org/VMMaker/VMMaker-dtl.350.mcz</a><br>
&gt;&gt;<br>
&gt;&gt; ==================== Summary ====================<br>
&gt;&gt;<br>
&gt;&gt; Name: VMMaker-dtl.350<br>
&gt;&gt; Author: dtl<br>
&gt;&gt; Time: 6 September 2014, 11:44:28.389 pm<br>
&gt;&gt; UUID: 2ad132b0-5fb3-4580-b5a8-29af12c3cb81<br>
&gt;&gt; Ancestors: VMMaker-dtl.349<br>
&gt;&gt;<br>
&gt;&gt; VMMaker 4.13.6<br>
&gt;&gt;<br>
&gt;&gt; Fix primitiveBitShift (primitive 17) for sqInt declared 64 bits, as in a<br>
&gt;&gt; VM for 64-bit image format 68002.<br>
&gt;&gt;<br>
&gt;&gt; In image format 68002, bit shift left failed because of return type<br>
&gt;&gt; limited to a 32-bit large integer, but internally the primitive<br>
&gt;&gt; successfully shifted left into a variable declared as a 64 bit sqInt..<br>
&gt;&gt; The<br>
&gt;&gt; simple fix (implemented here) is to declare the variable as 32 bit<br>
&gt;&gt; unsigned<br>
&gt;&gt; to agree with the 32-bit logic of the existing primitive.<br>
&gt;&gt;<br>
&gt;&gt; Note that permitting a left shift into a 64 bit variable makes sense<br>
&gt;&gt; generally, and the primitive could be recoded to accomodate this for<br>
&gt;&gt; shift<br>
&gt;&gt; left, with the primitive answering positive64BitIntegerFor: rather than<br>
&gt;&gt; positive32BitIntegerFor: in the case of a shift left to allow for the<br>
&gt;&gt; greater range (not implemented in this update).<br>
&gt;&gt;<br>
&gt;&gt; With this update, all KernelTests-Numbers tests pass for the 64-bit<br>
&gt;&gt; image<br>
&gt;&gt; format 68002.<br>
&gt;&gt;<br>
&gt;&gt; =============== Diff against VMMaker-dtl.349 ===============<br>
&gt;&gt;<br>
&gt;&gt; Item was changed:<br>
&gt;&gt;   ----- Method: InterpreterPrimitives&gt;&gt;primitiveBitShift (in category<br>
&gt;&gt; &#39;arithmetic integer primitives&#39;) -----<br>
&gt;&gt;   primitiveBitShift<br>
&gt;&gt;         | integerReceiver integerArgument shifted |<br>
&gt;&gt; +       &lt;var: #shifted type: &#39;unsigned&#39;&gt;<br>
&gt;&gt; +<br>
&gt;&gt;         integerArgument := self popInteger.<br>
&gt;&gt;         integerReceiver := self popPos32BitInteger.<br>
&gt;&gt;         self successful ifTrue: [<br>
&gt;&gt;                 integerArgument &gt;= 0 ifTrue: [<br>
&gt;&gt;                         &quot;Left shift -- must fail if we lose bits beyond<br>
&gt;&gt; 32&quot;<br>
&gt;&gt;                         self success: integerArgument &lt;= 31.<br>
&gt;&gt;                         shifted := integerReceiver &lt;&lt; integerArgument.<br>
&gt;&gt;                         self success: (shifted &gt;&gt; integerArgument) =<br>
&gt;&gt; integerReceiver.<br>
&gt;&gt;                 ] ifFalse: [<br>
&gt;&gt;                         &quot;Right shift -- OK to lose bits&quot;<br>
&gt;&gt;                         self success: integerArgument &gt;= -31.<br>
&gt;&gt;                         shifted := integerReceiver &gt;&gt; (0 -<br>
&gt;&gt; integerArgument).<br>
&gt;&gt;                 ].<br>
&gt;&gt;         ].<br>
&gt;&gt;         self successful<br>
&gt;&gt;                 ifTrue: [self push: (self positive32BitIntegerFor:<br>
&gt;&gt; shifted)]<br>
&gt;&gt;                 ifFalse: [self unPop: 2]!<br>
&gt;&gt;<br>
&gt;&gt; Item was changed:<br>
&gt;&gt;   ----- Method: VMMaker class&gt;&gt;versionString (in category &#39;version<br>
&gt;&gt; testing&#39;) -----<br>
&gt;&gt;   versionString<br>
&gt;&gt;<br>
&gt;&gt;         &quot;VMMaker versionString&quot;<br>
&gt;&gt;<br>
&gt;&gt; +       ^&#39;4.13.6&#39;!<br>
&gt;&gt; -       ^&#39;4.13.7&#39;!<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; best,<br>
&gt; Eliot<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>