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

commits at source.squeak.org commits at source.squeak.org
Tue Nov 29 16:56:51 UTC 2016

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.2009
Author: eem
Time: 29 November 2016, 8:55:28.07135 am
UUID: c9c58171-fdba-44a6-82ad-292292746622
Ancestors: VMMaker.oscog-eem.2008

Fix liveRegisters to scan entire stack, not just from spillBase.
Add intelligence to genStorePop:TemporaryVariable: to avoid writing through a register.

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

Item was changed:
  ----- Method: RegisterAllocatingCogit>>genStorePop:TemporaryVariable: (in category 'bytecode generator support') -----
  genStorePop: popBoolean TemporaryVariable: tempIndex
  	<inline: false>
+ 	| srcRegOrNone destReg |
- 	| reg |
  	self ssFlushUpThroughTemporaryVariable: tempIndex.
+ 	"To avoid a stall writing through destReg, remember srcReg before the potential ssPop: 1 in ssStorePop:toReg:"
+ 	srcRegOrNone := self ssTop registerOrNone.
  	"ssStorePop:toPreferredReg: will allocate a register, and indeed may allocate ReceiverResultReg
  	 if, for example, the ssEntry to be popped is already in ReceiverResultReg (as the result of a send).
  	 ReceiverResultReg is not a good choice for a temporary variable; it has other uses.  So if the ssEntry
  	 at top of stack has ReceiverResultReg as its live variable, try and allocate an alternative."
  	((self ssTop registerMaskOrNone anyMask: self registerMaskUndesirableForTempVars)
+ 	 and: [(destReg := self availableRegOrNoneNotConflictingWith: (self registerMaskUndesirableForTempVars bitOr: self liveRegisters)) ~= NoReg])
+ 		ifTrue: [self ssStorePop: popBoolean toReg: destReg]
+ 		ifFalse: [destReg := self ssStorePop: popBoolean toPreferredReg: TempReg].
+ 	self MoveR: (srcRegOrNone ~= NoReg ifTrue: [srcRegOrNone] ifFalse: [destReg])
- 	 and: [(reg := self availableRegOrNoneNotConflictingWith:  self registerMaskUndesirableForTempVars) ~= NoReg])
- 		ifTrue: [self ssStorePop: popBoolean toReg: reg]
- 		ifFalse: [reg := self ssStorePop: popBoolean toPreferredReg: TempReg].
- 	self MoveR: reg
  		Mw: (self frameOffsetOfTemporary: tempIndex)
  		r: FPReg.
+ 	destReg ~= TempReg ifTrue:
+ 		[(self simStackAt: tempIndex) liveRegister: destReg.
- 	reg ~= TempReg ifTrue:
- 		[(self simStackAt: tempIndex) liveRegister: reg.
  		 self copyLiveRegisterToCopiesOf: (self simStackAt: tempIndex)].

Item was added:
+ ----- Method: RegisterAllocatingCogit>>liveRegisters (in category 'simulation stack') -----
+ liveRegisters
+ 	| regsSet |
+ 	regsSet := 0.
+ 	0 to: simStackPtr do:
+ 		[:i|
+ 		regsSet := regsSet bitOr: (self simStackAt: i) registerMask].
+ 	LowcodeVM ifTrue:
+ 		[(simNativeSpillBase max: 0) to: simNativeStackPtr do:
+ 			[:i|
+ 			regsSet := regsSet bitOr: (self simNativeStackAt: i) nativeRegisterMask]].
+ 	^regsSet!

More information about the Vm-dev mailing list