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

commits at source.squeak.org commits at source.squeak.org
Tue Jul 1 15:33:30 UTC 2014


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.791.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.791
Author: eem
Time: 1 July 2014, 8:30:55.624 am
UUID: 7d762755-99b7-46ae-8435-31b17f4f0e0c
Ancestors: VMMaker.oscog-eem.790

Rescue the non-Spur builds by making
accessorDepthForPrimitiveIndex: a Spur option.

Factor out the type machinery in generateShiftRight:on:indent:
and use it to ensure generateSignedBitShift:on:indent: will not
cast 64-bit vars to ints.

=============== Diff against VMMaker.oscog-eem.790 ===============

Item was changed:
  ----- Method: CCodeGenerator>>generateShiftRight:on:indent: (in category 'C translation') -----
  generateShiftRight: msgNode on: aStream indent: level
  	"Generate the C code for this message onto the given stream."
  
+ 	| type |
- 	| decl |
  	"If the variable is a 64-bit type then don't cast it to usqInt (typically a 32-bit type)"
+ 	(self is64BitIntegralVariable: msgNode receiver typeInto: [:t| type := t])
- 	(msgNode receiver isVariable
- 	 and: [(decl := self typeOfVariable: msgNode receiver name) notNil
- 	 and: [#('usqLong' 'sqLong' 'unsigned long long' 'long long' 'unsigned __int64' '__int64')
- 			anySatisfy: [:type| decl beginsWith: type]]])
  		ifTrue:
  			["If not unsigned cast it to unsigned."
+ 			 type first ~= $u ifTrue:
+ 				[aStream nextPutAll: '((unsigned '; nextPutAll: type; nextPut: $)].
- 			 (decl first = $u) ifFalse:
- 				[aStream
- 					nextPutAll: '((unsigned ';
- 					nextPutAll: ((decl endsWith: msgNode receiver name)
- 									ifTrue: [decl allButLast: msgNode receiver name size]
- 									ifFalse: [decl]);
- 					nextPut: $)].
  			 self emitCExpression: msgNode receiver on: aStream.
+ 			 type first ~= $u ifTrue:
- 			 (decl first = $u) ifFalse:
  				[aStream nextPut: $)]]
  		ifFalse:
  			[aStream nextPutAll: '((usqInt) '.
  			 self emitCExpression: msgNode receiver on: aStream.
  			 aStream nextPut: $)].
  	aStream nextPutAll: ' >> '.
  	self emitCExpression: msgNode args first on: aStream!

Item was changed:
  ----- Method: CCodeGenerator>>generateSignedBitShift:on:indent: (in category 'C translation') -----
  generateSignedBitShift: msgNode on: aStream indent: level
  	"Generate the C code for this message onto the given stream."
  
+ 	| cast type arg |
+ 	"since ``signed'' is a synonym for ``signed int'' do not cast 64-bit values to signed if at all possible."
+ 	cast := (self is64BitIntegralVariable: msgNode receiver typeInto: [:t| type := t])
+ 				ifTrue: ['(', (type first = $u ifTrue: [type allButFirst: (type second = $n ifTrue: [2] ifFalse: [1])] ifFalse: [type]), ')']
+ 				ifFalse: ['(signed)'].
- 	| arg |
  	(arg := msgNode args first) isConstant
  		ifTrue: "bit shift amount is a constant"
+ 			[aStream nextPut: $(; nextPutAll: cast.
- 			[aStream nextPut: $(; nextPutAll: '(signed)'.
  			self emitCExpression: msgNode receiver on: aStream.
  			arg value < 0
+ 				ifTrue: [aStream nextPutAll: ' >> '; print: arg value negated]
+ 				ifFalse: [aStream nextPutAll: ' << '; print: arg value].
- 				ifTrue: [aStream nextPutAll: ' >> ', arg value negated printString]
- 				ifFalse: [aStream nextPutAll: ' << ', arg value printString].
  			aStream nextPut: $)]
  		ifFalse: "bit shift amount is an expression"
  			[aStream nextPutAll: '(('.
  			self emitCExpression: arg on: aStream.
+ 			aStream nextPutAll: ' < 0) ? ('; nextPutAll: cast.
- 			aStream nextPutAll: ' < 0) ? ('; nextPutAll: '(signed)'.
  			self emitCExpression: msgNode receiver on: aStream.
  			aStream nextPutAll: ' >> -'.
  			self emitCExpression: arg on: aStream.
+ 			aStream nextPutAll: ') : ('; nextPutAll: cast.
- 			aStream nextPutAll: ') : ('; nextPutAll: '(signed)'.
  			self emitCExpression: msgNode receiver on: aStream.
  			aStream nextPutAll: ' << '.
  			self emitCExpression: arg on: aStream.
  			aStream nextPutAll: '))']!

Item was added:
+ ----- Method: CCodeGenerator>>is64BitIntegralVariable:typeInto: (in category 'C translation') -----
+ is64BitIntegralVariable: node typeInto: aBlock
+ 	| decl |
+ 	^node isVariable
+ 	  and: [(decl := self typeOfVariable: node name) notNil
+ 	  and: [(#('usqLong' 'sqLong' 'unsigned long long' 'long long' 'unsigned __int64' '__int64')
+ 			anySatisfy: [:type| decl beginsWith: type])
+ 	  and: [aBlock value: ((decl endsWith: node name)
+ 							ifTrue: [decl allButLast: node name size + 1]
+ 							ifFalse: [decl]).
+ 			true]]]!

Item was changed:
  ----- Method: CoInterpreter>>accessorDepthForPrimitiveIndex: (in category 'cog jit support') -----
  accessorDepthForPrimitiveIndex: primIndex
  	<api>
+ 	<option: #SpurObjectMemory>
  	^primitiveAccessorDepthTable at: primIndex!



More information about the Vm-dev mailing list