|
From: | David Chisnall |
Subject: | GNUstep Objective-C v2 ABI update |
Date: | Mon, 31 Dec 2018 11:34:05 +0000 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 |
Hello the list,It seems that Christmas is about the only time I get to work on Objective-C things these days. I started the new ABI project two Christmases ago and this Christmas I've managed to update all of the FreeBSD GNUstep ports to use it. As far as I can tell, everything is working (I've tried running a few GUI apps and everything seemed happy).
A few highlights of the new ABI:- A new constant string representation, including space to store a hash and better unicode support. This should improve performance for anything that uses constant strings as dictionary keys. The compiler will now emit tiny strings (up to 8 ASCII characters) embedded in the pointer.
- Better introspection metadata. We now have full introspection metadata for properties (including class properties and properties declared in categories) and the extended type encodings that JavaScriptCore (WebKit) needs for the JavaScript bridge.
- Significantly reduced redundancy for selectors and protocols. The linker can now deduplicate these within a library, so we get (for example) one copy of the +alloc selector per library, not one per compilation unit. This means that we have significantly smaller (5-10%) binary sizes, even with the richer reflection metadata.
- Protocols and classes are referenced via an indirection layer, so a future version of the ABI can be backwards compatible.
- @private and @package are now enforced by the linker. You cannot refer to a @package or @private ivar from a different library. This means that, aside from reflection, @package and @private ivars are not part of the public ABI and can be removed without breaking any code that does not use reflection.
The Windows version still has a few rough corners to iron out. On Windows, a DLL cannot contain a global initialised to be a pointer to a global in another library. This is normally not a bad thing, because it enforces modularity, but it does mean that Objective-C classes, for example, can't be statically initialised to point to their superclasses (though we can emit code that does this). Dustin has some patches for clang that should fix these issues.
I've pushed patches to -base to support the new string representation and to Gorm to make it use reflection instead of directly accessing ivars in -gui classes. I also have a patch to Pantomime that prevents it from doing the same.
David
[Prev in Thread] | Current Thread | [Next in Thread] |