Question on Objective-C Runtime(s)

Hi All,

This is my first posting to this list and I had some questions. I've
been attempting to read some of the archives and it appears that there
are a number of runtimes for Objective-C - the Apple runtime, GNU
runtime, and the one used by Etoile (developed by David Chisnall I
think). From what I read each has it's own possible benefits and
drawbacks, but reading this post by Chisnall on the Etoile blog:
http://etoileos.com/news/archive/2008/05/12/1719/ makes it appear that
his is a significant improvement over the GNU runtime.

Can anyone let me know what the various differences between the
runtime environments are. Also are there any plans to favor on over
another (or incorporate features from one to another)?

Thank you kindly for your time,
Gregory Gelfond

Hi Gregory,

Apple has two and a half runtimes, and these are the default (and only) ones that are supported on OS X, but aren't used anywhere else and I don't believe anyone has expressed an interest in porting them elsewhere. If you are using Objective-C on OS X you will almost certainly want to use these (none of them are binary-compatible, so if you use a non-Apple runtime you can't use any of the Cocoa frameworks).

The GNU one has been rewritten a few times, and is a now good implementation of '80s ideas. This is more-or-less supported by clang (if you find any bugs, let me know. I suspect there is a bug in handling of message sends to super in a few corner cases from my memory of the code, but I haven't looked to see if any of the refactoring by others has fixed it). Last time I checked, clang could almost compile GNUstep (open source implementation of OpenStep) targeting the GNU runtime, with a few errors coming from some horrendous abuses of GCC extensions in some ancient GNUstep code that no one has look at since GCC 2 was state of the art.

The Étoilé runtime will, eventually, be used by Étoilé and hopefully GNUstep. I wrote a partial implementation of the back end for supporting it with clang, but the interfaces changed and it wasn't updated. At some point in the next six months I hope to revisit this and get it working again. In order for it to actually be useful, a few bits of the Foundation library need to be rewritten (parts of NSObject, NS*ExtraRefCount and so on), so this isn't a trivial task, but hopefully some time before Étoilé 0.7 we will have a break-the-world release and switch from the GNU runtime.

Each runtime interface is implemented by a separate subclass of CGObjCRuntime. This makes it very easy to support new runtime systems in the future. One thing I'd like to play with, for example, is using clang to target Flash, and use the native object model in the ActionScript VM to implement Objective-C objects.

David