[squeak-dev] The Trunk: Kernel-ct.1425.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Nov 25 11:09:59 UTC 2021


Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1425.mcz

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

Name: Kernel-ct.1425
Author: ct
Time: 25 November 2021, 12:09:56.072633 pm
UUID: 79791158-a822-1642-ade5-514751d0a407
Ancestors: Kernel-ct.1358, Kernel-mt.1424

Fixes simulation of sending #doesNotUnderstand:. See ContextTest >> #testRecursiveMessageNotUnderstood (KernelTests-ct.410).

This revises the implementation from Kernel-eem.1359 which still caused a superfluous simulator error even before #doesNotUnderstand: could arrive at ProtoObject. Also, we now do not hard-code #ProtoObject any longer in the simulator.

Merges Kernel-ct.1358.

=============== Diff against Kernel-mt.1424 ===============

Item was changed:
  ----- Method: Context>>send:to:with:lookupIn: (in category 'controlling') -----
  send: selector to: rcvr with: arguments lookupIn: lookupClass
  	"Simulate the action of sending a message with selector and arguments to rcvr. The argument, lookupClass, is the class in which to lookup the message. This is the receiver's class for normal messages, but for super messages it will be some specific class related to the source method."
  
  	| meth primIndex val ctxt |
  	(meth := lookupClass lookupSelector: selector) ifNil:
  		[selector == #doesNotUnderstand: ifTrue:
  			[self error: 'Recursive message not understood!!' translated].
  		^self send: #doesNotUnderstand:
  				to: rcvr
  				with: {(Message selector: selector arguments: arguments) lookupClass: lookupClass}
  				lookupIn: lookupClass].
  	
  	meth isCompiledMethod ifFalse:
  		["Object as Methods (OaM) protocol: 'The contract is that, when the VM encounters an ordinary object (rather than a compiled method) in the method dictionary during lookup, it sends it the special selector #run:with:in: providing the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.2991062."
  		^self send: #run:with:in:
  			to: meth
  			with: {selector. arguments. rcvr}].
  	
  	meth numArgs = arguments size ifFalse:
  		[^ self error: ('Wrong number of arguments in simulated message {1}' translated format: {selector})].
  	(primIndex := meth primitive) > 0 ifTrue:
  		[val := self doPrimitive: primIndex method: meth receiver: rcvr args: arguments.
  		(self isPrimFailToken: val) ifFalse:
  			[^val]].
  	
- 	(selector == #doesNotUnderstand: and: [lookupClass == ProtoObject]) ifTrue:
- 		[^self error: ('Simulated message {1} not understood' translated format: {arguments first selector})].
- 	
  	ctxt := Context sender: self receiver: rcvr method: meth arguments: arguments.
  	(primIndex isInteger and: [primIndex > 0]) ifTrue:
  		[ctxt failPrimitiveWith: val].
  	
  	^ctxt!



More information about the Squeak-dev mailing list