[Vm-dev] VM Maker: VMMaker.oscog-cb.1765.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Apr 5 23:36:47 UTC 2016


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

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

Name: VMMaker.oscog-cb.1765
Author: cb
Time: 5 April 2016, 4:34:19.354 pm
UUID: 65ea22d4-d96c-41bb-b7d8-4ad1f021409b
Ancestors: VMMaker.oscog-nice.1764

Added the remote inst var access bytecode in sista V1 bytecode without interfering with existing code.

Added the ExtB flags extension to tip the JIT how what machine code checks can be ignored on specific operations.

=============== Diff against VMMaker.oscog-nice.1764 ===============

Item was changed:
  ----- Method: SimpleStackBasedCogit class>>initializeBytecodeTableForSistaV1 (in category 'class initialization') -----
  initializeBytecodeTableForSistaV1
  	"SimpleStackBasedCogit initializeBytecodeTableForSistaV1"
  
  	BytecodeSetHasDirectedSuperSend := true.
  	FirstSpecialSelector := 96.
  	NumSpecialSelectors := 32.
  	self flag:
  'Special selector send class must be inlined to agree with the interpreter, which
   inlines class.  If class is sent to e.g. a general instance of ProtoObject then unless
   class is inlined there will be an MNU.  It must be that the Cointerpreter and Cogit
   have identical semantics.  We get away with not hardwiring the other special
   selectors either because in the Cointerpreter they are not inlined or because they
   are inlined only to instances of classes for which there will always be a method.'.
  	self generatorTableFrom: #(
  		"1 byte bytecodes"
  		"pushes"
  		(1    0   15 genPushReceiverVariableBytecode isInstVarRef)
  		(1  16   31 genPushLiteralVariable16CasesBytecode	needsFrameNever: 1)
  		(1  32   63 genPushLiteralConstantBytecode			needsFrameNever: 1)
  		(1  64   75 genPushTemporaryVariableBytecode)
  		(1  76   76 genPushReceiverBytecode)
  		(1  77   77 genPushConstantTrueBytecode				needsFrameNever: 1)
  		(1  78   78 genPushConstantFalseBytecode			needsFrameNever: 1)
  		(1  79   79 genPushConstantNilBytecode				needsFrameNever: 1)
  		(1  80   80 genPushConstantZeroBytecode				needsFrameNever: 1)
  		(1  81   81 genPushConstantOneBytecode				needsFrameNever: 1)
  		(1  82   82 genExtPushPseudoVariable)
  		(1  83   83 duplicateTopBytecode						needsFrameNever: 1)
  
  		(1  84   87 unknownBytecode)
  
  		"returns"
  		(1  88   88 genReturnReceiver				return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  89   89 genReturnTrue					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  90   90 genReturnFalse					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  91   91 genReturnNil					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  92   92 genReturnTopFromMethod		return needsFrameIfInBlock: isMappedInBlock -1)
  		(1  93   93 genReturnNilFromBlock			return needsFrameNever: -1)
  		(1  94   94 genReturnTopFromBlock		return needsFrameNever: -1)
  		(1  95   95 genExtNopBytecode			needsFrameNever: 0)
  
  		"sends"
  		(1   96 117 genSpecialSelectorSend isMapped) "#+ #- #< #> #<= #>= #= #~= #* #/ #\\ #@ #bitShift: #// #bitAnd: #bitOr: #at: #at:put: #size #next #nextPut: #atEnd"
  		(1 118 118 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
  		(1 119 119 genSpecialSelectorClass needsFrameNever: notMapped 0) "not mapped because it is directly inlined (for now)"
  		(1 120 127 genSpecialSelectorSend isMapped) "#blockCopy: #value #value: #do: #new #new: #x #y"
  
  		(1 128 143 genSendLiteralSelector0ArgsBytecode isMapped)
  		(1 144 159 genSendLiteralSelector1ArgBytecode isMapped)
  		(1 160 175 genSendLiteralSelector2ArgsBytecode isMapped)
  
  		"jumps"
  		(1 176 183 genShortUnconditionalJump	branch v3:ShortForward:Branch:Distance:)
  		(1 184 191 genShortJumpIfTrue			branch isBranchTrue isMapped "because of mustBeBoolean"
  													v3:ShortForward:Branch:Distance:)
  		(1 192 199 genShortJumpIfFalse			branch isBranchFalse isMapped "because of mustBeBoolean"
  													v3:ShortForward:Branch:Distance:)
  
  		"stores"
  		(1 200 207 genStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability needsFrameIfImmutability: -1)
  		(1 208 215 genStoreAndPopTemporaryVariableBytecode)
  
  		(1 216 216 genPopStackBytecode needsFrameNever: -1)
  
  		(1 217 217 genUnconditionalTrapBytecode isMapped)
  
  		(1 218 223 unknownBytecode)
  
  		"2 byte bytecodes"
  		(2 224 224 extABytecode extension)
  		(2 225 225 extBBytecode extension)
  
  		"pushes"
  		(2 226 226 genExtPushReceiverVariableBytecode isInstVarRef)		"Needs a frame for context inst var access"
  		(2 227 227 genExtPushLiteralVariableBytecode		needsFrameNever: 1)
  		(2 228 228 genExtPushLiteralBytecode					needsFrameNever: 1)
  		(2 229 229 genLongPushTemporaryVariableBytecode)
  		(2 230 230 genPushClosureTempsBytecode)
  		(2 231 231 genPushNewArrayBytecode)
  		(2 232 232 genExtPushIntegerBytecode				needsFrameNever: 1)
  		(2 233 233 genExtPushCharacterBytecode				needsFrameNever: 1)
  
  		"returns"
  		"sends"
  		(2 234 234 genExtSendBytecode isMapped)
  		(2 235 235 genExtSendSuperBytecode isMapped)
  
  		"sista bytecodes"
  		(2 236 236 unknownBytecode)
  
  		"jumps"
  		(2 237 237 genExtUnconditionalJump	branch isMapped "because of interrupt check" v4:Long:Branch:Distance:)
  		(2 238 238 genExtJumpIfTrue			branch isBranchTrue isMapped "because of mustBeBoolean" v4:Long:Branch:Distance:)
  		(2 239 239 genExtJumpIfFalse			branch isBranchFalse isMapped "because of mustBeBoolean" v4:Long:Branch:Distance:)
  
  		"stores"
+ 		(2 240 240 genSistaExtStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
+ 		(2 241 241 genSistaExtStoreAndPopLiteralVariableBytecode isMappedIfImmutability)
- 		(2 240 240 genExtStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
- 		(2 241 241 genExtStoreAndPopLiteralVariableBytecode isMappedIfImmutability)
  		(2 242 242 genLongStoreAndPopTemporaryVariableBytecode)
+ 		(2 243 243 genSistaExtStoreReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
+ 		(2 244 244 genSistaExtStoreLiteralVariableBytecode isMappedIfImmutability)
- 		(2 243 243 genExtStoreReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
- 		(2 244 244 genExtStoreLiteralVariableBytecode isMappedIfImmutability)
  		(2 245 245 genLongStoreTemporaryVariableBytecode)
  
  		(2 246 247	unknownBytecode)
  
  		"3 byte bytecodes"
  		(3 248 248 genCallPrimitiveBytecode)
  		(3 249 249 unknownBytecode) "reserved for Push Float"
  		(3 250 250 genExtPushClosureBytecode block v4:Block:Code:Size:)
+ 		(3 251 251 genExtPushRemoteTempOrInstVarLongBytecode)
+ 		(3 252 252 genExtStoreRemoteTempOrInstVarLongBytecode isMappedIfImmutability)
+ 		(3 253 253 genExtStoreAndPopRemoteTempOrInstVarLongBytecode isMappedIfImmutability)
- 		(3 251 251 genPushRemoteTempLongBytecode)
- 		(3 252 252 genStoreRemoteTempLongBytecode)
- 		(3 253 253 genStoreAndPopRemoteTempLongBytecode)
  
  		(3 254 254	genExtJumpIfNotInstanceOfBehaviorsOrPopBytecode)
  			
  		(3 255 255	unknownBytecode))!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genExtPushRemoteTempOrInstVarLongBytecode (in category 'bytecode generators') -----
+ genExtPushRemoteTempOrInstVarLongBytecode
+ 	| index |
+ 	^ (byte2 noMask: 1 << 7)
+ 		ifTrue: [ self genPushRemoteTempLongBytecode ]
+ 		ifFalse: 
+ 			[ index := byte1 + (extA << 8).
+ 			extA := 0.
+ 			extB := 0.
+ 			(coInterpreter isReadMediatedContextInstVarIndex: index)
+ 				ifTrue: [ self genPushMaybeContextRemoteInstVar: index inObjectAt: byte2 - (1 << 7) ]
+ 				ifFalse: [ self genPushRemoteInstVar: index inObjectAt: byte2 - (1 << 7) ] ]!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genExtStorePopRemoteTempOrInstVarLongBytecode (in category 'bytecode generators') -----
+ genExtStorePopRemoteTempOrInstVarLongBytecode
+ 	^ self genExtStorePopRemoteTempOrInstVarLongBytecode: true!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genExtStorePopRemoteTempOrInstVarLongBytecode: (in category 'bytecode generators') -----
+ genExtStorePopRemoteTempOrInstVarLongBytecode: boolean
+ 	| index |
+ 	extB := 0. "simple cogit don't use the extra flag"
+ 	(byte2 noMask: 1 << 7)
+ 		ifTrue: 
+ 			[ self genStorePop: boolean RemoteTemp: byte1 At: byte2.
+ 			self cppIf: IMMUTABILITY ifTrue: [ self annotateBytecode: self Label ] ]
+ 		ifFalse: 
+ 			[ index := byte1 + (extA << 8).
+ 			extA := 0.
+ 			(coInterpreter isWriteMediatedContextInstVarIndex: index)
+ 				ifTrue: [ self 
+ 						genStorePop: boolean 
+ 						MaybeContextRemoteInstVar: index 
+ 						ofObjectAt: byte2 - (1 << 7) ]
+ 				ifFalse: [ self 
+ 						genStorePop: boolean 
+ 						RemoteInstVar: index 
+ 						ofObjectAt: byte2 - (1 << 7)  ] ].
+ 	^ 0!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genExtStoreRemoteTempOrInstVarLongBytecode (in category 'bytecode generators') -----
+ genExtStoreRemoteTempOrInstVarLongBytecode
+ 	^ self genExtStorePopRemoteTempOrInstVarLongBytecode: false!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreAndPopLiteralVariableBytecode (in category 'bytecode generators') -----
+ genSistaExtStoreAndPopLiteralVariableBytecode
+ 	^ self genSistaExtStoreLiteralVariableBytecode: true!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreAndPopReceiverVariableBytecode (in category 'bytecode generators') -----
+ genSistaExtStoreAndPopReceiverVariableBytecode
+ 	^ self genSistaExtStoreAndPopReceiverVariableBytecode: true!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreAndPopReceiverVariableBytecode: (in category 'bytecode generators') -----
+ genSistaExtStoreAndPopReceiverVariableBytecode: boolean
+ 	| index |
+ 	extB := 0. "Simple cogit don't use the extra flags"
+ 	index := byte1 + (extA << 8).
+ 	extA := 0.
+ 	^(coInterpreter isWriteMediatedContextInstVarIndex: index)
+ 		ifTrue: [self genStorePop: boolean MaybeContextReceiverVariable: index ]
+ 		ifFalse: [self genStorePop: boolean ReceiverVariable: index ]!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreLiteralVariableBytecode (in category 'bytecode generators') -----
+ genSistaExtStoreLiteralVariableBytecode
+ 	^ self genSistaExtStoreLiteralVariableBytecode: false!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreLiteralVariableBytecode: (in category 'bytecode generators') -----
+ genSistaExtStoreLiteralVariableBytecode: boolean
+ 	| index |
+ 	extB := 0. "SimpleCogit don't use the extra flags"
+ 	index := byte1 + (extA << 8).
+ 	extA := 0.
+ 	^ self genStorePop: boolean LiteralVariable: index!

Item was added:
+ ----- Method: SimpleStackBasedCogit>>genSistaExtStoreReceiverVariableBytecode (in category 'bytecode generators') -----
+ genSistaExtStoreReceiverVariableBytecode
+ 	^ self genSistaExtStoreAndPopReceiverVariableBytecode: false!

Item was changed:
  ----- Method: StackToRegisterMappingCogit class>>initializeBytecodeTableForSistaV1 (in category 'class initialization') -----
  initializeBytecodeTableForSistaV1
  	"StackToRegisterMappingCogit initializeBytecodeTableForSistaV1"
  
  	numPushNilsFunction := #sistaV1:Num:Push:Nils:.
  	pushNilSizeFunction := #sistaV1PushNilSize:numInitialNils:.
  	BytecodeSetHasDirectedSuperSend := true.
  	FirstSpecialSelector := 96.
  	NumSpecialSelectors := 32.
  	self flag:
  'Special selector send class must be inlined to agree with the interpreter, which
   inlines class.  If class is sent to e.g. a general instance of ProtoObject then unless
   class is inlined there will be an MNU.  It must be that the Cointerpreter and Cogit
   have identical semantics.  We get away with not hardwiring the other special
   selectors either because in the Cointerpreter they are not inlined or because they
   are inlined only to instances of classes for which there will always be a method.'.
  	self generatorTableFrom: #(
  		"1 byte bytecodes"
  		"pushes"
  		(1    0   15 genPushReceiverVariableBytecode isInstVarRef		needsFrameNever: 1)
  		(1  16   31 genPushLitVarDirSup16CasesBytecode				needsFrameNever: 1)
  		(1  32   63 genPushLiteralConstantBytecode					needsFrameNever: 1)
  		(1  64   75 genPushTemporaryVariableBytecode				needsFrameIfMod16GENumArgs: 1)
  		(1  76   76 genPushReceiverBytecode							needsFrameNever: 1)
  		(1  77   77 genPushConstantTrueBytecode						needsFrameNever: 1)
  		(1  78   78 genPushConstantFalseBytecode					needsFrameNever: 1)
  		(1  79   79 genPushConstantNilBytecode						needsFrameNever: 1)
  		(1  80   80 genPushConstantZeroBytecode						needsFrameNever: 1)
  		(1  81   81 genPushConstantOneBytecode						needsFrameNever: 1)
  		(1  82   82 genExtPushPseudoVariable)
  		(1  83   83 duplicateTopBytecode								needsFrameNever: 1)
  
  		(1  84   87 unknownBytecode)
  
  		"returns"
  		(1  88   88 genReturnReceiver				return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  89   89 genReturnTrue					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  90   90 genReturnFalse					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  91   91 genReturnNil					return needsFrameIfInBlock: isMappedInBlock 0)
  		(1  92   92 genReturnTopFromMethod		return needsFrameIfInBlock: isMappedInBlock -1)
  		(1  93   93 genReturnNilFromBlock			return needsFrameNever: -1)
  		(1  94   94 genReturnTopFromBlock		return needsFrameNever: -1)
  		(1  95   95 genExtNopBytecode			needsFrameNever: 0)
  
  		"sends"
  		(1  96   96 genSpecialSelectorArithmetic isMapped AddRR)
  		(1  97   97 genSpecialSelectorArithmetic isMapped SubRR)
  		(1  98   98 genSpecialSelectorComparison isMapped JumpLess)
  		(1  99   99 genSpecialSelectorComparison isMapped JumpGreater)
  		(1 100 100 genSpecialSelectorComparison isMapped JumpLessOrEqual)
  		(1 101 101 genSpecialSelectorComparison isMapped JumpGreaterOrEqual)
  		(1 102 102 genSpecialSelectorComparison isMapped JumpZero)
  		(1 103 103 genSpecialSelectorComparison isMapped JumpNonZero)
  		(1 104 109 genSpecialSelectorSend isMapped)	 " #* #/ #\\ #@ #bitShift: //"
  		(1 110 110 genSpecialSelectorArithmetic isMapped AndRR)
  		(1 111 111 genSpecialSelectorArithmetic isMapped OrRR)
  		(1 112 117 genSpecialSelectorSend isMapped) "#at: #at:put: #size #next #nextPut: #atEnd"
  		(1 118 118 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
  		(1 119 119 genSpecialSelectorClass needsFrameIfStackGreaterThanOne: notMapped 0) "not mapped because it is directly inlined (for now)"
  		(1 120 127 genSpecialSelectorSend isMapped) "#blockCopy: #value #value: #do: #new #new: #x #y"
  
  		(1 128 143 genSendLiteralSelector0ArgsBytecode isMapped)
  		(1 144 159 genSendLiteralSelector1ArgBytecode isMapped)
  		(1 160 175 genSendLiteralSelector2ArgsBytecode isMapped)
  
  		"jumps"
  		(1 176 183 genShortUnconditionalJump	branch v3:ShortForward:Branch:Distance:)
  		(1 184 191 genShortJumpIfTrue			branch isBranchTrue isMapped "because of mustBeBoolean"
  													v3:ShortForward:Branch:Distance:)
  		(1 192 199 genShortJumpIfFalse			branch isBranchFalse isMapped "because of mustBeBoolean"
  													v3:ShortForward:Branch:Distance:)
  		(1 200 207 genStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability needsFrameIfImmutability: -1)
  		
  		(1 208 215 genStoreAndPopTemporaryVariableBytecode)
  
  		(1 216 216 genPopStackBytecode needsFrameNever: -1)
  
  		(1 217 217 genUnconditionalTrapBytecode isMapped)
  
  		(1 218 223 unknownBytecode)
  
  		"2 byte bytecodes"
  		(2 224 224 extABytecode extension)
  		(2 225 225 extBBytecode extension)
  
  		"pushes"
  		(2 226 226 genExtPushReceiverVariableBytecode isInstVarRef)		"Needs a frame for context inst var access"
  		(2 227 227 genExtPushLitVarDirSupBytecode			needsFrameNever: 1)
  		(2 228 228 genExtPushLiteralBytecode					needsFrameNever: 1)
  		(2 229 229 genLongPushTemporaryVariableBytecode)
  		(2 230 230 genPushClosureTempsBytecode)
  		(2 231 231 genPushNewArrayBytecode)
  		(2 232 232 genExtPushIntegerBytecode				needsFrameNever: 1)
  		(2 233 233 genExtPushCharacterBytecode				needsFrameNever: 1)
  
  		"returns"
  		"sends"
  		(2 234 234 genExtSendBytecode isMapped)
  		(2 235 235 genExtSendSuperBytecode isMapped)
  
  		"sista bytecodes"
  		(2 236 236 unknownBytecode)
  
  		"jumps"
  		(2 237 237 genExtUnconditionalJump	branch isMapped "because of interrupt check" v4:Long:Branch:Distance:)
  		(2 238 238 genExtJumpIfTrue			branch isBranchTrue isMapped "because of mustBeBoolean" v4:Long:Branch:Distance:)
  		(2 239 239 genExtJumpIfFalse			branch isBranchFalse isMapped "because of mustBeBoolean" v4:Long:Branch:Distance:)
  
  		"stores"
+ 		(2 240 240 genSistaExtStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
+ 		(2 241 241 genSistaExtStoreAndPopLiteralVariableBytecode isMappedIfImmutability)
- 		(2 240 240 genExtStoreAndPopReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
- 		(2 241 241 genExtStoreAndPopLiteralVariableBytecode isMappedIfImmutability)
  		(2 242 242 genLongStoreAndPopTemporaryVariableBytecode)
+ 		(2 243 243 genSistaExtStoreReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
+ 		(2 244 244 genSistaExtStoreLiteralVariableBytecode isMappedIfImmutability)
- 		(2 243 243 genExtStoreReceiverVariableBytecode isInstVarRef isMappedIfImmutability)
- 		(2 244 244 genExtStoreLiteralVariableBytecode isMappedIfImmutability)
  		(2 245 245 genLongStoreTemporaryVariableBytecode)
  
  		(2 246 247	unknownBytecode)
  
  		"3 byte bytecodes"
  		(3 248 248 genCallPrimitiveBytecode)
  		(3 249 249 unknownBytecode) "reserved for Push Float"
  		(3 250 250 genExtPushClosureBytecode block v4:Block:Code:Size:)
+ 		(3 251 251 genExtPushRemoteTempOrInstVarLongBytecode)
+ 		(3 252 252 genExtStoreRemoteTempOrInstVarLongBytecode isMappedIfImmutability)
+ 		(3 253 253 genExtStoreAndPopRemoteTempOrInstVarLongBytecode isMappedIfImmutability)
- 		(3 251 251 genPushRemoteTempLongBytecode)
- 		(3 252 252 genStoreRemoteTempLongBytecode)
- 		(3 253 253 genStoreAndPopRemoteTempLongBytecode)
  
  		(3 254 254	genExtJumpIfNotInstanceOfBehaviorsOrPopBytecode branch v4:Long:BranchIfNotInstanceOf:Distance:)
  		
  		(3 255 255	unknownBytecode))!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>extBSpecifiesMaybeContext (in category 'bytecode generators') -----
+ extBSpecifiesMaybeContext
+ 	<inline: true>
+ 	^ extB anyMask: 2!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>extBSpecifiesNoStoreCheck (in category 'bytecode generator support') -----
+ extBSpecifiesNoStoreCheck 
+ 	<inline: true>
+ 	^ extB noMask: 1!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genExtPushRemoteTempOrInstVarLongBytecode (in category 'bytecode generators') -----
+ genExtPushRemoteTempOrInstVarLongBytecode
+ 	| index maybeContext |
+ 	^ (byte2 noMask: 1 << 7)
+ 		ifTrue: [ self genPushRemoteTempLongBytecode ]
+ 		ifFalse: 
+ 			[ maybeContext := self extBSpecifiesMaybeContext.
+ 			index := byte1 + (extA << 8).
+ 			extA := 0.
+ 			extB := 0.
+ 			((coInterpreter isReadMediatedContextInstVarIndex: index) and: [ maybeContext ])
+ 				ifTrue: [ self genPushMaybeContextRemoteInstVar: index inObjectAt: byte2 - (1 << 7) ]
+ 				ifFalse: [ self genPushRemoteInstVar: index inObjectAt: byte2 - (1 << 7) ] ]!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genExtStorePopRemoteTempOrInstVarLongBytecode: (in category 'bytecode generators') -----
+ genExtStorePopRemoteTempOrInstVarLongBytecode: boolean
+ 	| index maybeContext needsStoreCheck |
+ 	needsStoreCheck := self sistaNeedsStoreCheck.
+ 	maybeContext := self extBSpecifiesMaybeContext.
+ 	extB := 0.
+ 	(byte2 noMask: 1 << 7)
+ 		ifTrue: 
+ 			[ self genStorePop: boolean RemoteTemp: byte1 At: byte2 needsStoreCheck: needsStoreCheck.
+ 			self cppIf: IMMUTABILITY ifTrue: [ self annotateBytecode: self Label ] ]
+ 		ifFalse: 
+ 			[ index := byte1 + (extA << 8).
+ 			extA := 0.
+ 			((coInterpreter isWriteMediatedContextInstVarIndex: index) and: [ maybeContext ])
+ 				ifTrue: [ self 
+ 						genStorePop: boolean 
+ 						MaybeContextRemoteInstVar: index 
+ 						ofObjectAt: byte2 - (1 << 7) 
+ 						needsStoreCheck: needsStoreCheck ]
+ 				ifFalse: [ self 
+ 						genStorePop: boolean 
+ 						RemoteInstVar: index 
+ 						ofObjectAt: byte2 - (1 << 7) 
+ 						needsStoreCheck: needsStoreCheck ] ].
+ 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genImmCheckStorePop:MaybeContextSlotIndex:needsStoreCheck: (in category 'bytecode generator support') -----
+ genImmCheckStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck
+ 	<inline: true>
+ 	| jmpSingle jmpDone |
+ 	<var: #jmpSingle type: #'AbstractInstruction *'>
+ 	<var: #jmpDone type: #'AbstractInstruction *'>
+ 	"The reason we need a frame here is that assigning to an inst var of a context may
+ 	 involve wholesale reorganization of stack pages, and the only way to preserve the
+ 	 execution state of an activation in that case is if it has a frame."
+ 	self assert: needsFrame.
+ 	self ssPop: 1.
+ 	self ssAllocateCallReg: ClassReg and: SendNumArgsReg. "for ceStoreContextInstVarTrampoline"
+ 	self ssPush: 1.
+ 	objectRepresentation
+ 		genLoadSlot: SenderIndex
+ 		sourceReg: ReceiverResultReg
+ 		destReg: TempReg.
+ 	self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
+ 	"stack is flushed except maybe ssTop if popBoolean is false.
+ 	  ssTop is a SSregister in this case due to #ssStoreAndReplacePop:
+ 	  to avoid a second indirect read / annotation in case of SSConstant
+ 	  or SSBaseRegister"
+ 	self ssFlushTo: simStackPtr.
+ 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
+ 	self MoveCq: slotIndex R: SendNumArgsReg.
+ 	self CallRT: ceStoreContextInstVarTrampoline.
+ 	jmpDone := self Jump: 0.
+ 	jmpSingle jmpTarget: self Label.
+ 	objectRepresentation 
+ 		genStoreWithImmutabilityCheckSourceReg: ClassReg 
+ 		slotIndex: slotIndex 
+ 		destReg: ReceiverResultReg 
+ 		scratchReg: TempReg 
+ 		needsStoreCheck: needsStoreCheck 
+ 		needRestoreRcvr: true.
+ 	jmpDone jmpTarget: self Label.
+ 	^0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genImmCheckStorePop:slotIndex:destReg:needsStoreCheck:needsRestoreRcvr: (in category 'bytecode generator support') -----
+ genImmCheckStorePop: popBoolean slotIndex: slotIndex destReg: destReg needsStoreCheck: needsStoreCheck needsRestoreRcvr: needsRestoreReceiver
+ 	<inline: true>
+ 	self ssAllocateRequiredReg: ClassReg.
+ 	"we replace the top value for the flush"
+ 	self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
+ 	self ssFlushTo: simStackPtr.
+ 	objectRepresentation 
+ 		genStoreWithImmutabilityCheckSourceReg: ClassReg 
+ 		slotIndex: slotIndex 
+ 		destReg: destReg 
+ 		scratchReg: TempReg 
+ 		needsStoreCheck: needsStoreCheck 
+ 		needRestoreRcvr: needsRestoreReceiver.!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genImmutabilityCheckStorePop:LiteralVariable: (in category 'bytecode generator support') -----
- genImmutabilityCheckStorePop: popBoolean LiteralVariable: litVarIndex
- 	<inline: true>
- 	| association needStoreCheck |
- 	"The only reason we assert needsFrame here is that in a frameless method
- 	 ReceiverResultReg must and does contain only self, but the ceStoreCheck
- 	 trampoline expects the target of the store to be in ReceiverResultReg.  So
- 	 in a frameless method we would have a conflict between the receiver and
- 	 the literal store, unless we we smart enough to realise that ReceiverResultReg
- 	 was unused after the literal variable store, unlikely given that methods
- 	 return self by default."
- 	self assert: needsFrame.
- 	"N.B.  No need to check the stack for references because we generate code for
- 	 literal variable loads that stores the result in a register, deferring only the register push."
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	association := self getLiteral: litVarIndex.
- 	optStatus isReceiverResultRegLive: false.
- 	self ssAllocateRequiredReg: ReceiverResultReg. "for store trampoline call in genStoreSourceReg: has to be ReceiverResultReg"
- 	self genMoveConstant: association R: ReceiverResultReg.
- 	objectRepresentation genEnsureObjInRegNotForwarded: ReceiverResultReg scratchReg: TempReg.
- 	self ssAllocateRequiredReg: ClassReg.
- 	self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
- 	self ssFlushTo: simStackPtr.
- 	objectRepresentation 
- 		genStoreWithImmutabilityCheckSourceReg: ClassReg 
- 		slotIndex: ValueIndex 
- 		destReg: ReceiverResultReg 
- 		scratchReg: TempReg 
- 		needsStoreCheck: needStoreCheck 
- 		needRestoreRcvr: false.
- 	^ 0!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genImmutabilityCheckStorePop:MaybeContextReceiverVariable: (in category 'bytecode generator support') -----
- genImmutabilityCheckStorePop: popBoolean MaybeContextReceiverVariable: slotIndex
- 	<inline: true>
- 	| jmpSingle jmpDone needStoreCheck |
- 	<var: #jmpSingle type: #'AbstractInstruction *'>
- 	<var: #jmpDone type: #'AbstractInstruction *'>
- 	"The reason we need a frame here is that assigning to an inst var of a context may
- 	 involve wholesale reorganization of stack pages, and the only way to preserve the
- 	 execution state of an activation in that case is if it has a frame."
- 	self assert: needsFrame.
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	"Note that ReceiverResultReg remains live after both
- 	 ceStoreContextInstVarTrampoline and ceStoreCheckTrampoline."
- 	self ensureReceiverResultRegContainsSelf.
- 	self ssPop: 1.
- 	self ssAllocateCallReg: ClassReg and: SendNumArgsReg. "for ceStoreContextInstVarTrampoline"
- 	self ssPush: 1.
- 	objectRepresentation
- 		genLoadSlot: SenderIndex
- 		sourceReg: ReceiverResultReg
- 		destReg: TempReg.
- 	self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
- 	"stack is flushed except maybe ssTop if popBoolean is false.
- 	  ssTop is a SSregister in this case due to #ssStoreAndReplacePop:
- 	  to avoid a second indirect read / annotation in case of SSConstant
- 	  or SSBaseRegister"
- 	self ssFlushTo: simStackPtr.
- 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
- 	self MoveCq: slotIndex R: SendNumArgsReg.
- 	self CallRT: ceStoreContextInstVarTrampoline.
- 	jmpDone := self Jump: 0.
- 	jmpSingle jmpTarget: self Label.
- 	objectRepresentation 
- 		genStoreWithImmutabilityCheckSourceReg: ClassReg 
- 		slotIndex: slotIndex 
- 		destReg: ReceiverResultReg 
- 		scratchReg: TempReg 
- 		needsStoreCheck: needStoreCheck 
- 		needRestoreRcvr: true.
- 	jmpDone jmpTarget: self Label.
- 	^0!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genImmutabilityCheckStorePop:ReceiverVariable: (in category 'bytecode generator support') -----
- genImmutabilityCheckStorePop: popBoolean ReceiverVariable: slotIndex
- 	<inline: true>
- 	| needStoreCheck |
- 	self assert: needsFrame. 
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	"Note that ReceiverResultReg remains live after the trampoline."
- 	self ensureReceiverResultRegContainsSelf.
- 	self ssAllocateRequiredReg: ClassReg.
- 	self ssStoreAndReplacePop: popBoolean toReg: ClassReg.
- 	self ssFlushTo: simStackPtr.
- 	objectRepresentation 
- 		genStoreWithImmutabilityCheckSourceReg: ClassReg 
- 		slotIndex: slotIndex 
- 		destReg: ReceiverResultReg 
- 		scratchReg: TempReg 
- 		needsStoreCheck: needStoreCheck 
- 		needRestoreRcvr: true.
- 		
- 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genLoadLiteralVariable:in: (in category 'bytecode generator support') -----
+ genLoadLiteralVariable: litVarIndex in: destReg
+ 	<inline: true>
+ 	| association |
+ 	association := self getLiteral: litVarIndex.
+ 	destReg = ReceiverResultReg ifTrue: [ optStatus isReceiverResultRegLive: false ].
+ 	self ssAllocateRequiredReg: destReg.
+ 	self genMoveConstant: association R: destReg.
+ 	objectRepresentation genEnsureObjInRegNotForwarded: destReg scratchReg: TempReg.!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genLoadUnFwdTemp:in: (in category 'bytecode generator support') -----
+ genLoadUnFwdTemp: objectIndex in: destReg
+ 	destReg = ReceiverResultReg ifTrue: [ optStatus isReceiverResultRegLive: false ].
+ 	self ssAllocateRequiredReg: destReg. 
+ 	self MoveMw: (self frameOffsetOfTemporary: objectIndex) r: FPReg R: destReg.
+ 	objectRepresentation 
+ 		genEnsureOopInRegNotForwarded: destReg 
+ 		scratchReg: TempReg.!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genPushMaybeContextReceiverVariable: (in category 'bytecode generator support') -----
  genPushMaybeContextReceiverVariable: slotIndex 
  	<inline: false>
- 	| jmpSingle jmpDone |
- 	<var: #jmpSingle type: #'AbstractInstruction *'>
- 	<var: #jmpDone type: #'AbstractInstruction *'>
- 	self assert: needsFrame.
  	self ssAllocateCallReg: ReceiverResultReg and: SendNumArgsReg.
  	self ensureReceiverResultRegContainsSelf.
+ 	^ self genPushMaybeContextSlotIndex: slotIndex!
- 	(self register: ReceiverResultReg isInMask: callerSavedRegMask) ifTrue:
- 		["We have no way of reloading ReceiverResultReg since we need the inst var value as the result."
- 		optStatus isReceiverResultRegLive: false].
- 	"See CoInterpreter>>contextInstructionPointer:frame: for an explanation
- 	 of the instruction pointer slot handling."
- 	slotIndex = InstructionPointerIndex ifTrue:
- 		[self MoveCq: slotIndex R: SendNumArgsReg.
- 		 self CallRT: ceFetchContextInstVarTrampoline.
- 		 ^self ssPushRegister: SendNumArgsReg].
- 	objectRepresentation
- 		genLoadSlot: SenderIndex
- 		sourceReg: ReceiverResultReg
- 		destReg: TempReg.
- 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
- 	self MoveCq: slotIndex R: SendNumArgsReg.
- 	self CallRT: ceFetchContextInstVarTrampoline.
- 	jmpDone := self Jump: 0.
- 	jmpSingle jmpTarget: self Label.
- 	objectRepresentation
- 		genLoadSlot: slotIndex
- 		sourceReg: ReceiverResultReg
- 		destReg: SendNumArgsReg.
- 	jmpDone jmpTarget: self Label.
- 	^self ssPushRegister: SendNumArgsReg!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genPushMaybeContextRemoteInstVar:inObjectAt: (in category 'bytecode generator support') -----
+ genPushMaybeContextRemoteInstVar: slotIndex inObjectAt: index
+ 	<inline: false>
+ 	self ssAllocateCallReg: ReceiverResultReg and: SendNumArgsReg.
+ 	self genLoadUnFwdTemp: index in: ReceiverResultReg.
+ 	^ self genPushMaybeContextSlotIndex: slotIndex!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genPushMaybeContextSlotIndex: (in category 'bytecode generator support') -----
+ genPushMaybeContextSlotIndex: slotIndex
+ 	<inline: true>
+ 	"This method expects ReceiverResultReg to hold the object read"
+ 	| jmpSingle jmpDone |
+ 	<var: #jmpSingle type: #'AbstractInstruction *'>
+ 	<var: #jmpDone type: #'AbstractInstruction *'>
+ 	self assert: needsFrame.
+ 	(self register: ReceiverResultReg isInMask: callerSavedRegMask) ifTrue:
+ 		["We have no way of reloading ReceiverResultReg since we need the inst var value as the result."
+ 		optStatus isReceiverResultRegLive: false].
+ 	"See CoInterpreter>>contextInstructionPointer:frame: for an explanation
+ 	 of the instruction pointer slot handling."
+ 	slotIndex = InstructionPointerIndex ifTrue:
+ 		[self MoveCq: slotIndex R: SendNumArgsReg.
+ 		 self CallRT: ceFetchContextInstVarTrampoline.
+ 		 ^self ssPushRegister: SendNumArgsReg].
+ 	objectRepresentation
+ 		genLoadSlot: SenderIndex
+ 		sourceReg: ReceiverResultReg
+ 		destReg: TempReg.
+ 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
+ 	self MoveCq: slotIndex R: SendNumArgsReg.
+ 	self CallRT: ceFetchContextInstVarTrampoline.
+ 	jmpDone := self Jump: 0.
+ 	jmpSingle jmpTarget: self Label.
+ 	objectRepresentation
+ 		genLoadSlot: slotIndex
+ 		sourceReg: ReceiverResultReg
+ 		destReg: SendNumArgsReg.
+ 	jmpDone jmpTarget: self Label.
+ 	^self ssPushRegister: SendNumArgsReg!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genPushRemoteInstVar:inObjectAt: (in category 'bytecode generator support') -----
+ genPushRemoteInstVar: index inObjectAt: objectIndex
+ 	<inline: false>
+ 	| objectReg resultReg |
+ 	self assert: needsFrame.
+ 	objectReg := self allocateRegNotConflictingWith: 0.
+ 	self genLoadUnFwdTemp: objectIndex in: objectReg.
+ 	resultReg := self availableRegOrNoneNotConflictingWith: (self registerMaskFor: objectReg). 
+ 	resultReg = NoReg ifTrue: [resultReg := objectReg].
+ 	objectRepresentation
+ 		genLoadSlot: byte1
+ 		sourceReg: objectReg
+ 		destReg: resultReg.
+ 	^self ssPushRegister: resultReg!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genSistaExtStoreAndPopReceiverVariableBytecode: (in category 'bytecode generators') -----
+ genSistaExtStoreAndPopReceiverVariableBytecode: boolean
+ 	| index needsStoreCheck |
+ 	needsStoreCheck := self sistaNeedsStoreCheck.
+ 	extB := 0.
+ 	index := byte1 + (extA << 8).
+ 	extA := 0.
+ 	^(coInterpreter isWriteMediatedContextInstVarIndex: index)
+ 		ifTrue: [self genStorePop: boolean MaybeContextReceiverVariable: index needsStoreCheck: needsStoreCheck]
+ 		ifFalse: [self genStorePop: boolean ReceiverVariable: index needsStoreCheck: needsStoreCheck]!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genSistaExtStoreLiteralVariableBytecode: (in category 'bytecode generators') -----
+ genSistaExtStoreLiteralVariableBytecode: boolean
+ 	| index needsStoreCheck |
+ 	needsStoreCheck := self sistaNeedsStoreCheck.
+ 	extB := 0.
+ 	index := byte1 + (extA << 8).
+ 	extA := 0.
+ 	^ self genStorePop: boolean LiteralVariable: index needsStoreCheck: needsStoreCheck!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genStorePop:LiteralVariable: (in category 'bytecode generator support') -----
  genStorePop: popBoolean LiteralVariable: litVarIndex
  	<inline: false>
+ 	self genStorePop: popBoolean LiteralVariable: litVarIndex needsStoreCheck: self ssTopNeedsStoreCheck.
+ 	^ 0
- 	self 
- 		cppIf: IMMUTABILITY
- 		ifTrue: [ ^ self genImmutabilityCheckStorePop: popBoolean LiteralVariable: litVarIndex ]
- 		ifFalse: [ ^ self genVanillaStorePop: popBoolean LiteralVariable: litVarIndex ]
  		!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:LiteralVariable:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean LiteralVariable: litVarIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	"We need a frame because the association has to be in ReceiverResultReg for the various trampolines
+ 	and ReceiverResultReg holds only the receiver in frameless methods."
+ 	self assert: needsFrame.
+ 	self genLoadLiteralVariable: litVarIndex in: ReceiverResultReg.
+ 	self 
+ 		genStorePop: popBoolean 
+ 		slotIndex: ValueIndex 
+ 		destReg: ReceiverResultReg
+ 		needsStoreCheck: needsStoreCheck
+ 		needsRestoreRcvr: false.
+ 	^ 0
+ 		!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genStorePop:MaybeContextReceiverVariable: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean MaybeContextReceiverVariable: slotIndex 
- genStorePop: popBoolean MaybeContextReceiverVariable: slotIndex
  	<inline: false>
+ 	self genStorePop: popBoolean MaybeContextReceiverVariable: slotIndex needsStoreCheck: self ssTopNeedsStoreCheck.
+ 	^ 0!
- 	self 
- 		cppIf: IMMUTABILITY
- 		ifTrue: [ ^ self genImmutabilityCheckStorePop: popBoolean MaybeContextReceiverVariable: slotIndex ]
- 		ifFalse: [ ^ self genVanillaStorePop: popBoolean MaybeContextReceiverVariable: slotIndex ]!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:MaybeContextReceiverVariable:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean MaybeContextReceiverVariable: slotIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	"The reason we need a frame here is that assigning to an inst var of a context may
+ 	 involve wholesale reorganization of stack pages, and the only way to preserve the
+ 	 execution state of an activation in that case is if it has a frame."
+ 	self assert: needsFrame.
+ 	self ssFlushUpThroughReceiverVariable: slotIndex.
+ 	self ensureReceiverResultRegContainsSelf.
+ 	self genStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck.
+ 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:MaybeContextRemoteInstVar:ofObjectAt:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean MaybeContextRemoteInstVar: slotIndex ofObjectAt: objectIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	"The reason we need a frame here is that assigning to an inst var of a context may
+ 	 involve wholesale reorganization of stack pages, and the only way to preserve the
+ 	 execution state of an activation in that case is if it has a frame."
+ 	self assert: needsFrame.
+ 	self genLoadUnFwdTemp: objectIndex in: ReceiverResultReg.
+ 	self genStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck.
+ 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:MaybeContextSlotIndex:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck
+ 	<inline: true>
+ 	"This method expects ReceiverResultReg to hold the object to store into. It has to be ReceiverResultReg for the contextINstVarTrampoline"
+ 	self 
+ 		cppIf: IMMUTABILITY
+ 		ifTrue: 
+ 			[ self 
+ 				genImmCheckStorePop: popBoolean 
+ 				MaybeContextSlotIndex: slotIndex 
+ 				needsStoreCheck: needsStoreCheck ]
+ 		ifFalse: 
+ 			[ self 
+ 				genVanillaStorePop: popBoolean 
+ 				MaybeContextSlotIndex: slotIndex 
+ 				needsStoreCheck: needsStoreCheck ].!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genStorePop:ReceiverVariable: (in category 'bytecode generator support') -----
  genStorePop: popBoolean ReceiverVariable: slotIndex
  	<inline: false>
+ 	self genStorePop: popBoolean ReceiverVariable: slotIndex needsStoreCheck: self ssTopNeedsStoreCheck.
+ 	^ 0
- 	self 
- 		cppIf: IMMUTABILITY
- 		ifTrue: [ ^ self genImmutabilityCheckStorePop: popBoolean ReceiverVariable: slotIndex ]
- 		ifFalse: [ ^ self genVanillaStorePop: popBoolean ReceiverVariable: slotIndex ]
  		!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:ReceiverVariable:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean ReceiverVariable: slotIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	self ssFlushUpThroughReceiverVariable: slotIndex.
+ 	self ensureReceiverResultRegContainsSelf.
+ 	self 
+ 		genStorePop: popBoolean 
+ 		slotIndex: slotIndex 
+ 		destReg: ReceiverResultReg 
+ 		needsStoreCheck: needsStoreCheck
+ 		needsRestoreRcvr: true.
+ 	^ 0
+ 		!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:RemoteInstVar:ofObjectAt:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean RemoteInstVar: slotIndex ofObjectAt: objectIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	self assert: needsFrame.
+ 	self genLoadUnFwdTemp: objectIndex in: ReceiverResultReg.
+ 	self 
+ 		genStorePop: popBoolean 
+ 		slotIndex: slotIndex 
+ 		destReg: ReceiverResultReg 
+ 		needsStoreCheck: needsStoreCheck
+ 		needsRestoreRcvr: false.
+ 	^ 0!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>genStorePop:RemoteTemp:At: (in category 'bytecode generator support') -----
  genStorePop: popBoolean RemoteTemp: slotIndex At: remoteTempIndex
  	<inline: false>
+ 	^ self genStorePop: popBoolean RemoteTemp: slotIndex At: remoteTempIndex needsStoreCheck: self ssTopNeedsStoreCheck!
- 	| topReg needStoreCheck |
- 	"The only reason we assert needsFrame here is that in a frameless method
- 	 ReceiverResultReg must and does contain only self, but the ceStoreCheck
- 	 trampoline expects the target of the store to be in ReceiverResultReg.  So
- 	 in a frameless method we would have a conflict between the receiver and
- 	 the temote temp store, unless we we smart enough to realise that
- 	 ReceiverResultReg was unused after the literal variable store, unlikely given
- 	 that methods return self by default."
- 	self assert: needsFrame.
- 	"N.B.  No need to check the stack for references because we generate code for
- 	 remote temp loads that stores the result in a register, deferring only the register push."
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	topReg := self allocateRegForStackEntryAt: 0 notConflictingWith: (self registerMaskFor: ReceiverResultReg).
- 	self ssAllocateRequiredReg: ReceiverResultReg. 
- 	optStatus isReceiverResultRegLive: false.
- 	self ssStoreAndReplacePop: popBoolean toReg: topReg.
- 	self MoveMw: (self frameOffsetOfTemporary: remoteTempIndex) r: FPReg R: ReceiverResultReg.
- 	^objectRepresentation
- 		genStoreSourceReg: topReg
- 		slotIndex: slotIndex
- 		destReg: ReceiverResultReg
- 		scratchReg: TempReg
- 		inFrame: needsFrame
- 		needsStoreCheck: needStoreCheck!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:RemoteTemp:At:needsStoreCheck: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean RemoteTemp: slotIndex At: remoteTempIndex needsStoreCheck: needsStoreCheck
+ 	<inline: false>
+ 	"The only reason we assert needsFrame here is that in a frameless method
+ 	 ReceiverResultReg must and does contain only self, but the ceStoreCheck
+ 	 trampoline expects the target of the store to be in ReceiverResultReg.  So
+ 	 in a frameless method we would have a conflict between the receiver and
+ 	 the temote temp store, unless we we smart enough to realise that
+ 	 ReceiverResultReg was unused after the literal variable store, unlikely given
+ 	 that methods return self by default."
+ 	self assert: needsFrame.
+ 	"N.B.  No need to check the stack for references because we generate code for
+ 	 remote temp loads that stores the result in a register, deferring only the register push."
+ 	self ssAllocateRequiredReg: ReceiverResultReg. 
+ 	optStatus isReceiverResultRegLive: false.
+ 	self MoveMw: (self frameOffsetOfTemporary: remoteTempIndex) r: FPReg R: ReceiverResultReg.
+ 	self genVanillaStorePop: popBoolean slotIndex: slotIndex destReg: ReceiverResultReg needsStoreCheck: needsStoreCheck.
+ 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genStorePop:slotIndex:destReg:needsStoreCheck:needsRestoreRcvr: (in category 'bytecode generator support') -----
+ genStorePop: popBoolean slotIndex: slotIndex destReg: destReg needsStoreCheck: needsStoreCheck needsRestoreRcvr: needsRestoreReceiver
+ 	<inline: true>
+ 	"This method expects destReg to hold the object to store into. In practice, it is almost always RcvrResultReg because it is mandatory for the various store checks. We could put any register there if no store check is needed"
+ 	self 
+ 		cppIf: IMMUTABILITY
+ 		ifTrue: 
+ 			[ self 
+ 				genImmCheckStorePop: popBoolean 
+ 				slotIndex: slotIndex 
+ 				destReg: destReg 
+ 				needsStoreCheck: needsStoreCheck
+ 				needsRestoreRcvr: needsRestoreReceiver ]
+ 		ifFalse: 
+ 			[ self 
+ 				genVanillaStorePop: popBoolean 
+ 				slotIndex: slotIndex 
+ 				destReg: destReg 
+ 				needsStoreCheck: needsStoreCheck ].
+ 		!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genVanillaStorePop:LiteralVariable: (in category 'bytecode generator support') -----
- genVanillaStorePop: popBoolean LiteralVariable: litVarIndex 
- 	<inline: true>
- 	| topReg association needStoreCheck |
- 	"The only reason we assert needsFrame here is that in a frameless method
- 	 ReceiverResultReg must and does contain only self, but the ceStoreCheck
- 	 trampoline expects the target of the store to be in ReceiverResultReg.  So
- 	 in a frameless method we would have a conflict between the receiver and
- 	 the literal store, unless we we smart enough to realise that ReceiverResultReg
- 	 was unused after the literal variable store, unlikely given that methods
- 	 return self by default."
- 	self assert: needsFrame.
- 	"N.B.  No need to check the stack for references because we generate code for
- 	 literal variable loads that stores the result in a register, deferring only the register push."
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	association := self getLiteral: litVarIndex.
- 	optStatus isReceiverResultRegLive: false.
- 	self ssAllocateRequiredReg: ReceiverResultReg. "for ceStoreCheck call in genStoreSourceReg: has to be ReceiverResultReg"
- 	self genMoveConstant: association R: ReceiverResultReg.
- 	objectRepresentation genEnsureObjInRegNotForwarded: ReceiverResultReg scratchReg: TempReg.
- 	topReg := self allocateRegForStackEntryAt: 0 notConflictingWith: (self registerMaskFor: ReceiverResultReg).
- 	self ssStorePop: popBoolean toReg: topReg.
- 	objectRepresentation
- 		genStoreSourceReg: topReg
- 		slotIndex: ValueIndex
- 		destReg: ReceiverResultReg
- 		scratchReg: TempReg
- 		inFrame: needsFrame
- 		needsStoreCheck: needStoreCheck.
- 	^ 0!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genVanillaStorePop:MaybeContextReceiverVariable: (in category 'bytecode generator support') -----
- genVanillaStorePop: popBoolean MaybeContextReceiverVariable: slotIndex
- 	<inline: true>
- 	| jmpSingle jmpDone needStoreCheck |
- 	<var: #jmpSingle type: #'AbstractInstruction *'>
- 	<var: #jmpDone type: #'AbstractInstruction *'>
- 	"The reason we need a frame here is that assigning to an inst var of a context may
- 	 involve wholesale reorganization of stack pages, and the only way to preserve the
- 	 execution state of an activation in that case is if it has a frame."
- 	self assert: needsFrame.
- 	self ssFlushUpThroughReceiverVariable: slotIndex.
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	"Note that ReceiverResultReg remains live after both
- 	 ceStoreContextInstVarTrampoline and ceStoreCheckTrampoline."
- 	self ensureReceiverResultRegContainsSelf.
- 	self ssPop: 1.
- 	self ssAllocateCallReg: ClassReg and: SendNumArgsReg. "for ceStoreContextInstVarTrampoline"
- 	self ssPush: 1.
- 	objectRepresentation
- 		genLoadSlot: SenderIndex
- 		sourceReg: ReceiverResultReg
- 		destReg: TempReg.
- 	self ssStorePop: popBoolean toReg: ClassReg.
- 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
- 	self MoveCq: slotIndex R: SendNumArgsReg.
- 	self CallRT: ceStoreContextInstVarTrampoline.
- 	jmpDone := self Jump: 0.
- 	jmpSingle jmpTarget: self Label.
- 	objectRepresentation
- 		genStoreSourceReg: ClassReg
- 		slotIndex: slotIndex
- 		destReg: ReceiverResultReg
- 		scratchReg: TempReg
- 		inFrame: true
- 		needsStoreCheck: needStoreCheck.
- 	jmpDone jmpTarget: self Label.
- 	
- 	^0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genVanillaStorePop:MaybeContextSlotIndex:needsStoreCheck: (in category 'bytecode generator support') -----
+ genVanillaStorePop: popBoolean MaybeContextSlotIndex: slotIndex needsStoreCheck: needsStoreCheck
+ 	<inline: true>
+ 	| jmpSingle jmpDone |
+ 	<var: #jmpSingle type: #'AbstractInstruction *'>
+ 	<var: #jmpDone type: #'AbstractInstruction *'>
+ 
+ 	self ssPop: 1.
+ 	self ssAllocateCallReg: ClassReg and: SendNumArgsReg. "for ceStoreContextInstVarTrampoline"
+ 	self ssPush: 1.
+ 	objectRepresentation
+ 		genLoadSlot: SenderIndex
+ 		sourceReg: ReceiverResultReg
+ 		destReg: TempReg.
+ 	self ssStorePop: popBoolean toReg: ClassReg.
+ 	jmpSingle := objectRepresentation genJumpNotSmallIntegerInScratchReg: TempReg.
+ 	self MoveCq: slotIndex R: SendNumArgsReg.
+ 	self CallRT: ceStoreContextInstVarTrampoline.
+ 	jmpDone := self Jump: 0.
+ 	jmpSingle jmpTarget: self Label.
+ 	objectRepresentation
+ 		genStoreSourceReg: ClassReg
+ 		slotIndex: slotIndex
+ 		destReg: ReceiverResultReg
+ 		scratchReg: TempReg
+ 		inFrame: true
+ 		needsStoreCheck: needsStoreCheck.
+ 	jmpDone jmpTarget: self Label.
+ 	
+ 	^0!

Item was removed:
- ----- Method: StackToRegisterMappingCogit>>genVanillaStorePop:ReceiverVariable: (in category 'bytecode generator support') -----
- genVanillaStorePop: popBoolean ReceiverVariable: slotIndex 
- 	<inline: true>
- 	| topReg needStoreCheck |
- 	self ssFlushUpThroughReceiverVariable: slotIndex.
- 	needStoreCheck := (objectRepresentation isUnannotatableConstant: self ssTop) not.
- 	"Note that ReceiverResultReg remains live after ceStoreCheckTrampoline."
- 	self ensureReceiverResultRegContainsSelf.
- 	topReg := self allocateRegForStackEntryAt: 0 notConflictingWith: (self registerMaskFor: ReceiverResultReg). 
- 	self ssStorePop: popBoolean toReg: topReg.
- 	objectRepresentation
- 		genStoreSourceReg: topReg
- 		slotIndex: slotIndex
- 		destReg: ReceiverResultReg
- 		scratchReg: TempReg
- 		inFrame: needsFrame
- 		needsStoreCheck: needStoreCheck.
- 	^ 0!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>genVanillaStorePop:slotIndex:destReg:needsStoreCheck: (in category 'bytecode generator support') -----
+ genVanillaStorePop: popBoolean slotIndex: slotIndex destReg: destReg needsStoreCheck: needsStoreCheck
+ 	<inline: true>
+ 	| topReg |
+ 	topReg := self 
+ 		allocateRegForStackEntryAt: 0 
+ 		notConflictingWith: (self registerMaskFor: destReg). 
+ 	self ssStorePop: popBoolean toReg: topReg.
+ 	objectRepresentation
+ 		genStoreSourceReg: topReg
+ 		slotIndex: slotIndex
+ 		destReg: destReg
+ 		scratchReg: TempReg
+ 		inFrame: needsFrame
+ 		needsStoreCheck: needsStoreCheck.!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>sistaNeedsStoreCheck (in category 'bytecode generator support') -----
+ sistaNeedsStoreCheck
+ 	<inline: true>
+ 	"The store check can be ignored if the value assigned doesn't need it (immediate, etc)
+ 	In addition, the extB low bit is marked by the optimizer if the store check is not required"
+ 	^ self ssTopNeedsStoreCheck and: [ self extBSpecifiesNoStoreCheck ]!

Item was added:
+ ----- Method: StackToRegisterMappingCogit>>ssTopNeedsStoreCheck (in category 'bytecode generator support') -----
+ ssTopNeedsStoreCheck
+ 	<inline: true>
+ 	^ (objectRepresentation isUnannotatableConstant: self ssTop) not!



More information about the Vm-dev mailing list