[Vm-dev] VM Maker: VMMaker.oscog-rmacnak.1442.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Aug 22 23:30:09 UTC 2015


Ryan Macnak uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-rmacnak.1442.mcz

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

Name: VMMaker.oscog-rmacnak.1442
Author: rmacnak
Time: 22 August 2015, 4:28:54.585 pm
UUID: f34e246e-855a-4049-bcc7-76440e7a5e54
Ancestors: VMMaker.oscog-eem.1441

The actual receiver of an MNU from an outer send is not necessarily the method receiver.

=============== Diff against VMMaker.oscog-eem.1441 ===============

Item was changed:
  ----- Method: CoInterpreter>>ceOuterSend:receiver: (in category 'trampolines') -----
  ceOuterSend: cacheAddress receiver: methodReceiver
  	"An outer send cache missed."
  	| nsSendCache depth methodReceiverClassTag cogMethod errSelIdx |
  	<api>
  	<option: #NewspeakVM>
  	<inline: false>
  	<var: #nsSendCache type: #'NSSendCache *'>
  	<var: #cogMethod type: #'CogMethod *'>
  
  	cogit assertCStackWellAligned.
  	self assert: (objectMemory addressCouldBeOop: methodReceiver).
  	self deny: (objectMemory isOopForwarded: methodReceiver).
  
  	nsSendCache := self cCoerceSimple: cacheAddress to: #'NSSendCache *'.
  	messageSelector := nsSendCache selector.
  	argumentCount := nsSendCache numArgs.
  	depth := nsSendCache depth.
  	method := (self mframeHomeMethod: framePointer) methodObject.
  
  	self assert: (self stackValue: argumentCount + 1 "ret addr") = methodReceiver.
  
  	methodReceiverClassTag := objectMemory fetchClassTagOf: methodReceiver.
  
  	(self
  		inlineLookupInNSMethodCacheSel: messageSelector
  		classTag: methodReceiverClassTag
  		method: method
  		lookupRule: depth)
  			ifTrue:
  				[localAbsentReceiverOrZero = 0
  					ifTrue: [localAbsentReceiver := methodReceiver]
  					ifFalse: [localAbsentReceiver := localAbsentReceiverOrZero].
  				"check for coggability because method is in the cache"
  				self ifAppropriateCompileToNativeCode: newMethod selector: messageSelector]
  			ifFalse:
  				[self deny: (objectMemory isOopForwarded: messageSelector).
  				self deny: (objectMemory isForwardedClassTag: methodReceiverClassTag).
+ 				lkupClassTag := methodReceiverClassTag. "Successful lookup cached under the sender's class"
- 				lkupClassTag := methodReceiverClassTag.
  				errSelIdx := self lookupOuterSendNoMNU: methodReceiver depth: depth.
  				errSelIdx ~= 0 ifTrue:
  					[self assert: errSelIdx == SelectorDoesNotUnderstand.
+ 					"Fix stacked receiver."
+ 					self stackValue: argumentCount + 1 "ret addr" put: localAbsentReceiver.
+ 					"Failed lookup continues with the enclosing object's class"
+ 					lkupClassTag := objectMemory classForClassTag: localAbsentReceiver.
  					self handleMNU: errSelIdx 
+ 						InMachineCodeTo: localAbsentReceiver
+ 						classForMessage: lkupClassTag.
- 						InMachineCodeTo: methodReceiver
- 						classForMessage: (objectMemory classForClassTag: methodReceiverClassTag).
  					self unreachable].
  				self addNewMethodToNSCache: depth].
  
  	"Fix stacked receiver."
  	self stackValue: argumentCount + 1 "ret addr" put: localAbsentReceiver.
  
  	(self maybeMethodHasCogMethod: newMethod) 
  		ifTrue: [
  			cogMethod := self cogMethodOf: newMethod.
  			cogMethod selector = objectMemory nilObject
  				ifTrue: [cogit setSelectorOf: cogMethod to: messageSelector]
  				ifFalse: ["Deal with anonymous accessors, e.g. in Newspeak.
  					The cogMethod may not have the
  					correct selector. If not, try and compile a new method
  					with the correct selector."
  					cogMethod selector ~= messageSelector ifTrue: [
  							(cogit cog: newMethod selector: messageSelector)
  								ifNotNil: [:newCogMethod | cogMethod := newCogMethod]]].
  			cogMethod selector = messageSelector
  				ifTrue:
  					[cogit
  						linkNSSendCache: nsSendCache 
  						classTag: methodReceiverClassTag
  						enclosingObject: localAbsentReceiverOrZero
  						target: cogMethod
  						caller: self mframeHomeMethodExport]
  				ifFalse: ["Out of code memory. Fall through to interpret."].
  			instructionPointer := self popStack.
  			self executeNewMethod.
  			self unreachable].
  	instructionPointer := self popStack.
  	self interpretMethodFromMachineCode.
  	self unreachable.!



More information about the Vm-dev mailing list