1057 Commits (0f1385e1b1af49346aac95d8fa81f1c2790bc547)
 

Author SHA1 Message Date
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 d11a0311e0 Add checks to prevent mixing incompatible ABI versions. 8 years ago
David Chisnall b81df02b91 Merge branch 'master' into newabi
Simplify the setSubclass dtable updating mechanism.
8 years ago
David Chisnall 8021533d4c Don't allocate objects of size 0.
There's nowhere for the class pointer, so there's nothing that you can
do with them.
8 years ago
David Chisnall 2bdf85ee50 Add missing isa pointer.
This test was accidentally passing sometimes, with the isa pointer being
set using some bit of memory in inter-object padding.  This breaks
horribly with an allocator that packs objects densely.
8 years ago
David Chisnall a4f97f7563 Refactor locking in setSuperclass.
Now all lock ownership is tied to scopes, so will be released correctly
in all return paths.
8 years ago
David Chisnall 00d23b0013 Fix LOCK_SCOPE to allow multiple locks per scope. 8 years ago
davidchisnall fd526bc31f
Merge pull request #70 from Microsoft/css_deadlock
Let go of the runtime lock properly in class_setSuperclass
8 years ago
Dustin Howett d32bafc6e1 Let go of the runtime lock properly in class_setSuperclass 8 years ago
Jason Barmparesos 682717b08d Clang++ provides its own exception types on Linux. (#68)
Fix type of `__cxa_allocate_exception` with recent libsupc++.

Recent versions of GNU libsupc++ provide a definition of `__cxa_allocate_exception` that has a `noexcept` qualifier.  This is sensible (if allocating an exception throws an exception, then something is badly wrong) but it not what the ABI spec says.  We provide our own definition of this, which must match another if provided.

This wouldn't normally be a problem, but recent libstdc++ headers appear to leak libsupc++ headers into the namespace, so we're seeing these definitions even without explicitly including any C++ ABI-related headers.
8 years ago
David Chisnall c50db7b1fe Remove debug log message. 8 years ago
David Chisnall 6c9edcb510 Support new NSConstantString format and update tests. 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 040114dff1 Remove some obsolete documentation. 8 years ago
David Chisnall c1391b5079 Add test for class property in category. 8 years ago
David Chisnall aba7e406ff Add test for class properties. 8 years ago
David Chisnall bfe9475204 Add constant string test. 8 years ago
David Chisnall 4891eb9d5f Document a bit more of class structure and of type encodings. 8 years ago
David Chisnall b51e9e9c4c Add method markers. 8 years ago
David Chisnall 48bae5879e Finish documenting instance variables. 8 years ago
David Chisnall 7c4711c141 Add some more documentation. 8 years ago
David Chisnall 41f33508aa Whitespace. 8 years ago
David Chisnall 11637010ad Rename method_list.h to method.h
Work around the fact that LaTeX really doesn't like file names with
underscores...
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 ccefff241a Update obsolete comment. 8 years ago
David Chisnall 20b016c47b Reserve some class flag bits.
These are free for the compiler to be able to use in future ABI
versions.
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 c4ff744620 Audit the runtime for direct access to variable-sized arrays.
Several of the structures now end with an array of structures that may
have other fields added to them that the runtime doesn't know about yet
by a compiler.  Rather than indexing into them directly, we must call an
accessor to find the correct address.

A few of the places where accesses were replaced were in functions where
it is safe because they only deal with versions of the structures that
are dynamically allocated (and will therefore have the correct size).
This was done to simplify future auditing: these fields should be
accessed directly only from the accessor functions in the header and
from the upgraders (currently in legacy.c).

Also fix a few bugs where the sizes weren't being filled in.
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 48967e58f3 Add missing file. 8 years ago
David Chisnall 5148d043d8 Add a test for weak import. 8 years ago
David Chisnall ee1c6ad661 Fix inefficient ivar offset allocation. 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 b7ef58bc59 Look up the class name when registering an alias.
In the v1 ABI, this function is called with the class symbol directly,
so we need to make sure that we replace it with the upgraded symbol.
8 years ago
David Chisnall 45d0b8e4c9 Add support for registering aliases.
Also add a test.
8 years ago
David Chisnall 93b3f889a6 Update documentation. 8 years ago
David Chisnall a8752cd842 Clean up method / slot lookup interfaces. 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 33dc69387e Add test for category methods replacing class methods. 8 years ago
David Chisnall 314a4167ca Remove low memory profile.
This hasn't been tested for a long time and probably doesn't work.
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 f3386c530e Add asserts that we don't see extended type encodings in selectors.
It might be a good idea to handle user-provided extended type encodings,
but for now we just abort.
8 years ago
David Chisnall ccb8627765 Don't leak extended type encodings in slot access. 8 years ago
David Chisnall 6c1fc86f01 Clean up a condition.
Skip adding the null capability.
8 years ago
David Chisnall 5a9c65553f Always use selector type for method type encodings.
In the new ABI, we use the legacy type encoding in the selector and the
extended type encoding in the types field.  We want to only expose the
legacy type encoding through existing APIs.
8 years ago
David Chisnall 4f71429bec Add support for parsing extended type encodings.
Extended type encodings add more detailed information to object and
block types:

* Objects are encoded as @"ClassName".
* Blocks are encoded as @?<parameter type signature>

In the new ABI, we use classic type encodings for selectors and extended
type encodings everywhere else.
8 years ago
David Chisnall 55a4d763d1 Silence a warning in a test.
The test is doing something unsafe, but which we want to work.
8 years ago
David Chisnall 44a85a401a Add size to the property list.
It should now be possible to support newer ABIs.
8 years ago