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

commits at source.squeak.org commits at source.squeak.org
Sun Nov 21 21:15:56 UTC 2021


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

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

Name: VMMaker.oscog-eem.3106
Author: eem
Time: 21 November 2021, 1:15:47.346356 pm
UUID: 48aa5b30-dd80-47f2-b35d-f998790ac7ab
Ancestors: VMMaker.oscog-eem.3105

Cog simulation:
Make sure the range assert is not generated in boolean surrogate setters.  Nuke the two obsolete setter generators.

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

Item was removed:
- ----- Method: CogBlockMethod class>>setter:bitPosition:bitWidth:type: (in category 'code generation') -----
- setter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
- 	^String streamContents:
- 		[:s| | startByte endByte shift alignedPowerOf2 accessor mask |
- 		startByte := bitPosition // 8.
- 		endByte := bitPosition + bitWidth - 1 // 8.
- 		shift := bitPosition \\ 8.
- 		alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0].
- 		accessor := 'unsigned'
- 					, (#('Byte' 'Short' 'Long' 'Long')
- 							at: endByte - startByte + 1
- 							ifAbsent: ['Long64'])
- 					, 'At: index'.
- 		mask := #(16rFF 16rFFFF 16rFFFFFFFF 16rFFFFFFFF)
- 						at: endByte - startByte + 1
- 						ifAbsent: [(2 raisedTo: 64) - 1].
- 		s nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1.
- 		s crtab: 1; nextPutAll: '| index delta |'; crtab: 1.
- 		s nextPutAll: 'index := address + '.
- 		(self offsetForInstVar: getter) ifNotNil:
- 			[:offsetExpr| s nextPutAll: offsetExpr, ' + '].
- 		s print: startByte + 1; nextPut: $.; crtab: 1.
- 		(typeOrNil notNil or: [alignedPowerOf2]) ifFalse:
- 			[s nextPutAll: 'self assert: (aValue between: 0 and: '; nextPutAll:  ((1 << bitWidth) - 1) hex; nextPutAll: ').'; crtab: 1].
- 		s nextPutAll: '(delta := cogit getCodeToDataDelta) > 0 ifTrue:'; crtab: 2.
- 		s nextPutAll: '[self assert: (cogit addressIsInCodeZone: address - delta).'; crtab: 2; space.
- 		self putAtPut: accessor, ' - delta'
- 			type: typeOrNil
- 			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
- 			shift: shift
- 			on: s
- 			indent: 3.
- 		s nextPutAll: '].'; crtab: 1.
- 		alignedPowerOf2 ifTrue:
- 			[s nextPut: $^].
- 		self putAtPut: accessor
- 			type: typeOrNil
- 			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
- 			shift: shift
- 			on: s
- 			indent: 2.
- 		alignedPowerOf2 ifFalse:
- 			[s nextPut: $.; crtab: 1; nextPutAll: '^aValue']]!

Item was changed:
  ----- Method: CogSurrogate class>>setter:offsetExpression:bitPosition:bitWidth:type: (in category 'code generation') -----
  setter: getter offsetExpression: offsetExpression bitPosition: bitPosition bitWidth: bitWidth type: type
  	^String streamContents:
  		[:s| | startByte endByte shift alignedPowerOf2 accessor mask |
  		startByte := bitPosition // 8.
  		endByte := bitPosition + bitWidth - 1 // 8.
  		shift := bitPosition \\ 8.
  		alignedPowerOf2 := shift = 0 and: [#(8 16 32 64) includes: bitWidth].
  		accessor := (#(byteAt: shortAt: long32At: long64At:) at: (endByte - startByte) highBit + 1),
  					' index'.
  		mask := (2 raisedTo: endByte - startByte + 1 * 8) - 1.
  		s nextPutAll: getter; nextPutAll: ': aValue'; crtab.
  		s crtab; nextPutAll: '| index delta |'; crtab.
  		s nextPutAll: 'index := address'.
  		startByte > 0 ifTrue:
  			[s nextPutAll: ' + '; print: startByte].
  		offsetExpression ifNotNil:
  			[s nextPutAll: ' + '; nextPutAll: offsetExpression].
  		s nextPut: $.; crtab.
+ 		(alignedPowerOf2 or: [type == #Boolean]) ifFalse:
- 		alignedPowerOf2 ifFalse:
  			[s nextPutAll: 'self assert: (aValue between: 0 and: '; nextPutAll:  ((1 << bitWidth) - 1) hex; nextPutAll: ').'; crtab].
  		s nextPutAll: '(delta := cogit getCodeToDataDelta) > 0 ifTrue:'; crtab: 2.
  		s nextPutAll: '[self assert: (cogit addressIsInCodeZone: address - delta).'; crtab: 2; space.
  		self putAtPut: accessor, ' - delta'
  			type: type
  			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
  			shift: shift
  			on: s
  			indent: 3.
  		s nextPutAll: '].'; crtab.
  		alignedPowerOf2 ifTrue:
  			[s nextPut: $^].
  		self putAtPut: accessor
  			type: type
  			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
  			shift: shift
  			on: s
  			indent: 2.
  		alignedPowerOf2 ifFalse:
  			[s nextPut: $.; crtab; nextPutAll: '^aValue']]!

Item was removed:
- ----- Method: VMStructType class>>setter:bitPosition:bitWidth:type: (in category 'code generation') -----
- setter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
- 	self shouldNotImplement. "should be under CogSurrogate class"
- 	^String streamContents:
- 		[:s| | startByte endByte shift indexExpr accessor alignedPowerOf2 mask |
- 		startByte := bitPosition // 8.
- 		endByte := bitPosition + bitWidth - 1 // 8.
- 		shift := bitPosition \\ 8.
- 		s nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1.
- 		indexExpr := 'address + ',
- 						((self offsetForInstVar: getter) ifNotNil: [:offsetExpr| offsetExpr, ' + '] ifNil: ['']),
- 						(startByte + 1) printString.
- 		accessor := 'unsigned'
- 					, (#('Byte' 'Short' 'Long' 'Long')
- 							at: endByte - startByte + 1
- 							ifAbsent: ['Long64'])
- 					, 'At: '.
- 		(alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0])
- 			ifTrue: "index used once; no point using a temp to hold it"
- 				[accessor := accessor, indexExpr]
- 			ifFalse: "index used twice; cache it"
- 				[s nextPutAll: '| index |'; crtab: 1; nextPutAll: 'index := '; nextPutAll: indexExpr; nextPut: $.; crtab: 1.
- 				 accessor := accessor, 'index'].
- 		mask := #(16rFF 16rFFFF 16rFFFFFFFF 16rFFFFFFFF)
- 						at: endByte - startByte + 1
- 						ifAbsent: [(2 raisedTo: 64) - 1].
- 		(typeOrNil notNil or: [alignedPowerOf2]) ifFalse:
- 			[s nextPutAll: 'self assert: (aValue between: 0 and: '; nextPutAll:  ((1 << bitWidth) - 1) hex; nextPutAll: ').'; crtab: 1].
- 		alignedPowerOf2 ifTrue:
- 			[s nextPut: $^].
- 		self putAtPut: accessor
- 			type: typeOrNil
- 			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
- 			shift: shift
- 			on: s
- 			indent: 2.
- 		alignedPowerOf2 ifFalse:
- 			[s nextPut: $.; crtab: 1; nextPutAll: '^aValue']]!



More information about the Vm-dev mailing list