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

commits at source.squeak.org commits at source.squeak.org
Mon Jul 7 16:29:59 UTC 2014


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

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

Name: BytecodeSets-eem.3
Author: eem
Time: 7 July 2014, 9:29:53.349 am
UUID: 811864c1-641a-48ce-a3d5-ca6ed3a5c672
Ancestors: BytecodeSets-eem.2

Add some missing Newspeak V3 & V4 methods.

=============== Diff against BytecodeSets-eem.2 ===============

Item was changed:
+ ----- Method: InstructionClient>>pushExplicitOuter: (in category '*BytecodeSets-NewsqueakV3-decoding') -----
- ----- Method: InstructionClient>>pushExplicitOuter: (in category '*BytecodeSets-NewsqueakV3-instruction decoding') -----
  pushExplicitOuter: n
  	"Push the Active Context's Receiver for an outer send at level n."
  
  	self subclassResponsibility!

Item was added:
+ ----- Method: InstructionClient>>sendToAbsentDynamicSuperclass:numArgs: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
+ sendToAbsentDynamicSuperclass: selector "<Symbol>" numArgs: arity "<SmallInteger>"
+ 	"Send Message With Selector, selector to the dynamic superclass.
+ 	 The arguments of the message are found in the top numArgs locations
+ 	 on the stack and the receiver is implicitly the receiver of the current method activation."!

Item was changed:
+ ----- Method: InstructionPrinter>>pushExplicitOuter: (in category '*BytecodeSets-NewsqueakV3-decoding') -----
- ----- Method: InstructionPrinter>>pushExplicitOuter: (in category '*BytecodeSets-NewsqueakV3-instruction decoding') -----
  pushExplicitOuter: n 
  	"Print the Push the Active Context's Receiver for an outer send at level (method literalAt: litIndex) bytecode."
  
  	self print: 'pushExplicitOuter: ', n asString!

Item was changed:
+ ----- Method: InstructionPrinter>>pushImplicitReceiverForMessage: (in category '*BytecodeSets-NewsqueakV3-decoding') -----
- ----- Method: InstructionPrinter>>pushImplicitReceiverForMessage: (in category '*BytecodeSets-NewsqueakV3-instruction decoding') -----
  pushImplicitReceiverForMessage: aSymbol 
  	"Print the Push Active Context's Receiver for an outer send of aSymbol on Top Of Stack bytecode."
  
  	self print: 'pushImplicitReceiverFor: ', aSymbol asString!

Item was changed:
+ ----- Method: InstructionPrinter>>sendToAbsentDynamicSuperclass:numArgs: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
+ sendToAbsentDynamicSuperclass: selector "<Symbol>" numArgs: numArgs "<SmallInteger>"
+ 	self print: '(absent receiver) dynamicSuperSend: ' , (self stringForSelector: selector numArgs: numArgs)!
- ----- Method: InstructionPrinter>>sendToAbsentDynamicSuperclass:numArgs: (in category '*BytecodeSets-NewsqueakV4-instruction decoding') -----
- sendToAbsentDynamicSuperclass: selector "<Symbol>" numArgs: arity "<SmallInteger>"
- 	self print: '(absent receiver) dynamicSuperSend: ', selector!

Item was changed:
+ ----- Method: InstructionPrinter>>sendToAbsentImplicitReceiver:numArgs: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
- ----- Method: InstructionPrinter>>sendToAbsentImplicitReceiver:numArgs: (in category '*BytecodeSets-NewsqueakV4-instruction decoding') -----
  sendToAbsentImplicitReceiver: selector "<Symbol>" numArgs: arity "<SmallInteger>"
  	self print: '(absent receiver) implicitReceiverSend: ', selector!

Item was added:
+ ----- Method: InstructionStream>>interpretNSV4ExtendedPush:for: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
+ interpretNSV4ExtendedPush: extB for: client
+ 	"Implement the extended push for non-zero extensions."
+ 	"77			01001101				Push false [* 1:true, 2:nil, 3:thisContext, ..., -N: pushExplicitOuter: N, N = Extend B]"
+ 	extB < 0 ifTrue:
+ 		[^client pushExplicitOuter: extB negated].
+ 	extB < 2 ifTrue:
+ 		[^client pushConstant: extB = 1].
+ 	extB = 2 ifTrue:
+ 		[^client pushConstant: nil].
+ 	extB = 3 ifTrue:
+ 		[^client pushActiveContext].
+ 	self error: 'undefined extended push'!

Item was changed:
  ----- Method: InstructionStream>>interpretNextNSV4InstructionFor: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
  interpretNextNSV4InstructionFor: client
  	"Send to the argument, client, a message that specifies the next instruction."
  
  	| byte div16 offset method extA extB savedPC |
  	method := self method.
  	"For a table of the bytecode set, see EncoderForNewsqueakV2's class comment."
  	"consume and compute any extensions first."
  	extA := extB := 0.
  	savedPC := pc.
  	[byte := self method at: pc.
  	 pc := pc + 1.
  	 byte >= 224 and: [byte <= 225]] whileTrue:
  		[| extByte |
  		 extByte := self method at: pc.
  		 pc := pc + 1.
  		 byte = 224
  			ifTrue:
  				[extA := (extA bitShift: 8) + extByte]
  			ifFalse:
  				[extB := (extB = 0 and: [extByte > 127])
  							ifTrue: [extByte - 256]
  							ifFalse: [(extB bitShift: 8) + extByte]]].
  	div16 := byte // 16.
  	offset := byte \\ 16.
  	"We do an inline quasi-binary search on each of the possible 16 values of div16"
  	div16 < 12 ifTrue:
  		[div16 < 4 ifTrue:
  			[div16 < 2 ifTrue:
  				[div16 = 0 ifTrue:
  					 [^client pushReceiverVariable: offset].
  				^client pushLiteralVariable: (method literalAt: offset + 1)]. "div16 = 1"
  			 ^client pushConstant: (method literalAt: byte \\ 32 + 1)].
  		 div16 = 4 ifTrue:
  			[offset < 12 ifTrue:
  				[^client pushTemporaryVariable: offset].
  			 offset < 14 ifTrue:
  				[offset = 12 ifTrue:
  					[^client pushReceiver].
  				 extB = 0 ifTrue:
  					[^client pushConstant: false].
+ 				 ^self interpretNSV4ExtendedPush: extB for: client].
- 				 ^self alternateInterpretExtendedPush: extB for: client].
  			 ^client pushConstant: offset - 14]. "0 & 1"
  		"short sends"
  		div16 < 7 ifTrue: "special selector sends"
  			[div16 = 5 ifTrue:
  				[^client
  					send: (Smalltalk specialSelectorAt: offset + 1)
  					super: false
  					numArgs: (Smalltalk specialNargsAt: offset + 1)].
  			 ^client
  				send: (Smalltalk specialSelectorAt: offset + 17)
  				super: false
  				numArgs: (Smalltalk specialNargsAt: offset + 17)].
  		div16 < 10 ifTrue: "vanilla sends, div16 = 7, 8 & 9"
  			[^client
  				send: (method literalAt: offset + 1)
  				super: false
  				numArgs: div16 - 7].
  		"implicit receiver send, div16 = 10"
  		 div16 = 10 ifTrue:
  			[^client
  				sendToAbsentImplicitReceiver: (method literalAt: offset + 1)
  				numArgs: 0].
  		"short store pops"
  		offset < 8 ifTrue:
  			[^client popIntoReceiverVariable: offset].
  		^client popIntoTemporaryVariable: offset - 8].
  	"div16 >= 12"
  	div16 < 14 ifTrue:
  		[div16 = 12 ifTrue:
  			[offset < 8 ifTrue:
  				[^client jump: offset + 1].
  			 ^client jump: offset - 7 if: true].
  		 offset < 8 ifTrue:
  			[^client jump: offset + 1 if: false].
  		 offset < 11 ifTrue:
  		 	[offset = 8 ifTrue: [^client methodReturnReceiver].
  			 offset = 9 ifTrue: [^client methodReturnTop].
  			 extA > 0 ifTrue:
  				[^client blockReturnTopFromLevel: extA].
  			 ^client blockReturnTop].
  		 offset = 11 ifTrue:
  			[^client doDup].
  		 offset = 12 ifTrue:
  			[^client doPop].
  		 offset = 13 ifTrue:
  			[^client doNop].
  		"222		11011110		break ?  could have blockCopy: send break, but need a receiver and a pop result"
  		"223		11011111		UNASSIGNED"
  		^self unusedBytecode: client at: savedPC].
  	"2 byte and 3 byte codes"
  	byte < 249 ifTrue:
  		[^self interpretNext2ByteNSV4Instruction: byte for: client extA: extA extB: extB startPC: savedPC].
  	^self interpretNext3ByteNSV4Instruction: byte for: client extA: extA extB: extB startPC: savedPC!

Item was added:
+ ----- Method: InstructionStream>>pushExplicitOuter: (in category '*BytecodeSets-NewsqueakV4-decoding') -----
+ pushExplicitOuter: n "<Integer>"
+ 	self subclassResponsibility!



More information about the Vm-dev mailing list