[squeak-dev] The Trunk: Kernel-eem.1444.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Feb 7 12:16:29 UTC 2022

Thank you for the simplification, Eliot! (I would also have done this myself as written in the other thread, but anyway, now it's fixed.) :-)



Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Sonntag, 6. Februar 2022 22:06:45
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: Kernel-eem.1444.mcz

Eliot Miranda uploaded a new version of Kernel to project The Trunk:

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

Name: Kernel-eem.1444
Author: eem
Time: 6 February 2022, 1:06:19.372648 pm
UUID: fcc28469-65a2-463c-aafe-34de0816a2c2
Ancestors: Kernel-mt.1443

Fi Context>>send:to:with:lookupIn:.  The contract for object-as-method is not that the VM expects instances of CompiledBlock and CompiledMethod, but any general instance of CompiledCode.  So implement isCompiledCodeClass and use this on the class of the method.

Tiny speedup/simplification for MessageSend class>>#receiver:selector:argument:

=============== Diff against Kernel-mt.1443 ===============

Item was added:
+ ----- Method: CompiledCode class>>isCompiledCodeClass (in category 'testing') -----
+ isCompiledCodeClass
+        ^true!

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 methClass 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].

+        (self objectClass: meth) isCompiledCodeClass ifFalse:
-        ((methClass := self objectClass: meth) == CompiledMethod or: [methClass == CompiledBlock]) 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:

         ctxt := self activateMethod: meth withArgs: arguments receiver: rcvr.
         (primIndex isInteger and: [primIndex > 0]) ifTrue:
                 [ctxt failPrimitiveWith: val].


Item was changed:
  ----- Method: MessageSend class>>receiver:selector:argument: (in category 'instance creation') -----
  receiver: anObject selector: aSymbol argument: aParameter
+        ^self receiver: anObject selector: aSymbol arguments: { aParameter }!
-        ^ self receiver: anObject selector: aSymbol arguments: (Array with: aParameter)!

Item was added:
+ ----- Method: Object>>isCompiledCodeClass (in category 'testing') -----
+ isCompiledCodeClass
+        ^false!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220207/6a8a142d/attachment.html>

More information about the Squeak-dev mailing list