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

commits at source.squeak.org commits at source.squeak.org
Fri Mar 17 00:47:06 UTC 2017


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

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

Name: VMMaker.oscog-eem.2160
Author: eem
Time: 16 March 2017, 5:44:00.13863 pm
UUID: 9fcce340-c6a2-4c79-b7f9-dda8ed959b81
Ancestors: VMMaker.oscog-eem.2159

SpurCogit:
Fix the slip in creating the Spur ceNewHash trampoline, hence making the machine code identityHash primitive non-failing.  Add a different trampoline for Sista inline prim identityHash that saves all registers.  Refactor genNewHashTrampoline to genNewHashTrampoline:called:.

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

Item was changed:
  ----- Method: CogObjectRepresentationFor32BitSpur>>genPrimitiveIdentityHash (in category 'primitive generators') -----
  genPrimitiveIdentityHash
  	"Arguably we should fail for immediates, but so far no one has complained, so..."
  	| jumpImm jumpSI jumpNotSet ret |
  	<var: #jumpSI type: #'AbstractInstruction *'>
  	<var: #jumpImm type: #'AbstractInstruction *'>
  	<var: #jumpNotSet type: #'AbstractInstruction *'>
  	jumpImm := self genJumpImmediate: ReceiverResultReg.
  	self genGetHashFieldNonImmOf: ReceiverResultReg asSmallIntegerInto: TempReg.
  	cogit CmpCq: ConstZero R: TempReg.
  	jumpNotSet := cogit JumpZero: 0.
  	cogit MoveR: TempReg R: ReceiverResultReg.
  	ret := cogit genPrimReturn.
  	jumpImm jmpTarget: cogit Label.
  	jumpSI := self genJumpSmallInteger: ReceiverResultReg.
  	jumpSI jmpTarget: ret.
  	self genConvertCharacterToSmallIntegerInReg: ReceiverResultReg.
  	cogit Jump: ret.
  	jumpNotSet jmpTarget: cogit Label.
+ 	cogit
+ 		CallRT: ceNewHashTrampoline;
+ 		genPrimReturn.
+ 	^UnfailingPrimitive!
- 	^0!

Item was changed:
  ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveIdentityHash (in category 'primitive generators') -----
  genPrimitiveIdentityHash
  	"Arguably we should fail for immediates, but so far no one has complained, so..."
  	| jumpImm jumpNotSet jumpNotCharacter ret |
  	<var: #jumpImm type: #'AbstractInstruction *'>
  	<var: #jumpNotSet type: #'AbstractInstruction *'>
  	<var: #jumpNotCharacter type: #'AbstractInstruction *'>
  	jumpImm := self genJumpImmediate: ReceiverResultReg. "uses TstCqR"
  	self genGetHashFieldNonImmOf: ReceiverResultReg asSmallIntegerInto: TempReg.
  	cogit CmpCq: ConstZero R: TempReg.
  	jumpNotSet := cogit JumpZero: 0.
  	cogit MoveR: TempReg R: ReceiverResultReg.
  	ret := cogit genPrimReturn.
  	jumpImm jmpTarget: (cogit AndCq: objectMemory tagMask R: ReceiverResultReg R: TempReg).
  	cogit CmpCq: objectMemory characterTag R: TempReg.
  	jumpNotCharacter := cogit JumpNonZero: 0.
  	self genConvertCharacterToSmallIntegerInReg: ReceiverResultReg.
  	ret := cogit genPrimReturn.
  	jumpNotCharacter jmpTarget: (cogit CmpCq: objectMemory smallFloatTag R: TempReg).
  	cogit JumpNonZero: ret.
  	self genConvertSmallFloatToSmallFloatHashAsIntegerInReg: ReceiverResultReg scratch: TempReg.
  	cogit genPrimReturn.
  	jumpNotSet jmpTarget: cogit Label.
+ 	cogit
+ 		CallRT: ceNewHashTrampoline;
+ 		genPrimReturn.
+ 	^UnfailingPrimitive!
- 	^0!

Item was changed:
  CogObjectRepresentation subclass: #CogObjectRepresentationForSpur
+ 	instanceVariableNames: 'ceScheduleScavengeTrampoline ceSmallActiveContextInMethodTrampoline ceSmallActiveContextInBlockTrampoline ceSmallActiveContextInFullBlockTrampoline ceLargeActiveContextInMethodTrampoline ceLargeActiveContextInBlockTrampoline ceLargeActiveContextInFullBlockTrampoline ceStoreCheckContextReceiverTrampoline ceStoreTrampolines ceNewHashTrampoline ceInlineNewHashTrampoline'
- 	instanceVariableNames: 'ceScheduleScavengeTrampoline ceSmallActiveContextInMethodTrampoline ceSmallActiveContextInBlockTrampoline ceSmallActiveContextInFullBlockTrampoline ceLargeActiveContextInMethodTrampoline ceLargeActiveContextInBlockTrampoline ceLargeActiveContextInFullBlockTrampoline ceStoreCheckContextReceiverTrampoline ceStoreTrampolines ceNewHashTrampoline'
  	classVariableNames: 'CheckRememberedInTrampoline NumStoreTrampolines'
  	poolDictionaries: 'VMBytecodeConstants VMSqueakClassIndices'
  	category: 'VMMaker-JIT'!

Item was changed:
  ----- Method: CogObjectRepresentationForSpur class>>numTrampolines (in category 'accessing') -----
  numTrampolines
  	^super numTrampolines
  	 + (SistaV1BytecodeSet
+ 		ifTrue: [9] "(small,large)x(method,block,fullBlock) context creation,
+ 					 ceNewHashTrampoline, ceStoreCheckContextReceiverTrampoline and ceScheduleScavengeTrampoline"
+ 		ifFalse: [7] "(small,large)x(method,block) context creation, 
+ 					 ceNewHashTrampoline, ceStoreCheckContextReceiverTrampoline and ceScheduleScavengeTrampoline")
- 		ifTrue: [8] "(small,large)x(method,block,fullBlock) context creation,
- 					 ceStoreCheckContextReceiverTrampoline and ceScheduleScavengeTrampoline"
- 		ifFalse: [6] "(small,large)x(method,block) context creation, 
- 					 ceStoreCheckContextReceiverTrampoline and ceScheduleScavengeTrampoline")
  	 + ((initializationOptions at: #IMMUTABILITY ifAbsent: [false])
  		ifTrue: [NumStoreTrampolines]
  		ifFalse: [0])
  	 + ((initializationOptions at: #SistaVM ifAbsent: [false])
+ 		ifTrue: [1] "inline newHash"
- 		ifTrue: [1] "newHash"
  		ifFalse: [0])!

Item was changed:
  ----- Method: CogObjectRepresentationForSpur>>genGetIdentityHash:resultReg: (in category 'sista support') -----
  genGetIdentityHash: rcvrReg resultReg: resultReg
  	<var: #jumpSet type: #'AbstractInstruction *'>
  	| jumpSet |
  	"ReceiverResultReg is required for the trampoline. We force the allocation,
  	 and we have two path to avoid conflicts in ReceiverResultReg."
  	cogit voidReceiverResultRegContainsSelf. 
  	resultReg = ReceiverResultReg 
  		ifTrue: 
  			[cogit ssTop popToReg: rcvrReg.
  			 self genGetHashFieldNonImmOf: rcvrReg asSmallIntegerInto: resultReg.
  			 cogit CmpCq: ConstZero R: resultReg.
  			 jumpSet := cogit JumpNonZero: 0.
  			 cogit MoveR: rcvrReg R: resultReg.
+ 			 cogit CallRT: ceInlineNewHashTrampoline.
- 			 cogit CallRT: ceNewHashTrampoline.
  			 cogit annotateBytecode: cogit Label]
  		ifFalse: 
  			[cogit ssTop popToReg: ReceiverResultReg.
  		 	 self genGetHashFieldNonImmOf: ReceiverResultReg asSmallIntegerInto: resultReg.
  			 cogit CmpCq: ConstZero R: resultReg.
  			 jumpSet := cogit JumpNonZero: 0.
+ 			 cogit CallRT: ceInlineNewHashTrampoline.
- 			 cogit CallRT: ceNewHashTrampoline.
  			 cogit annotateBytecode: (cogit MoveR: ReceiverResultReg R: resultReg)].
+ 	jumpSet jmpTarget: cogit Label!
- 	jumpSet jmpTarget: cogit Label.!

Item was removed:
- ----- Method: CogObjectRepresentationForSpur>>genNewHashTrampoline (in category 'initialization') -----
- genNewHashTrampoline
- 	"In non sista VM this is used only from the identityHash primitive, hence only the result of the trampoline, the hash, should be in ReceiverResultReg, other registers can just be ignored.
- 	In the sista VM, the inlined hash operation requires registers to be saved"
- 	<inline: true>
- 	<option: #SistaVM>
- 	^ cogit
- 		genTrampolineFor: #ceNewHashOf:
- 		called: 'newHashTrampoline'
- 		numArgs: 1
- 		arg: ReceiverResultReg
- 		arg: nil
- 		arg: nil
- 		arg: nil
- 		regsToSave: (CallerSavedRegisterMask bitClear: (cogit registerMaskFor: ReceiverResultReg))
- 		pushLinkReg: true
- 		resultReg: ReceiverResultReg
- 		appendOpcodes: true!

Item was added:
+ ----- Method: CogObjectRepresentationForSpur>>genNewHashTrampoline:called: (in category 'initialization') -----
+ genNewHashTrampoline: saveRegs called: name
+ 	"In non sista VM this is used only from the identityHash primitive, hence only the result of the trampoline, the hash, should be in ReceiverResultReg, other registers can just be ignored.
+ 	In the sista VM, the inlined hash operation requires registers to be saved"
+ 	<inline: true>
+ 	^cogit
+ 		genTrampolineFor: #ceNewHashOf:
+ 		called: name
+ 		numArgs: 1
+ 		arg: ReceiverResultReg
+ 		arg: nil
+ 		arg: nil
+ 		arg: nil
+ 		regsToSave: (saveRegs
+ 						ifTrue: [CallerSavedRegisterMask bitClear: (cogit registerMaskFor: ReceiverResultReg)]
+ 						ifFalse: [cogit emptyRegisterMask])
+ 		pushLinkReg: true
+ 		resultReg: ReceiverResultReg
+ 		appendOpcodes: false!

Item was changed:
  ----- Method: CogObjectRepresentationForSpur>>generateObjectRepresentationTrampolines (in category 'initialization') -----
  generateObjectRepresentationTrampolines
  	"Do the store check.  Answer the argument for the benefit of the code generator;
  	 ReceiverResultReg may be caller-saved and hence smashed by this call.  Answering
  	 it allows the code generator to reload ReceiverResultReg cheaply.
  	 In Spur the only thing we leave to the run-time is adding the receiver to the
  	 remembered set and setting its isRemembered bit."
  	self 
  		cppIf: IMMUTABILITY
  		ifTrue: 
  			[self cCode: [] inSmalltalk:
  				[ceStoreTrampolines := CArrayAccessor on: (Array new: NumStoreTrampolines)].
  			 0 to: NumStoreTrampolines - 1 do:
  				[:instVarIndex |
  				 ceStoreTrampolines
  					at: instVarIndex
  					put: (self 
  							genStoreTrampolineCalled: (cogit 
  															trampolineName: 'ceStoreTrampoline' 
  															numArgs: instVarIndex 
  															limit: NumStoreTrampolines - 2) 
  							instVarIndex: instVarIndex)]].
+ 	ceNewHashTrampoline := self genNewHashTrampoline: false called: 'ceNewHash'.
+ 	SistaVM ifTrue: [ceInlineNewHashTrampoline := self genNewHashTrampoline: true  called: 'ceInlineNewHash'].
- 	SistaVM ifTrue: [ceNewHashTrampoline := self genNewHashTrampoline].
  	ceStoreCheckTrampoline := self genStoreCheckTrampoline.
  	ceStoreCheckContextReceiverTrampoline := self genStoreCheckContextReceiverTrampoline.
  	ceScheduleScavengeTrampoline := cogit
  											genTrampolineFor: #ceScheduleScavenge
  											called: 'ceScheduleScavengeTrampoline'
  											regsToSave: CallerSavedRegisterMask.
  	ceSmallActiveContextInMethodTrampoline := self genActiveContextTrampolineLarge: false inBlock: 0 called: 'ceSmallMethodContext'.
  	ceSmallActiveContextInBlockTrampoline := self genActiveContextTrampolineLarge: false inBlock: InVanillaBlock called: 'ceSmallBlockContext'.
  	SistaV1BytecodeSet ifTrue:
  		[ceSmallActiveContextInFullBlockTrampoline := self genActiveContextTrampolineLarge: false inBlock: InFullBlock called: 'ceSmallFullBlockContext'].
  	ceLargeActiveContextInMethodTrampoline := self genActiveContextTrampolineLarge: true inBlock: 0 called: 'ceLargeMethodContext'.
  	ceLargeActiveContextInBlockTrampoline := self genActiveContextTrampolineLarge: true inBlock: InVanillaBlock called: 'ceLargeBlockContext'.
  	SistaV1BytecodeSet ifTrue:
  		[ceLargeActiveContextInFullBlockTrampoline := self genActiveContextTrampolineLarge: true inBlock: InFullBlock called: 'ceLargeFullBlockContext'].
  		
  	LowcodeVM ifTrue: [ self generateLowcodeObjectTrampolines ]!



More information about the Vm-dev mailing list