[Cuis-dev] Error performing advised methods

Mariano Montone marianomontone at gmail.com
Fri Jan 13 07:49:13 PST 2023


Yes. Reverting the perform: method to its previous version solves the issue.

El 13/1/23 a las 12:36, Juan Vuletich escribió:
> On 1/13/2023 11:51 AM, Mariano Montone via Cuis-dev wrote:
>> El 13/1/23 a las 11:11, Mariano Montone escribió:
>>> Hi,
>>>
>>> There's an error with AdvisedMethod's implementation I would like to 
>>> fix.
>>>
>>> When installing an AdvisedMethod, an error is signaled if the method 
>>> tries to be performed (calling #perform:), instead of called directly.
>>>
>>> I mean: myObject myAdvisedMethod, works. But: myObject perform: 
>>> #myAdvisedMethod, doesn't.
>>>
>>> The error says: 'bad number of arguments' when calling the primitive 
>>> in #perform: (primitive nr. 83).
>>>
>>> AdvisedMethods are implemented like this:
>>>
>>> AdvisedMethod is a subclass of Object that implements #run: 
>>> aSelector with: arguments in: aReceiver .
>>>
>>> To advise a method, the CompiledMethod instance at method selector 
>>> in the class method dictionary is replaced by an instance of 
>>> AdvisedMethod.
>>>
>>> Any ideas of what you think the problem is, possible fixes or things 
>>> I could try are welcomed.
>>>
>>> Thanks!
>>>
>>>
>>>         Mariano
>>>
>> I've tested in old images now, and this works there.
>>
>>
>> This used to work when the #perform: implemented like this:
>>
>>
>> perform: arg1
>> <primitive: 83>
>>     ^ self
>>         perform: arg1
>>         withArguments: (Array new: 0).
>>
>
> Hi Mariano,
>
> This was done in #5588, but it is actually not needed at all.
>
> Is going back to that implementation enough to fix the issues you 
> found? If so, let's do it.
>
> Thanks,
>



More information about the Cuis-dev mailing list