This was used with an old LLVM pass to perform speculative inlining. It
is no longer maintained and this code hasn't been tested at all for
years or with nontrivial examples ever.
This change set incorporates a number of changes that all needed to
happen together:
* The imp is now the first field of the `objc_method` structure. This
makes it possible to extend the structure without breaking anything
that relies on being able to access the IMP.
* There is no owner in the slot, so we must use other mechanisms for
determining the owner of a method (e.g. whether the same method appears
in the superclass)
* Again, because there is no owner in the slot, we can't use this as a
fast path for finding the C++ construct / destruct methods. These are
now cached in the class structure when they are found.
* The version field is gone from the slot and now we provide a global
version. This is based on the observation that method replacements
are relatively infrequent and the overhead of invalidating all method
caches is cheaper than adding extra state for every (class, method)
pair.
* A number of the runtime functions are simplified because replacing
the IMP in a `Method` now implicitly updates the dtable.
at the start of the structure, making it easier to change the layout in
the future.
Also clean up the growth of various fields and consolidate some of the
metadata into a pointer to the `struct objc_method`.
- __strong pointers, preventing objects from being freed
_ __weak pointers are automatically freed when the last remaining __strong pointer goes away
- objc_gc_{retain,release}_np() functions, which can be used to implement CFRetain() and CFRelease() (adds an reference count - the object will not be collected until after its last retain is gone.
The runtime was handling the message lookup correctly in this case, but only as a side-effect of the fallback code from when type-dependent dispatch is not possible. This resulted in a confusing warning message, telling you that you were calling a method with an incorrect signature, when the two signatures that it printed were the same.
This case is now handled correctly, so the warning disappears (unless you really are calling a method with the wrong signature and have TDD enabled).
Removed GNU dtable and sparse array implementations, replaced entirely now with versions based on the Étoilé runtime. Performance is roughly equivalent in microbenchmarks, memory usage is significantly lower (Gorm goes from 95MB to 50MB on my machine - this will be even more pronounced on 64-bit systems), which should improve cache usage considerably. Still room for some performance tuning, however.
I now have an out-of-tree replacement for the dtable stuff, so sarray.{h,c} will be going away soon. The replacement offers similar (slightly worse currently) performance in microbenchmarks, but uses half as much memory (Gorm goes from 95MB to 48MB on my machine). This will be committed once it's been tweaked a little bit.
- nil_method now returns 0, not receiver.
- Metaclasses actually get their dtables installed with the new ABI. For some reason this wasn't being done, so class messages didn't work with the new ABI. Now they do and (at least some) nontrivial programs work.
- Undid commenting out of the code setting the fast ivar access pointers. I can't remember why this was commented out, but it seems not to break anything. I have an LLVM pass that makes compiled code access these pointers, but it's not committed yet.