discuss-gnustep
[Top][All Lists]
Advanced

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

Re: LLVM


From: David Chisnall
Subject: Re: LLVM
Date: Mon, 3 Mar 2008 14:04:44 +0000

On 3 Mar 2008, at 12:56, Richard Frith-Macdonald wrote:

I'd love to see support for your runtime in GNUstep (happy to add patches to gnustep-base to allow that).

Good to hear :-)

However, it's not clear to me how that can be achieved using gcc ... since I was under the impression that your runtime was sufficiently different in behavior that it would need quite a bit of compiler support changes.

The behaviour isn't horrendously different. The biggest difference is in terms of message lookup. I require the sender (can be nil for messages sent from non-objects) to be available. It also returns a slot structure, rather than an IMP, allowing the IMP to be cached and check that it is still valid cheaply. Most of the more advanced features (late-bound ivar access and so on) are optional.

I completely understand your reluctance to work on gcc ... I've tried to hack gcc code in the past and found it pretty incomprehensible myself ... but would still advocate making the effort if possible (certainly, if you had gcc fixes to use your runtime to support objc-2.0 features I'd be keen to help lobby to get those changes into gcc). I would have hoped that Apples objc-2.0 contributions to the compiler would make it relatively easy to add support for objc-2.0 using your runtime ... you wouldn't have to start hacking gcc from scratch.

I had a look at the GCC code and it just made my brain hurt. I have a file in my runtime (capi.h) which includes C versions of most of the Objective-C language constructs, so it should be easy for anyone familiar with GCC to add support for it. I would be more than willing to help anyone interested in doing this.

More advanced features (e.g. run-time inlining of methods) are only possible with a more modern compiler infrastructure, however. Unless the GCC team radically update their approach it will never be possible, but we can still get relatively good performance.

I feel we need to try to get objc-2.0 for gnustep, but if we do that by using a less widely available compiler we'll have to somehow try to keep support for people who need to use gcc with the current gnu runtime and that would probably be difficult. That wouldn't stop me going ahead and incorporating objc-2.0 features using LLVM though.

I would not recommend using Objective-C 2.0 features in GNUstep itself unless absolutely necessary. I think GNUstep should aim for the widest possible compatibility, which means running on old platforms with limited features but supporting new platforms with newer features if they are available. We will probably switch Étoilé to using my runtime as soon as possible because certain features we want for CoreObject are simply not possible with the GNU runtime (even with my heavily patched version).

To be honest, most of the features of Objective-C 2.0 are either syntactic sugar, or so completely brain-dead I can't imagine anyone actually wanting to use them. Garbage collection might be nice, and this is much easier to do with LLVM than GCC since it was designed with support for garbage collected languages in mind (and allows mixing multiple GC strategies on a per-function basis).

David



reply via email to

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