Setting these tests to use 3 processors is weird, but it means that in
CI (where we do 4 tests in parallel), we won't ever run more than one of
these at a time (though we can run any other one test at the same time
as these). This should fix the intermittent failure.
These most likely led to some intermittent failures in weak references.
The `objc_moveWeak` and `objc_copyWeak` functions were assuming that the
target may contain valid data, but the spec for these says that it may
be uninitialised data. We were reading uninitialised data and then
seeing if it happened to be a valid object. Most of the time it was
likely to be nil, so this wasn't an easily reproduceable problem...
I believe this is the correct fix for PR #95.
Fixes#95
This is necessary because FreeBSD/ARM and possibly other platforms use
.init_array and not .ctors, so never call the init functions. As a
result, we will need the compiler to move to putting the load function
in .init_array and may end up with it being called by both variants.
This test assumed that a vector of 4 ints needed 16-byte alignment, but
this is target specific. Now check that the runtime provides at least
as strong alignment as the compiler expects.
This has been tested with a few hacks on FreeBSD, where everything
except for throwing exceptions in +initialize appears to work (most
likely an unrelated issue, though it's possible that there are problems
with the unwind tables in objc_msgSend.)
Fixes#92
This was actually a memory leak in the hidden class implementation, but
it was mostly visible in the @synchronized implementation. Every hidden
class registered a custom .cxx_destruct method, to handle cleanup of all
of the hidden class structures. Unfortunately, this destructor failed
to delete the reflection metadata structures associated with the class,
specifically the objc_method_list containing the objc_method pointing to
the destructor itself.
Fixes#98
We use the existence of the `Protocol` class in a set of loaded objects
to determine whether we are mixing ABIs in a safe way (i.e. only mixing
a new ABI runtime with old ABI everything else). Unfortunately, in
static linking, the Protocol class was not being linked because it is
never directly referenced, which made this check fail.
Fixes#85
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.
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