[Cuis-dev] Error performing advised methods

Juan Vuletich juan at cuis.st
Fri Jan 13 07:36:09 PST 2023


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,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list