[Vm-dev] VM Maker: Cog-eem.353.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 18 18:57:22 UTC 2019


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

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

Name: Cog-eem.353
Author: eem
Time: 14 January 2019, 3:29:40.662532 pm
UUID: b9302c7a-b83b-4cdc-b79e-b88cdd70dbe9
Ancestors: Cog-eem.352

Add a few more querioes over dominagting bytecodes plus support for BytecodeEncoder class>>isBranchAt:in: in V3PlusCosures and SistaV1

=============== Diff against Cog-eem.352 ===============

Item was added:
+ ----- Method: BytecodeEncoder class>>isBranchAt:in: (in category '*Cog-instruction stream support') -----
+ isBranchAt: pc in: method
+ 	"Answer whether the bytecode at pc is a conditional branch."
+ 
+ 	self subclassResponsibility!

Item was added:
+ ----- Method: DominatorFinder class>>containsAssignedOptimizedConditionalExpressionValue: (in category 'exploration') -----
+ containsAssignedOptimizedConditionalExpressionValue: aCompiledMethod
+ 	"Answer if aCompiledMethod contains an optimized conditional expression which is assigned."
+ 	[:dominatingNodes
+ 	 :anomalousNodes
+ 	 :dominatedNodes
+ 	 :dominatorMap
+ 	 :newMethod| | encoderClass |
+ 	^dominatorMap notEmpty
+ 	  and: [(encoderClass := newMethod encoderClass) supportsFullBlocks
+ 			ifFalse: "simple; can look at the single method object"
+ 				[| sps |
+ 				 sps := (StackDepthFinder on: newMethod) stackPointers.
+ 				 dominatorMap associations anySatisfy:
+ 					[:a| "Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
+ 					((encoderClass isStorePopAt: a value in: newMethod)
+ 					or: [encoderClass isStoreAt: a value in: newMethod])
+ 					and: [(sps at: a key) <= (sps at: a value)]]]
+ 			ifTrue: "complex; have to locate the relevant sub-method"
+ 				[| asps |
+ 				 asps := (StackDepthFinder on: newMethod) allStackPointers.
+ 				 dominatorMap associations anySatisfy:
+ 					[:a| | dpc sps m |
+ 					a key isInteger
+ 						ifTrue:
+ 							[dpc := a key.
+ 							 m := newMethod]
+ 						ifFalse:
+ 							[dpc := a key value.
+ 							 m := a key key].
+ 						sps := asps at: m.
+ 					"Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
+ 					((encoderClass isStorePopAt: a value in: m)
+ 					or: [encoderClass isStoreAt: a value in: m])
+ 					and: [(sps at: dpc) <= (sps at: a value)]]]]]
+ 		valueWithArguments: (self dominatorTupleForMethod: aCompiledMethod)!

Item was changed:
  ----- Method: DominatorFinder class>>containsOptimizedConditionalExpressionValue: (in category 'exploration') -----
  containsOptimizedConditionalExpressionValue: aCompiledMethod
  	"Answer if aCompiledMethod contains an optimized conditional expression which
  	 is used as either a message receiver or parameter, or a value to store or return."
  	[:dominatingNodes
  	 :anomalousNodes
  	 :dominatedNodes
  	 :dominatorMap
  	 :newMethod| | encoderClass |
  	^dominatorMap notEmpty
  	  and: [(encoderClass := newMethod encoderClass) supportsFullBlocks
  			ifFalse: "simple; can look at the single method object"
  				[| sps |
  				 sps := (StackDepthFinder on: newMethod) stackPointers.
  				 dominatorMap associations anySatisfy:
  					[:a| "Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
  					(encoderClass isJustPopAt: a value in: newMethod) not
  					and: [(sps at: a key) <= (sps at: a value)]]]
+ 			ifTrue: "complex; have to locate the relevant sub-method"
- 			ifTrue: "complex; have to locate the reelevant sub-method"
  				[| asps |
  				 asps := (StackDepthFinder on: newMethod) allStackPointers.
  				 dominatorMap associations anySatisfy:
  					[:a| | dpc sps m |
  					a key isInteger
  						ifTrue:
  							[dpc := a key.
  							 m := newMethod]
  						ifFalse:
  							[dpc := a key value.
  							 m := a key key].
  						sps := asps at: m.
  					"Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
  					(encoderClass isJustPopAt: a value in: m) not
  					and: [(sps at: dpc) <= (sps at: a value)]]]]]
  		valueWithArguments: (self dominatorTupleForMethod: aCompiledMethod)!

Item was added:
+ ----- Method: DominatorFinder class>>containsOptimizedConditionalExpressionValueOtherThanForBranching: (in category 'exploration') -----
+ containsOptimizedConditionalExpressionValueOtherThanForBranching: aCompiledMethod
+ 	"Answer if aCompiledMethod contains an optimized conditional expression which
+ 	 is used as either a message receiver or parameter, or a value to store or return,
+ 	 but not as a receiver to be branched upon."
+ 	[:dominatingNodes
+ 	 :anomalousNodes
+ 	 :dominatedNodes
+ 	 :dominatorMap
+ 	 :newMethod| | encoderClass |
+ 	^dominatorMap notEmpty
+ 	  and: [(encoderClass := newMethod encoderClass) supportsFullBlocks
+ 			ifFalse: "simple; can look at the single method object"
+ 				[| sps |
+ 				 sps := (StackDepthFinder on: newMethod) stackPointers.
+ 				 dominatorMap associations anySatisfy:
+ 					[:a| "Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
+ 					(encoderClass isJustPopAt: a value in: newMethod) not
+ 					and: [(encoderClass isBranchAt: a value in: newMethod) not
+ 					and: [(sps at: a key) <= (sps at: a value)]]]]
+ 			ifTrue: "complex; have to locate the relevant sub-method"
+ 				[| asps |
+ 				 asps := (StackDepthFinder on: newMethod) allStackPointers.
+ 				 dominatorMap associations anySatisfy:
+ 					[:a| | dpc sps m |
+ 					a key isInteger
+ 						ifTrue:
+ 							[dpc := a key.
+ 							 m := newMethod]
+ 						ifFalse:
+ 							[dpc := a key value.
+ 							 m := a key key].
+ 						sps := asps at: m.
+ 					"Filter out expr ifTrue: [...] ifFalse: [...].  Both arms share a single pop"
+ 					(encoderClass isJustPopAt: a value in: m) not
+ 					and: [(encoderClass isBranchAt: a value in: m) not
+ 					and: [(sps at: dpc) <= (sps at: a value)]]]]]]
+ 		valueWithArguments: (self dominatorTupleForMethod: aCompiledMethod)!

Item was added:
+ ----- Method: EncoderForSistaV1 class>>isBranchAt:in: (in category '*Cog-instruction stream support') -----
+ isBranchAt: pc in: method
+ 	"Answer whether the bytecode at pc is a conditional branch."
+ 
+ 	"	184-191	10111 iii				Pop and Jump 0n True iii +1 (i.e., 1 through 8)
+ 		192-199	11000 iii				Pop and Jump 0n False iii +1 (i.e., 1 through 8)
+ 	 *	238		11101110	iiiiiiii		Pop and Jump 0n True #iiiiiiii (+ Extend B * 256, where Extend B >= 0))
+ 	 *	239		11101111	iiiiiiii		Pop and Jump 0n False #iiiiiiii (+ Extend B * 256, where Extend B >= 0)"
+ 	| byte |
+ 	byte := self nonExtensionBytecodeAt: pc in: method.
+ 	^byte >= 184 and: [byte <= 199 or: [byte >= 238 and: [byte <= 239]]]!

Item was added:
+ ----- Method: EncoderForV3 class>>isBranchAt:in: (in category '*Cog-instruction stream support') -----
+ isBranchAt: pc in: method
+ 	"Answer whether the bytecode at pc is a conditional branch."
+ 
+ 	"152-159 	10011iii 		Pop and Jump 0n False iii +1 (i.e., 1 through 8)
+ 	 168-171 	101010ii jjjjjjjj 	Pop and Jump On True ii *256+jjjjjjjj
+ 	 172-175 	101011ii jjjjjjjj 	Pop and Jump On False ii *256+jjjjjjjj"
+ 	| bytecode |
+ 	bytecode := method at: pc.
+ 	^bytecode >= 152
+ 	 and: [bytecode <= 159
+ 			or: [bytecode >= 168 and: [bytecode <= 175]]]!

Item was added:
+ ----- Method: InstructionStream>>willBranch (in category '*Cog-testing') -----
+ willBranch
+ 	"Answer whether the next bytecode is a conditional branch."
+ 	| method |
+ 	method := self method.
+ 	^method encoderClass isBranchAt: pc in: method!



More information about the Vm-dev mailing list