[Vm-dev] [commit] r2463 - CogVM source as per VMMaker.oscog-eem.105. Fix signed32BitValueOf for most neg-

Igor Stasenko siguctua at gmail.com
Thu Jul 21 16:49:21 UTC 2011


If it would help here the change (in #signed32BitValueOf:)

Before:

value < 0 ifTrue:
		[self assert: (self sizeof: value) == 4.
		 (negative
		 and: [self
				cCode: [value - 1 > 0]
				inSmalltalk: [value = -16r80000000]]) ifTrue: "Don't fail for
-2147483648 /-16r80000000"
			[^value].
	
After:
value < 0 ifTrue:
		[self assert: (self sizeof: value) == 4.
		 "Don't fail for -16r80000000/-2147483648
		  Alas the simple (negative and: [value - 1 > 0]) fails with
contemporary gcc and icc versions
		  with optimization and sometimes without.  The shift works on all,
touch wood."
		 (negative and: [0 = (self cCode: [value << 1]
									inSmalltalk: [value << 1 bitAnd: (1 << 32) - 1])]) ifTrue:
			[^value].
	

On 21 July 2011 13:30, David T. Lewis <lewis at mail.msen.com> wrote:
>
> On Thu, Jul 21, 2011 at 07:08:18AM -0400, David T. Lewis wrote:
>>
>> Commit message blocked due to size, forwarding trimmed version:
>>
>> Author: eliot
>> Date: 2011-07-18 17:35:51 -0700 (Mon, 18 Jul 2011)
>> New Revision: 2463
>
> <snip>
>
>> Log:
>> CogVM source as per VMMaker.oscog-eem.105.  Fix signed32BitValueOf for most neg-
>> ative value C compiler mis-optimization.  Speed up primitiveFail using ! trick.
>> Add multi-threaded sources to tree (won't build yet due to issue in ia32abicc.c)
>> Upgrade nscogsrc/plugins to official versions.
>
> Hi Eliot,
>
> Can you say what the issue was with signed32BitValueOf? I can
> see the changes in InterpreterPrimitives>>signed32BitValueOf:
> but I'm not clear on whether this is something that affects
> Alien, or if it is something that has been causing problems
> more generally but went unnoticed. Also, I'd like to document
> this with a unit test, so if you can suggest a code snippet
> that would be great.
>
> TIA,
> Dave
>
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list