<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 2:43 PM, Tobias Pape <span dir="ltr"><<a href="mailto:Das.Linux@gmx.de" target="_blank">Das.Linux@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>Hi,<br>
<br>
On 08.09.2014, at 23:23, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
<br>
><br>
> Hi Eliot,<br>
><br>
> Agreed, the primitive will need to be rewritten to work with a 64-bit<br>
> SmallInteger. There may be other integer primitives that will need<br>
> attention too, although I have not looked.<br>
><br>
<br>
Having tried implementing other SqueakVMs, my impression is, that the<br>
SmallInt-is-31-bit assumption is like everywhere. Starting with some<br>
int-primitives and not ending with bitBlt. We really have to be careful<br>
here.<br></blockquote><div><br></div><div>That's what tests and sheer bloody-mindedness are for ;-)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Best<br>
-Tobias<br>
<br>
> Dave<br>
><br>
>> Hi David,<br>
>><br>
>> On Mon, Sep 8, 2014 at 12:18 PM, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>><br>
>> wrote:<br>
>><br>
>>><br>
>>> I know that "unsigned" means "unsigned int". 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<br>
>>> 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>
>>><br>
>><br>
>> OK, then it is fixing it in a way that will break a 64-bit implementation<br>
>> that uses 64-bit SmallIntegers. Personally I find the method defective<br>
>> (for reasons already stated), and will be rewriting it soon.<br>
>><br>
>><br>
>>> Dave<br>
>>><br>
>>>> Hi David,<br>
>>>><br>
>>>> and another issue is that "unsigned" is shorthand for "unsigned<br>
>>> int",<br>
>>>> so<br>
>>>> if you wanted to generalize the method to handle integers of the<br>
>>> system's<br>
>>>> word size (as is the case with 64-bit Spur which will have 61-bit<br>
>>>> SmallIntegers, unlike the 31-bit SmallIntegers in 64-bit Squeak) you'd<br>
>>>> want<br>
>>>> to use "usqInt", not "unsigned".<br>
>>>><br>
>>>> On Sat, Sep 6, 2014 at 8:45 PM, <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br>
>>>><br>
>>>>><br>
>>>>> David T. Lewis uploaded a new version of VMMaker to project VM Maker:<br>
>>>>> <a href="http://source.squeak.org/VMMaker/VMMaker-dtl.350.mcz" target="_blank">http://source.squeak.org/VMMaker/VMMaker-dtl.350.mcz</a><br>
>>>>><br>
>>>>> ==================== Summary ====================<br>
>>>>><br>
>>>>> Name: VMMaker-dtl.350<br>
>>>>> Author: dtl<br>
>>>>> Time: 6 September 2014, 11:44:28.389 pm<br>
>>>>> UUID: 2ad132b0-5fb3-4580-b5a8-29af12c3cb81<br>
>>>>> Ancestors: VMMaker-dtl.349<br>
>>>>><br>
>>>>> VMMaker 4.13.6<br>
>>>>><br>
>>>>> Fix primitiveBitShift (primitive 17) for sqInt declared 64 bits, as<br>
>>> in a<br>
>>>>> VM for 64-bit image format 68002.<br>
>>>>><br>
>>>>> In image format 68002, bit shift left failed because of return type<br>
>>>>> limited to a 32-bit large integer, but internally the primitive<br>
>>>>> successfully shifted left into a variable declared as a 64 bit<br>
>>> sqInt..<br>
>>>>> The<br>
>>>>> simple fix (implemented here) is to declare the variable as 32 bit<br>
>>>>> unsigned<br>
>>>>> to agree with the 32-bit logic of the existing primitive.<br>
>>>>><br>
>>>>> Note that permitting a left shift into a 64 bit variable makes sense<br>
>>>>> generally, and the primitive could be recoded to accomodate this for<br>
>>>>> shift<br>
>>>>> left, with the primitive answering positive64BitIntegerFor: rather<br>
>>> than<br>
>>>>> positive32BitIntegerFor: in the case of a shift left to allow for the<br>
>>>>> greater range (not implemented in this update).<br>
>>>>><br>
>>>>> With this update, all KernelTests-Numbers tests pass for the 64-bit<br>
>>>>> image<br>
>>>>> format 68002.<br>
>>>>><br>
>>>>> =============== Diff against VMMaker-dtl.349 ===============<br>
>>>>><br>
>>>>> Item was changed:<br>
>>>>> ----- Method: InterpreterPrimitives>>primitiveBitShift (in category<br>
>>>>> 'arithmetic integer primitives') -----<br>
>>>>> primitiveBitShift<br>
>>>>> | integerReceiver integerArgument shifted |<br>
>>>>> + <var: #shifted type: 'unsigned'><br>
>>>>> +<br>
>>>>> integerArgument := self popInteger.<br>
>>>>> integerReceiver := self popPos32BitInteger.<br>
>>>>> self successful ifTrue: [<br>
>>>>> integerArgument >= 0 ifTrue: [<br>
>>>>> "Left shift -- must fail if we lose bits<br>
>>> beyond<br>
>>>>> 32"<br>
>>>>> self success: integerArgument <= 31.<br>
>>>>> shifted := integerReceiver <<<br>
>>> integerArgument.<br>
>>>>> self success: (shifted >> integerArgument) =<br>
>>>>> integerReceiver.<br>
>>>>> ] ifFalse: [<br>
>>>>> "Right shift -- OK to lose bits"<br>
>>>>> self success: integerArgument >= -31.<br>
>>>>> shifted := integerReceiver >> (0 -<br>
>>>>> integerArgument).<br>
>>>>> ].<br>
>>>>> ].<br>
>>>>> self successful<br>
>>>>> ifTrue: [self push: (self positive32BitIntegerFor:<br>
>>>>> shifted)]<br>
>>>>> ifFalse: [self unPop: 2]!<br>
>>>>><br>
>>>>> Item was changed:<br>
>>>>> ----- Method: VMMaker class>>versionString (in category 'version<br>
>>>>> testing') -----<br>
>>>>> versionString<br>
>>>>><br>
>>>>> "VMMaker versionString"<br>
>>>>><br>
>>>>> + ^'4.13.6'!<br>
>>>>> - ^'4.13.7'!<br>
>>>>><br>
>>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> best,<br>
>>>> Eliot<br>
>>>><br>
>>><br>
>>><br>
>>><br>
>><br>
>><br>
>> --<br>
>> best,<br>
>> Eliot<br>
<br>
<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>