18 Commits (1f038ca48949c0ec1a3b77ad2b2b3874412de916)

Author SHA1 Message Date
David Chisnall 1991b12355 Fix the `instance_size` field for upgraded classes.
The instance size was being reported incorrectly which meant that
associated objects looked for a reference list slightly after the end of
the object.

Fixes #228
3 years ago
David Chisnall 375018a933 Fix upgrading legacy properties with qualifiers.
This fixes PropertyIntrospectionTest2_arc with the 1.x ABI and enables
the test that was disabled in this mode.
7 years ago
David Chisnall 1d164676a5 Rework ivar offset calculation again.
It's now simpler, and the tests pass on several different targets, so
it's probably even correct!
8 years ago
David Chisnall 38efd04e33 Fix some bugs in protocol upgrading from old ABIs.
Reported by Riccardo Mottola!
8 years ago
David Chisnall 0f1385e1b1 Correctly upgrade categories.
This was hidden by a compiler bug where the new version was generated in
the same format as the old, so upgrading in the wrong place worked.
8 years ago
David Chisnall aba97e11b4 Fix ivar_ownership type name. 8 years ago
David Chisnall 67cf43c5a2 Add support for class properties in protocols. 8 years ago
David Chisnall c0f56a75a0 Modify ivar flags.
Add a flag to indicate that instance variables have an extended type
encoding.

Remove the alignment field and replace it with 6 bits from the flags
field.  We only support power of two alignments, so we may as well store
them in log form, which means we can save a field.  Note that this
doesn't actually save us any space except on 32-bit platforms, because
alignment means that we end up with extra padding at the end of the
struct.
8 years ago
David Chisnall 4036a88936 Remove separate flags for class and metaclass.
Every class is either a class or a metaclass, it doesn't make sense to
use two flags to store one bit of data.

Also remove the newabi flag from classes in the v2 ABI, where it's
redundant.
8 years ago
David Chisnall 64ab2d51f5 Rename legacy types.
For consistency, each now has a `_gcc` or `_gsv1` suffix indicating
whether they were inherited from the GCC or GNUstep v1 ABI.
8 years ago
David Chisnall ab84589b5d Improve protocol method metadata.
Methods now include a selector and extended type encoding, rather than a
method name and lgacy type encoding.  Older ones are auto-upgraded.

Expose the extended type encoding via a function that JavaScriptCore
expects to exist.
8 years ago
David Chisnall 65b34a196f Add support for improved property structure.
As a side effect, we need to upgrade properties in class and protocols
(but not categories because we didn't have class properties in earlier
ABIs).
8 years ago
David Chisnall a9a2ed6b10 Refactor to use `objc_method` as the slot.
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.
8 years ago
David Chisnall 0964d63ba9 Update for the compiler / linker setting up superclass pointers.
In the legact ABI, superclass pointers are initially set to strings
containing the superclass name and the runtime fixes them up.  In the
new ABI, the compiler sets up the linkage directly.
8 years ago
David Chisnall 44a85a401a Add size to the property list.
It should now be possible to support newer ABIs.
8 years ago
David Chisnall 80a02b3b79 Add a size field to the method list. 8 years ago
David Chisnall 5b0f05e6e0 Fix ivar offset calculation with alignment.
When upgrading legacy ivars, pick a sensible guess.
When calculating ivar offsets, use the supplied alignment.
8 years ago
David Chisnall f91fb2e745 Checkpoint more work on new ABI.
We're now using a new class and category structure and auto-upgrading the old ones.  Other changes:

- The Ivar structure now points to the ivar offset variable, so we can more easily find it.
- Categories can now add properties.
8 years ago