The reworked wrapping of C++ exceptions meant that we were missing a
dereference of the result of __cxa_begin_catch.
Add a test that triggers this issue. It would have occurred in the
non-ARC version if we actually did anything with the exception, but
compiling it in ARC mode makes the compiler insert retain / autorelease
around the exception object to ensure that it remains live.
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.
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.
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.
When removing a hash entry that was in the cell assigned to its hash, we
would clear the first bit in the second maps. If this entry was a
secondary value with the same hash, then this value became unreachable.
This very rarely showed up for two reasons. First, most of the tables
are insert-only and so we never try to remove things from them. Second,
it requires a particular sequence of inserts. It occasionally caused
weak references to be susceptible to use after free.
This cleans up handling of objects that are not reference counted and
makes their interactions with ARC more consistent. We should probably
generalise this somewhat - it currently special cases NSConstantString
and NSGlobalBlock, but it would be nice to have an API for constant
objects.
This has no effect most of the time, but if the runtime is built with
llvm-cov support, then this will cause each test to emit a .profraw
file, which can be merged with:
$ llvm-profdata merge -sparse Test/*.profraw -o libobjc.profdata
This can then be used to generate coverage reports from the test suite
and find code paths that are not currently being tested.
Coverage checking of the test suite showed that objc_disposeClassPair
wasn't tested at all, which then led to discovering that it didn't
unregister the class.
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.