This is the mail archive of the
mailing list for the GCC project.
Re: GNU ObjC runtime class table rewritten
- To: n dot pero at mi dot flashnet dot it
- Subject: Re: GNU ObjC runtime class table rewritten
- From: Stan Shebs <shebs at apple dot com>
- Date: Tue, 29 May 2001 15:48:56 -0700
- CC: Ovidiu Predescu <ovidiu at cup dot hp dot com>, gcc-patches at gcc dot gnu dot org
- References: <firstname.lastname@example.org.HOWL>
Nicola Pero wrote:
> The long-term solution to this problem would be to modify the compiler
> to output tables of class pointers corresponding to all the class
> method invocations, and to add code to the runtime to update these
> tables - that should in the end allow class method invocations to
> perform precisely as fast as instance method invocations, because no
> class lookup would be involved. I think the Apple Objective-C runtime
> uses this technique. Doing this involves synchronized modifications
> in the runtime and in the compiler. I have not yet looked at doing
That's right. It would probably take a little cooperation from
> I took a more direct approach - I studied the way the runtime was
> performing class lookup, and I thought - hey, I can write code which
> does the same, but faster. :-)
> So - I have redesigned and rewritten the class table in the GNU
> Objective-C runtime to be faster (it took me four days in total I
> think). This doesn't give as much speed as the other approach, but a
> class method invocation now takes approximately 4.5 times an instance
> method invocation on my machine. That's a considerable improvement
> (it means the core class lookup now takes 1/3 of the original time).
This is great! One of the advantages is that it's still compatible
with code compiled using the existing runtime. There's not so many
ObjC libraries out there that this is a big issue currently, but
> So - here is the new code.
This looks pretty good to me. I would ask for one change before
putting it into the trunk - you have some very informative discussion
in your message, but it's not reflected in the code. The chances are
that the next person to look at this code will not know about your
mail message. So what I ask is that you take the details in your
message, cast them into an appropriate form for a comment block at
the top of class.c, and resubmit - I'll take that version and
install it as the new class.c in the trunk.
Thanks for working on this BTW, the numbers are very exciting!