[Vm-dev] VM Maker: VMMaker.oscog-cb.1396.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 29 11:31:29 UTC 2015


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

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

Name: VMMaker.oscog-cb.1396
Author: cb
Time: 29 June 2015, 1:29:37.265 pm
UUID: ec6d1c5e-1867-428f-9163-9f54422ce6f9
Ancestors: VMMaker.oscog-cb.1395

fixed trinaryInlined primitive which was forcing a reg to be ReceiverResult reg when it shouldn't.

...

=============== Diff against VMMaker.oscog-cb.1394 ===============

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genTrinaryInlinePrimitive: (in category 'inline primitive generators') -----
  genTrinaryInlinePrimitive: prim
  	"Unary inline primitives."
  	"SistaV1: 248		11111000 	iiiiiiii		mjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
  	 See EncoderForSistaV1's class comment and StackInterpreter>>#trinaryInlinePrimitive:"
  
  	| ra1 ra2 rr adjust needsStoreCheck |
  	"The store check requires rr to be ReceiverResultReg"
+ 	needsStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
  	self 
  		allocateRegForStackTopThreeEntriesInto: [:rTop :rNext :rThird | ra2 := rTop. ra1 := rNext. rr := rThird ] 
+ 		thirdIsReceiver: (prim = 0 and: [ needsStoreCheck ]).
- 		thirdIsReceiver: prim = 0.
  	self assert: (rr ~= ra1 and: [rr ~= ra2 and: [ra1 ~= ra2]]).
- 	needsStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
  	self ssTop popToReg: ra2.
  	self ssPop: 1.
  	self ssTop popToReg: ra1.
  	self ssPop: 1.
  	self ssTop popToReg: rr.
  	self ssPop: 1.
  	objectRepresentation genConvertSmallIntegerToIntegerInReg: ra1.
  	"Now: ra is the variable object, rr is long, TempReg holds the value to store."
  	prim caseOf: {
  		"0 - 1 pointerAt:put: and byteAt:Put:"
  		[0] ->	[ adjust := (objectMemory baseHeaderSize >> objectMemory shiftForWord) - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
  				adjust ~= 0 ifTrue: [ self AddCq: adjust R: ra1. ]. 
  				self MoveR: ra2 Xwr: ra1 R: rr.
  				"I added needsStoreCheck so if you initialize an array with a Smi such as 0 or a boolean you don't need the store check"
  				needsStoreCheck ifTrue: 
  					[ self assert: needsFrame. 
  					objectRepresentation genStoreCheckReceiverReg: rr valueReg: ra2 scratchReg: TempReg inFrame: true] ].
  		[1] ->	[ objectRepresentation genConvertSmallIntegerToIntegerInReg: ra2.
  				adjust := objectMemory baseHeaderSize - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
  				self AddCq: adjust R: ra1.
  				self MoveR: ra2 Xbr: ra1 R: rr.
  				objectRepresentation genConvertIntegerToSmallIntegerInReg: ra2. ]
  	}
  	otherwise: [^EncounteredUnknownBytecode].
  	self ssPushRegister: ra2.
  	^0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>ssFlushUpThrough: (in category 'simulation stack') -----
+ ssFlushUpThrough: unaryBlock
+ 	"Any occurrences on the stack of the value being stored (which is the top of stack)
+ 	 must be flushed, and hence any values colder than them stack."
+ 	<inline: true>
+ 	simStackPtr - 1 to: (simSpillBase max: 0) by: -1 do:
+ 		[ :index |
+ 		(unaryBlock value: (self simStackAt: index)) ifTrue: [ ^ self ssFlushTo: index ] ]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssFlushUpThroughReceiverVariable: (in category 'simulation stack') -----
  ssFlushUpThroughReceiverVariable: slotIndex
  	"Any occurrences on the stack of the value being stored (which is the top of stack)
  	 must be flushed, and hence any values colder than them stack."
  	<var: #desc type: #'CogSimStackEntry *'>
+ 	self ssFlushUpThrough: 
+ 		[ :desc |  
+ 			desc type = SSBaseOffset
+ 			 and: [desc register = ReceiverResultReg
+ 			 and: [desc offset = (objectRepresentation slotOffsetOfInstVarIndex: slotIndex) ] ] ]!
- 	simStackPtr - 1 to: (simSpillBase max: 0) by: -1 do:
- 		[:index| | desc |
- 		desc := self simStackAt: index.
- 		(desc type = SSBaseOffset
- 		 and: [desc register = ReceiverResultReg
- 		 and: [desc offset = (objectRepresentation slotOffsetOfInstVarIndex: slotIndex)]]) ifTrue:
- 			[self ssFlushTo: index.
- 			 ^self]]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssFlushUpThroughRegister: (in category 'simulation stack') -----
  ssFlushUpThroughRegister: reg
  	"Any occurrences on the stack of the register must be
  	 flushed, and hence any values colder than them stack."
  	<var: #desc type: #'CogSimStackEntry *'>
+ 	self ssFlushUpThrough: [ :desc | desc type = SSRegister and: [ desc register = reg ] ]!
- 	simStackPtr - 1 to: (simSpillBase max: 0) by: -1 do:
- 		[:index| | desc |
- 		desc := self simStackAt: index.
- 		(desc type = SSRegister
- 		 and: [desc register = reg]) ifTrue:
- 			[self ssFlushTo: index.
- 			 ^self]]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssFlushUpThroughTemporaryVariable: (in category 'simulation stack') -----
  ssFlushUpThroughTemporaryVariable: tempIndex
  	"Any occurrences on the stack of the value being stored (which is the top of stack)
  	 must be flushed, and hence any values colder than them stack."
  	<var: #desc type: #'CogSimStackEntry *'>
+ 	self ssFlushUpThrough: 
+ 		[ :desc |
+ 			desc type = SSBaseOffset
+ 		 	and: [desc register = FPReg
+ 		 	and: [desc offset = (self frameOffsetOfTemporary: tempIndex) ] ] ]!
- 	simStackPtr - 1 to: simSpillBase by: -1 do:
- 		[:index| | desc |
- 		desc := self simStackAt: index.
- 		(desc type = SSBaseOffset
- 		 and: [desc register = FPReg
- 		 and: [desc offset = (self frameOffsetOfTemporary: tempIndex)]]) ifTrue:
- 			[self ssFlushTo: index.
- 			 ^self]]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssPushAnnotatedConstant: (in category 'simulation stack') -----
  ssPushAnnotatedConstant: literal
  	self ssPush: 1.
+ 	self updateSimSpillBase.
- 	simSpillBase > simStackPtr ifTrue:
- 		[simSpillBase := simStackPtr max: 0].
  	self ssTop
  		type: SSConstant;
  		annotateUse: true;
  		spilled: false;
  		constant: literal;
  		bcptr: bytecodePC.
  	^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssPushBase:offset: (in category 'simulation stack') -----
  ssPushBase: reg offset: offset
  	self ssPush: 1.
+ 	self updateSimSpillBase.
- 	simSpillBase > simStackPtr ifTrue:
- 		[simSpillBase := simStackPtr max: 0].
  	self ssTop
  		type: SSBaseOffset;
  		spilled: false;
  		annotateUse: false;
  		register: reg;
  		offset: offset;
  		bcptr: bytecodePC.
  	^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssPushConstant: (in category 'simulation stack') -----
  ssPushConstant: literal
  	self ssPush: 1.
+ 	self updateSimSpillBase.
- 	simSpillBase > simStackPtr ifTrue:
- 		[simSpillBase := simStackPtr max: 0].
  	self ssTop
  		type: SSConstant;
  		spilled: false;
  		annotateUse: false;
  		constant: literal;
  		bcptr: bytecodePC.
  	^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssPushDesc: (in category 'simulation stack') -----
  ssPushDesc: simStackEntry
  	<var: #simStackEntry type: #CogSimStackEntry>
  	self cCode:
  			[simStackEntry type = SSSpill ifTrue:
  				[simStackEntry type: SSBaseOffset].
  			simStackEntry
  				spilled: false;
  				annotateUse: false;
  				bcptr: bytecodePC.
  			 simStack
  				at: (simStackPtr := simStackPtr + 1)
  				put: simStackEntry]
  		inSmalltalk:
  			[(simStack at: (simStackPtr := simStackPtr + 1))
  				copyFrom: simStackEntry;
  				type: (simStackEntry type = SSSpill
  						ifTrue: [SSBaseOffset]
  						ifFalse: [simStackEntry type]);
  				spilled: false;
  				annotateUse: false;
  				bcptr: bytecodePC].
+ 	self updateSimSpillBase.
- 	simSpillBase > simStackPtr ifTrue:
- 		[simSpillBase := simStackPtr max: 0].
  	^0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>ssPushRegister: (in category 'simulation stack') -----
  ssPushRegister: reg
  	self ssPush: 1.
+ 	self updateSimSpillBase.
- 	simSpillBase > simStackPtr ifTrue:
- 		[simSpillBase := simStackPtr max: 0].
  	self ssTop
  		type: SSRegister;
  		spilled: false;
  		annotateUse: false;
  		register: reg;
  		bcptr: bytecodePC.
  	^0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>updateSimSpillBase (in category 'simulation stack') -----
+ updateSimSpillBase
+ 	simSpillBase > simStackPtr ifTrue:
+ 		[simSpillBase := simStackPtr max: 0].!



More information about the Vm-dev mailing list