[Vm-dev] VM Maker: VMMaker.oscog-eem.1426.mcz

David T. Lewis lewis at mail.msen.com
Sat Jul 18 22:49:18 UTC 2015


On Sat, Jul 18, 2015 at 08:55:27PM +0000, commits at source.squeak.org wrote:
>  
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1426.mcz
> 
> ==================== Summary ====================
> 
> Name: VMMaker.oscog-eem.1426
> Author: eem
> Time: 18 July 2015, 1:54:29.051 pm
> UUID: 94ab92ba-c5c4-4953-8566-a4cd9c38df1f
> Ancestors: VMMaker.oscog-eem.1425
> 
> Fix at least one set of 64-bit issues caused by Slang.  In particular the integerObjectOf: code resulted in (objectMemory integerObjectOf: MillisecondClockMask) evaluating to the -1 object, instead of the 16r1FFFFFFF object, which was the cause of the initially nresponsive 64-bit image on the real VM (no problem in the simulator).
> 

I can't test now to verify, but I wonder if this change is fixing the
right problem.

The CCodeGenerator>>generateIntegerObjectOf:on:indent: in VMM trunk has
been in use long enough that it has no author initials. I have found it
to work correctly on all combinations of 32/64 bit image and VM. If it
does not work correctly, I would be inclined to suspect type declaration
issues elsewhere.

Original implementation:

CCodeGenerator>>generateIntegerObjectOf: msgNode on: aStream indent: level
	"Generate the C code for this message onto the given stream."

	aStream nextPutAll: '(('.
	self emitCExpression: msgNode args first on: aStream.
	aStream nextPutAll: ' << 1) | 1)'.

Dave


> =============== Diff against VMMaker.oscog-eem.1425 ===============
> 
> Item was changed:
>   ----- Method: CCodeGenerator>>generateIntegerObjectOf:on:indent: (in category 'C translation') -----
>   generateIntegerObjectOf: msgNode on: aStream indent: level
>   	"Generate the C code for this message onto the given stream."
> + 	| expr castToSqint |
> + 	expr := msgNode args first.
> + 	aStream nextPutAll: '(('.
> + 	"Note that the default type of an integer constant in C is int.  Hence we /must/
> + 	 cast constants to long if in the 64-bit world, since e.g. in 64-bits
> + 		(int)(16r1FFFFF << 3) = (int)16rFFFFFFF8 = -8
> + 	 whereas
> + 		(long)(16r1FFFFF << 3) = (long) 16rFFFFFFF8 = 4294967288."
> + 	castToSqint := expr isConstant and: [vmClass isNil or: [vmClass objectMemoryClass wordSize = 8]].
> + 	castToSqint ifTrue:
> + 		[aStream nextPutAll: '(sqInt)'].
> + 	self emitCExpression: expr on: aStream.
> - 
>   	aStream
> - 		nextPutAll: '(('.
> - 	self emitCExpression: msgNode args first on: aStream.
> - 	aStream
>   		nextPutAll: ' << ';
>   		print: vmClass objectMemoryClass numSmallIntegerTagBits;
>   		nextPutAll: ') | 1)'!


More information about the Vm-dev mailing list