14 Commits (71e38a048fc06fea0c2015662540d46a33b5c45d)

Author SHA1 Message Date
David Chisnall 369c84db35 Fix compiler warnings. 7 years ago
David Chisnall 8db0450dcc Fix bug in ivar align computation.
__builtin_clz takes an unsigned int, it isn't overloaded for different
types.  This meant that we were computing log2 by counting the
leading bits in a 32-bit value and using that result as if it were the
number of bits in a 64-bit value.  This meant that our alignment values
were 2^32 times as big as they should be.  This mostly didn't matter,
because we then truncated the result to 32 bits and the wrapping gave
the correct answer.

Unfortunately, this was undefined behaviour and, at sufficiently high
optimisation levels, this resulted in the value being optimised away,
leading to odd results.
7 years ago
David Chisnall 43f557e26e Add the size field to the ivar structure.
This was the last change made to the ABI before upstreaming the clang
parts.
8 years ago
David Chisnall aba97e11b4 Fix ivar_ownership type name. 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 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 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 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
theraven 4e7b476aa6 Change [1] to [] for variable length structure elements (C99 - silences array out of bounds errors).
Added fields to the end of the class structure for strong / weak ivar bitmaps (not yet generated by any compiler).

Fixed definition of __sync_swap() so that it works on GCC again.
15 years ago
theraven 7b8b3839df More refactoring. 16 years ago