discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about message forwarding (with fix)


From: Truls Becken
Subject: Re: Question about message forwarding (with fix)
Date: Fri, 3 Apr 2009 12:50:29 +0200

 David Chisnall wrote:

> On 3 Apr 2009, at 00:36, David Ayers wrote:
>
>> Is there a GCC/libobjc bug report and/or test case for this?  [I tried
>> looking for one and found some low hanging fruit while at it... but I
>> didn't come up with anything]
>
> Not sure.  We encountered most of these issues when working on supporting
> prototypes for EScript (ECMAScript-like language for Étoilé).  Truls filed a
> bug report somewhere, but I think it may have been against GNUstep rather
> than GCC.

The bug report mentioned here was not related to the uniqueness of
selectors, and should not matter to the issues in this thread. It was
about the string pointer to the selector name changing unnecessarily.


Larry Campbell wrote:

> I found that this patch to GSFFIInvocation.m (in gnustep-base 1.18.0)
> fixes the problem:
>
> --- GSFFIInvocation.m~  2008-12-19 04:06:14.000000000 -0500
> +++ GSFFIInvocation.m   2009-04-02 16:43:24.000000000 -0400
> @@ -159,7 +159,7 @@
>         get the right one, though. What to do then? Perhaps it can be fixed
> up
>         in the callback, but only under limited circumstances.
>       */
> -      sel_type = sel_get_type (sel);
> +      sel_type = sel_get_type (gs_find_best_typed_sel(sel));
>      if (sel_type)
>        {
>          sig = [NSMethodSignature signatureWithObjCTypes: sel_type];
>
> The problem is that selectors aren't necessarily unique, and that selectors
> can exist with no type information; if the FFI forwarding mechanism latches
> onto one with no type information, it messes up the argument passing, and
> boom. The fix is to find a selector with type information, if one exists. If
> more than one exists you might still lose, but at least you're not
> guaranteed to lose any more.

I'm wondering where sel comes from in the first place because that may
very well be the real cause of the problem. If it is fetched using
sel_get_uid(a_name) then it will *always* be untyped.

But since this is about message forwarding, shouldn't it just use _cmd ?
I would hope that gives the correctly typed selector!

-Truls




reply via email to

[Prev in Thread] Current Thread [Next in Thread]