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

Marcel Taeumel marcel.taeumel at hpi.de
Fri Dec 31 08:14:04 UTC 2021

> Instead use this pattern:(self objectClass: meth) isCompiledCodeClass


> But do you *really* need to deal with proxies here?  If not, then *please* revert to the simple and rational meth isCompiledCode.


Am 30.12.2021 20:01:54 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
Hi Christoph,

On Tue, Dec 28, 2021 at 12:13 PM <commits at source.squeak.org [mailto:commits at source.squeak.org]> wrote:

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

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

Name: Kernel-ct.1438
Author: ct
Time: 28 December 2021, 9:13:10.136249 pm
UUID: 0477e714-e01d-d34d-b6aa-0939494a4abc
Ancestors: Kernel-mt.1437, Kernel-ct.1403

Merges Kernel-ct.1403 (fixes simulation of dynamic-forwarding objects as methods).

=============== Diff against Kernel-mt.1437 ===============

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 methClass primIndex val ctxt |
-       | 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].

+       ((methClass := self objectClass: meth) == CompiledMethod or: [methClass == CompiledBlock]) ifFalse:

Again this  cannot be allowed to stand.  It prevents adding subclasses of CompiledMethod & CompiledBlock, which is definitely something one would want to allow.  Instead use this pattern:

   (self objectClass: meth) isCompiledCodeClass

But do you *really* need to deal with proxies here?  If not, then *please* revert to the simple and rational meth isCompiledCode.

Remember you can always have overrides for your own project,  You don't need to inflict these special cases on the community code base (until they're fully justified).  For example, in Virtend (which used to be called Terf) we have several packages we load on top of Squeak 5.3, TerfExtensions-Kernel, TerfExtensions-Collections ,etc.  By organising like this we keep related changes organised by package and we don't have to disturb 5.3.

-       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:

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




best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211231/b1fe9232/attachment.html>

More information about the Squeak-dev mailing list