38 Commits (2855d1771478e1e368fcfeb4d56aecbb4d9429ca)

Author SHA1 Message Date
David Chisnall b3f7b1bac3 Remove Boehm GC support code.
This removes all support for GC mode.

This was deprecated by Apple in OS X 10.8 (2012) and never supported in
iOS.  Very little code ever tried to use it with this runtime.

It's gone from the build system already.
3 years ago
David Chisnall 369c84db35 Fix compiler warnings. 7 years ago
David Chisnall afee197c67 Rework some of the ivar offset calculations.
We now correctly handle ivars that overlap with the end of what the
compiler thinks is the start of the superclass and bitfields at the
start of a class.
7 years ago
David Chisnall 8dd9c9a0ae Fix an issue with incorrect offsets for the first ivar.
Clang rounds up the size of a class to the size of a word.  If the first
instance variable in a subclass has a field that has smaller alignment
requirements than a word, it is generated with a negative offset,
indicating that it belongs in the space allocated for the parent.

This did not work at all with the code we have for recomputing instance
variable layouts, which uses only the size and the alignment.

Fixes #96
7 years ago
David Chisnall effdd15042 Work around a clang bug. 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 2934a98503 Support building without support for old ABIs. 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 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 64a8302712 Delete some now-dead code. 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
David Chisnall 51cc9c0347 Fix updating ivars to the new structure.
Some types (e.g. vectors) end up with empty type encodings, for these
cases we assume void* alignment.
8 years ago
David Chisnall a54272c1ab Merge origin/master into newabi (using imerge) 8 years ago
David Chisnall e87b5c1503 Remove an assertion that was useful in debugging, but not actually
correct.

Instance variables are not normally zero-sized, but some are.  Examples
include zero-length arrays at the end of a class, and bitfields.

Fixes #30
Fixes #31
9 years ago
David Chisnall 12d1ea62a4 Merge branch 'master' into newabi 9 years ago
David Chisnall 4fd27a066f When moving ivars to increase their alignment, make sure later ivars are
also moved.

Fixes #27
9 years ago
David Chisnall 695282e5d7 Don't conditionally run some cheap code that becomes a no-ops in the
case when we weren't running it.
9 years ago
David Chisnall 5725aa74ec Fix the computation of the size when realigning ivars.
Fixes #25, #26
9 years ago
David Chisnall 6df23377a0 Forcibly realign instance variables to take into account the padding
from the reference count.
9 years ago
Niels Grewe f264fd159d Fix a segfault on (s|g)etting ivars.
When we were trying to get or set an ivar on a class that had
no ivars defined, we'd dereference a NULL ivar list while
determining the ownership qualifier.
10 years ago
David Chisnall d0a290cc1b If we try to do ivar assignment on something that is not an object, just do straight object-sized assignment. 10 years ago
David Chisnall c58ba23470 Improve some null handling in ivar resolution code. 10 years ago
David Chisnall f9421d02a8 Add a size field to the ivar list struct, for forward compatibility. 10 years ago
David Chisnall 3dc096eb17 Add new ABI ivar metadata structures.
The new structure has extra fields for alignment and flags (e.g.
ownership).
Old structures are auto-upgraded at load time, so the rest of the code
can assume the presence of the new structure type.
10 years ago
David Chisnall 2777fea77a Enable correct behaviour with respect to ARC for objc_{g,s}etIvar(). 10 years ago
David Chisnall bfe5de572e Fix the ivar access functions for objects that are not pointer sized. 10 years ago
theraven da6d7f6060 Remove ivar offset fudging code, as it appears to break a lot of things. 13 years ago
theraven 16bfdc8ee6 Align ivars to 16 byte boundaries when they are larger than a pointer. This is
currently overly defensive.

Add a test case for this realignment.
13 years ago
theraven f6697e5f86 Remove spurious &s. 15 years ago
theraven 79b67ad044 Added missing ivar access functions. 15 years ago
theraven 6c7cf4a5a6 Add visibility attributes on all internal functions so that we aren't ever exporting them outside of libobjc. 15 years ago
theraven 569a48650d Various tidies. 16 years ago
theraven 8158ff0a7a Tweak fragile ABI test to account for alignment padding. 16 years ago
theraven bb8cafaa15 Finished rewriting the loader. It's now cleanly separated into logically-separate components, so there's a chance it might actually be maintainable... 16 years ago
theraven bfbc15e4f7 Fix 64-bit warning. 16 years ago
theraven 7b8b3839df More refactoring. 16 years ago