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

commits at source.squeak.org commits at source.squeak.org
Thu May 14 20:54:22 UTC 2020


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

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

Name: VMMaker.oscog-eem.2755
Author: eem
Time: 14 May 2020, 1:54:08.600302 pm
UUID: 804700d1-cc28-4b4f-b27d-091069478525
Ancestors: VMMaker.oscog-dtl.2754

Better document callPrimitiveBytecode.

=============== Diff against VMMaker.oscog-dtl.2754 ===============

Item was changed:
  ----- Method: StackInterpreter>>callPrimitiveBytecode (in category 'miscellaneous bytecodes') -----
  callPrimitiveBytecode
+ 	"SistaV1:	**	248	(2)	11111000 	iiiiiiii		mssjjjjj		Call Primitive #iiiiiiii + (jjjjj * 256) 
+ 								m=1 means inlined primitive, no hard return after execution. 
+ 								ss defines the unsafe operation set used to encode the operations. 
+ 								(ss = 0 means sista unsafe operations, ss = 01 means lowcode operations, other numbers are as yet used)
+ 	 V3/Spur:		139		10001011	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjjj * 256)
+ 	 V4:			249		11111001	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjjj * 256)"
+ 
- 	"V4:			249		11111001	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjjj * 256)
- 	 SistaV1:	248		11111000 	iiiiiiii		mjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
- 	 V3/Spur:	139		10001011	i i i i i i i i	jjjjjjjj		Call Primitive #iiiiiiii + (jjjjjjjj * 256)"
  	"Note that we simply skip a callPrimitiveBytecode at the start of a method
  	 that contains a primitive.  This because methods like Context(Part)>>reset
  	 have to be updated to skip the callPrimtiive bytecode otherwise."
  	SistaVM
  		ifTrue:
  			[| byte1 byte2 prim primSet header |
  			 byte1 := self fetchByte.
  			 byte2 := self fetchByte.
  			 self fetchNextBytecode.
  			 byte2 < 128 ifTrue:
  				[header := objectMemory methodHeaderOf: method.
  				 ((self methodHeaderHasPrimitive: header)
  				  and: [localIP asUnsignedInteger
  						= (self initialIPForHeader: header method: method) + (self sizeOfCallPrimitiveBytecode: header)]) ifTrue:
  					[^self].
  				 localIP := localIP - 3.
  				 ^self respondToUnknownBytecode].
+ 
  			 prim := byte2 - 128 << 8 + byte1.
  			 primSet := prim >> 13 bitAnd: 3.
  			 prim := prim bitAnd: 8191.
  			 primSet = 0 ifTrue: [^self sistaInlinePrimitive: prim].
  		
+ 			LowcodeVM ifTrue:
+ 				[primSet = 1 ifTrue:
+ 					[prim < 1000 ifTrue:
- 			LowcodeVM ifTrue: [
- 				primSet = 1 ifTrue: [
- 					prim < 1000 ifTrue:
  						[^self lowcodeNullaryInlinePrimitive: prim].
  
  					prim < 2000 ifTrue:
  						[^self lowcodeUnaryInlinePrimitive: prim - 1000].
  				
  					prim < 3000 ifTrue:
  						[^self lowcodeBinaryInlinePrimitive: prim - 2000].
  
  					prim < 4000 ifTrue:
+ 						[^self lowcodeTrinaryInlinePrimitive: prim - 3000]]].
- 						[^self lowcodeTrinaryInlinePrimitive: prim - 3000].
- 				].
- 			].
  		
+ 			localIP := localIP - 3]
- 			localIP := localIP - 3.
- 			^self respondToUnknownBytecode]
  		ifFalse:
  			[| header |
  			 header := objectMemory methodHeaderOf: method.
  			 ((self methodHeaderHasPrimitive: header)
+ 			  and: [localIP asInteger = (self initialIPForHeader: header method: method)]) ifTrue:
+ 				[localIP := localIP + (self sizeOfCallPrimitiveBytecode: header) - 1.
+ 				 ^self fetchNextBytecode]].
+ 
+ 	^self respondToUnknownBytecode!
- 			  and: [localIP asInteger = (self initialIPForHeader: header method: method)])
- 				ifTrue:
- 					[localIP := localIP + (self sizeOfCallPrimitiveBytecode: header) - 1.
- 					 ^self fetchNextBytecode]
- 				ifFalse:
- 					[^self respondToUnknownBytecode]]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genCallPrimitiveBytecode (in category 'bytecode generators') -----
  genCallPrimitiveBytecode
+ 	"SistaV1:	**	248	(2)	11111000 	iiiiiiii		mssjjjjj		Call Primitive #iiiiiiii + (jjjjj * 256) 
+ 								m=1 means inlined primitive, no hard return after execution. 
+ 								ss defines the unsafe operation set used to encode the operations. 
+ 								(ss = 0 means sista unsafe operations, ss = 01 means lowcode operations, other numbers are as yet used).
+ 	 See SistaCogit genCallPrimitiveBytecode, EncoderForSistaV1's class comment and StackInterpreter>>#callPrimitiveBytecode for more information."
- 	"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>>#inlinePrimitiveBytecode:"
  	| prim primSet |
  	byte2 < 128 ifTrue:
  		[^bytecodePC = initialPC
  			ifTrue: [0]
  			ifFalse: [EncounteredUnknownBytecode]].
  	prim := byte2 - 128 << 8 + byte1.
  	primSet := prim >> 13 bitAnd: 3.
  	prim := prim bitAnd: 8191.
+ 	LowcodeVM ifTrue:
+ 		[primSet = 1 ifTrue:
+ 			[prim < 1000 ifTrue:
+ 				[^self genLowcodeNullaryInlinePrimitive: prim].
- 	LowcodeVM
- 		ifTrue:
- 			[
- 			primSet = 1 ifTrue: [
- 				prim < 1000 ifTrue:
- 					[^self genLowcodeNullaryInlinePrimitive: prim].
  
+ 			prim < 2000 ifTrue:
+ 				[^self genLowcodeUnaryInlinePrimitive: prim - 1000].
+ 			
+ 			prim < 3000 ifTrue:
+ 				[^ self genLowcodeBinaryInlinePrimitive: prim - 2000].
- 				prim < 2000 ifTrue:
- 					[^self genLowcodeUnaryInlinePrimitive: prim - 1000].
- 				
- 				prim < 3000 ifTrue:
- 					[^ self genLowcodeBinaryInlinePrimitive: prim - 2000].
  
+ 			prim < 4000 ifTrue:
+ 				[^self genLowcodeTrinaryInlinePrimitive: prim - 3000]]].
- 				prim < 4000 ifTrue:
- 					[^self genLowcodeTrinaryInlinePrimitive: prim - 3000].
- 			]
- 		].
  
  	^EncounteredUnknownBytecode!



More information about the Vm-dev mailing list