[Vm-dev] VM Maker: BytecodeSets.spur-eem.30.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Apr 6 22:44:17 UTC 2015


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

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

Name: BytecodeSets.spur-eem.30
Author: eem
Time: 6 April 2015, 3:44:11.944 pm
UUID: 7d0b7bd6-2797-4206-807e-9955f835373b
Ancestors: BytecodeSets.spur-eem.29

Add support for a directed super send bytecode
that starts the lookup above the class that is the
value of an association pushed on the stack immediately
before the send.  This bytecode is used in SistaV1
to allow inlining of code that contains super sends.

=============== Diff against BytecodeSets.spur-eem.29 ===============

Item was added:
+ ----- Method: BlockLocalTempCounter>>directedSuperSend:numArgs: (in category '*BytecodeSets-instruction decoding') -----
+ directedSuperSend: selector numArgs: numArgs
+ 	"Send Message Above Specific Class With Selector, selector, bytecode.
+ 	 Start the lookup above the class that is the value of the association on
+ 	 top of stack. The arguments  of the message are found in the top numArgs
+ 	 stack locations beneath the association, and the receiver just below them."
+ 
+ 	stackPointer := stackPointer - (numArgs + 1)!

Item was added:
+ ----- Method: BytecodeEncoder>>sizeSendDirectedSuper:numArgs: (in category '*BytecodeSets-opcode sizing') -----
+ sizeSendDirectedSuper: selectorLiteralIndex numArgs: numArgs
+ 	^self sizeOpcodeSelector: #genSendDirectedSuper:numArgs: withArguments: {selectorLiteralIndex. numArgs}!

Item was added:
+ ----- Method: ContextPart>>directedSuperSend:numArgs: (in category '*BytecodeSets-instruction decoding') -----
+ directedSuperSend: selector numArgs: numArgs
+ 	"Simulate the action of bytecodes that send a message with selector,
+ 	 selector, starting the lookup above the class that is the value of the
+ 	 association on top of stack. The arguments  of the message are found
+ 	 in the top numArgs stack locations and the receiver just below them."
+ 
+ 	| startClassAssociation receiver arguments |
+ 	startClassAssociation := self pop.
+ 	arguments := Array new: numArgs.
+ 	numArgs to: 1 by: -1 do: [:i| arguments at: i put: self pop].
+ 	receiver := self pop.
+ 	^self
+ 		send: selector
+ 		to: receiver
+ 		with: arguments
+ 		lookupIn: startClassAssociation value superclass!

Item was added:
+ ----- Method: InstructionClient>>directedSuperSend:numArgs: (in category '*BytecodeSets-instruction decoding') -----
+ directedSuperSend: selector numArgs: numArgs
+ 	"Send Message Above Specific Class With Selector, selector, bytecode.
+ 	 Start the lookup above the class that is the value of the association on
+ 	 top of stack. The arguments  of the message are found in the top numArgs
+ 	 stack locations beneath the association, and the receiver just below them."!

Item was added:
+ ----- Method: InstructionPrinter>>directedSuperSend:numArgs: (in category '*BytecodeSets-instruction decoding') -----
+ directedSuperSend: selector "<Symbol>" numArgs: numArgs "<SmallInteger>"
+ 	self print: 'directedSuperSend: ' , (self stringForSelector: selector numArgs: numArgs)!

Item was changed:
  ----- Method: InstructionStream>>interpretNext2ByteSistaV1Instruction:for:extA:extB:startPC: (in category '*BytecodeSets-SistaV1-decoding') -----
  interpretNext2ByteSistaV1Instruction: bytecode for: client extA: extA extB: extB startPC: startPC
  	"Send to the argument, client, a message that specifies the next instruction.
  	 This method handles the two-byte codes.
  	 For a table of the bytecode set, see EncoderForV1's class comment."
  
  	| byte method |
  	method := self method.
  	byte := self method at: pc.
  	pc := pc + 1.
  	"We do an inline quasi-binary search on bytecode"
  	bytecode < 234 ifTrue: "pushes"
  		[bytecode < 231 ifTrue:
  			[bytecode < 229 ifTrue:
  				[| literal |
  				 bytecode = 226 ifTrue:
  					[^client pushReceiverVariable: (extA bitShift: 8) + byte].
  				 literal := method literalAt: (extA bitShift: 8) + byte + 1.
  				 bytecode = 227 ifTrue:
  					[^client pushLiteralVariable: literal].
  				 ^client pushConstant: literal].
  			bytecode = 229 ifTrue:
  				[^client pushTemporaryVariable: byte]. 
  			^client pushClosureTemps: byte]. 
  		bytecode = 231 ifTrue:
  			[^byte < 128
  				ifTrue: [client pushNewArrayOfSize: byte]
  				ifFalse: [client pushConsArrayWithElements: byte - 128]].
  		bytecode = 232 ifTrue:
  			[^client pushConstant: (extB bitShift: 8) + byte].
  		^client pushConstant: (Character value: (extB bitShift: 8) + byte)].
  	bytecode < 240 ifTrue: "sends, trap and jump"
  		[bytecode < 236 ifTrue: "sends"
+ 			[(bytecode = 235 and: [extB >= 64]) ifTrue:
+ 				[^client
+ 					directedSuperSend: (method literalAt: (extA bitShift: 5) + (byte // 8) + 1)
+ 					numArgs: (extB - 64 bitShift: 3) + (byte \\ 8)].
+ 			 ^client
- 			[^client
  				send: (method literalAt: (extA bitShift: 5) + (byte // 8) + 1)
  				super: bytecode = 235
  				numArgs: (extB bitShift: 3) + (byte \\ 8)].
  		 bytecode = 236 ifTrue:
  			[^client trapIfNotInstanceOf: (method literalAt: (extA bitShift: 8) + byte + 1)].
  		bytecode = 237 ifTrue:
  			[^client jump: (extB bitShift: 8) + byte].
  		 ^client jump: (extB bitShift: 8) + byte if: bytecode = 238].
  	bytecode < 243 ifTrue:
  		[bytecode = 240 ifTrue:
  			[^client popIntoReceiverVariable: (extA bitShift: 8) + byte].
  		 bytecode = 241 ifTrue:
  			[^client popIntoLiteralVariable: (method literalAt: (extA bitShift: 8) + byte + 1)].
  		 ^client popIntoTemporaryVariable: byte].
  	bytecode = 243 ifTrue:
  		[^client storeIntoReceiverVariable: (extA bitShift: 8) + byte].
  	bytecode = 244 ifTrue:
  		[^client storeIntoLiteralVariable: (method literalAt: (extA bitShift: 8) + byte + 1)].
  	bytecode = 245 ifTrue:
  		[^client storeIntoTemporaryVariable: byte].
  	"246-247	1111011 i	xxxxxxxx	UNASSIGNED"
  	^self unusedBytecode: client at: startPC!



More information about the Vm-dev mailing list