[Vm-dev] VM Maker: Cog-tpr.247.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 18 22:58:03 UTC 2015


tim Rowledge uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-tpr.247.mcz

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

Name: Cog-tpr.247
Author: tpr
Time: 18 March 2015, 3:57:54.046 pm
UUID: 492e59a2-5fdb-4dde-94f4-918a30f2565b
Ancestors: Cog-eem.244

Make sure old version of decorating is at least up to date in case we want it some day, improve new version to work for intermediate parts of a load-long-const sequence

=============== Diff against Cog-eem.244 ===============

Item was changed:
  ----- Method: GdbARMAlien>>decorateDisassembly:for: (in category 'disassembly') -----
  decorateDisassembly: anInstructionString for: aSymbolManager
  	| parts strm hexNum string |
  
  	"break up the string"
  	parts:= anInstructionString subStrings: '	 ,:'.
  	"part 1 is the address, part 2 is the instruction. Last part is sometimes a hex number"
  	
  	"is this a mov of a literal number?"
  	((parts at: 2) includesSubString: 'mov')
  		ifTrue:[ 
  			"clear the flags & running total"
  			LongConstReg := nil.
  			LongConstValue := 0.
  			LongConstStep := 0.
  			(parts at:4) first = $#
  				ifTrue:["looks a good candidate"
  					LongConstReg :=(parts at: 3). "the target register"
  					(parts last beginsWith: '0x') ifTrue:[
  						LongConstValue :=(NumberParser on: (parts last allButFirst:2)) nextUnsignedIntegerBase: 16].
  					LongConstStep := 1].
  			"not a likely candidate, just return the string"			
  			^anInstructionString].
  	
  	"is this a build of a literal number?"
  	(((parts at: 2) includesSubString: 'orr') and:[LongConstStep >0])
  		ifTrue:["add to running total if the register matches"
  			LongConstReg = (parts at: 3) 
  				ifTrue:[
  					(parts at:5) first = $#
+ 						ifTrue:["looks a good candidate with the # indicating a const - due to disassembler idiocy we have to check for both hex
+ 							and dec values. "
+ 							(parts last beginsWith: '0x') 
+ 								ifTrue:[ LongConstValue :=  LongConstValue +((NumberParser on: (parts last allButFirst:2)) nextUnsignedIntegerBase: 16)]
+ 								ifFalse:[ LongConstValue := LongConstValue + ((NumberParser on: (parts at:5) allButFirst) nextUnsignedIntegerBase: 10) ].
- 						ifTrue:["looks a good candidate"
- 							(parts last beginsWith: '0x') ifTrue:[
- 								LongConstValue := LongConstValue + ((NumberParser on: (parts last allButFirst:2)) nextUnsignedIntegerBase: 16) ].
  							LongConstStep:= LongConstStep +1].
  					LongConstStep = 4
  						ifTrue:["we've completed a pattern of mov/orr/orr/orr, so print the value it built" 
  							^anInstructionString, ' (', LongConstReg , ' = ', LongConstValue hex8, ((aSymbolManager lookupAddress: LongConstValue) ifNil: [''] ifNotNil:[:val| ' = ', val]), ')']]
  				ifFalse:[ LongConstStep := 0.
  						LongConstReg := nil.
  						LongConstValue := 0].
  			"either not a likely candidate orpartway through the pattern, so just return the string"			
  			^anInstructionString].
  	
  
  	strm :=anInstructionString readStream.
  	strm skip: 9. "the instruction address"
  	
  	strm upToAll: '0x'. "see if there is a hex number"
  	strm atEnd ifTrue:[^anInstructionString]. "if not, leave it be"
  
  	"extract the number"		
  	hexNum := (NumberParser on: strm) nextUnsignedIntegerBase: 16.
  	"is there an intersting address with this?"
  	(string := aSymbolManager lookupAddress: hexNum) ifNil: [^anInstructionString].
  	^ anInstructionString, ' = ', string!

Item was changed:
  ----- Method: GdbARMAlien>>decorateDisassembly:for:fromAddress: (in category 'disassembly') -----
  decorateDisassembly: anInstructionString for: aSymbolManager fromAddress: address
+ 	| word opcode rotate mode operand |
- 	| word opcode shift mode operand |
  	word := aSymbolManager objectMemory longAt: address.
  	(self instructionIsAnyB: word)
  		ifTrue:
  			[operand := word bitAnd: 16rFFFFFF.
  			 (operand anyMask: 16r800000) ifTrue:
  				[operand := operand - 16r1000000].
  			 operand := operand * 4 + address + 8]
  		ifFalse:
+ 			[opcode := word >> 21 bitAnd: 16rF.
- 			[shift := word >> 7 bitAnd: 16r1F.
- 			 mode := word >> 25 bitAnd: 7.
- 			 "CogARMCompiler always uses a 0 shift in the last operand."
- 			 (mode ~= 1 and: [shift ~= 0]) ifTrue:
- 				[^anInstructionString].
- 			 opcode := word >> 21 bitAnd: 16rF.
  			 opcode ~= CogARMCompiler orOpcode ifTrue:
  				[^anInstructionString].
+ 			rotate := word >> 8 bitAnd: 16rF.
+ 			 mode := word >> 25 bitAnd: 7.
+ 			 "CogARMCompiler always uses a 0 rotate in the last operand of the final ORR when building long constants."
+ 			 (mode = 1 and: [rotate ~= 0]) ifTrue:
+ 				[^anInstructionString].
  			 operand := aSymbolManager backEnd literalBeforeFollowingAddress: address + 4].
  	"is there an intersting address with this?"
  	^(aSymbolManager lookupAddress: operand)
  		ifNotNil: [:string| anInstructionString, ' = ', (operand printStringRadix: 16), ' = ', string]
  		ifNil: [anInstructionString, ' = ', (operand printStringRadix: 16)]!



More information about the Vm-dev mailing list