164 Commits (a04d0e85472f934ee506ffa1a050aa247e345dbc)

Author SHA1 Message Date
Frederik Seiffert 5308d21c1e Use const pointers for associated object keys.
Matches Apple platform implementations.
7 years ago
David Chisnall 375018a933 Fix upgrading legacy properties with qualifiers.
This fixes PropertyIntrospectionTest2_arc with the 1.x ABI and enables
the test that was disabled in this mode.
7 years ago
Frederik Seiffert 5aa82d059a Disabled atomic property tests on legacy ABI versions. 7 years ago
Frederik Seiffert fb32780698 Extended property introspection test with atomic-type property. 7 years ago
Frederik Seiffert 5917514ac1 Added test for atomic ivars. 7 years ago
David Chisnall 1ab65ca818 Replace incorrect magic number with sensible number. 7 years ago
David Chisnall 945bbd760d Mark some tests as big.
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.
7 years ago
David Chisnall c4cb965033 Add more assertions to ManyManySelectors test.
This is intermittently failing in CI.  It looks as if the CI machine is
running out of memory in a way that we are not gracefully handling.
7 years ago
David Chisnall 369c84db35 Fix compiler warnings. 7 years ago
David Chisnall 959a0f1998 Make alignTest pass on ARM.
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.
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 eab35fce37 Work around clang 8 bug in test. 7 years ago
Dustin Howett f392ff1870 Fix dtable rebase and add a test for a missing case
The dtable rebasing rework in b81df02b broke the inheritance of
superclass methods from a superclass that had already been initialized.
7 years ago
David Chisnall e811e6ce32 Fix build failure in test. 7 years ago
David Chisnall 0da21d5064 Add some more Windows build tweaks.
This enables building on Windows with Ninja.
7 years ago
David Chisnall d0c3fe5323 Remove a broken assertion.
This was checking that a variable that was never assigned to was a
non-zero value.
7 years ago
David Chisnall 262cea96f5 Fix test for clang 8.
Clang 8 now rejects the thing that this is testing (which is good,
because it's a terrible idea).
7 years ago
David Chisnall b9b6198520 Improve the forward-declared protocol test. 8 years ago
David Chisnall 6ab3df0892 Improve the forward declare protocols test.
Make it not fail to build with older compilers and make it test the
thing that should be true with the new ABI.
8 years ago
David Chisnall 00c631c58e Fix a bug in a test. 8 years ago
David Chisnall 65d5adc9f7 Add some extra test cases to the exception test.
We were testing this in the ObjC++ interop test, but it makes sense to
run the test even when not building ObjC++.
8 years ago
David Chisnall 3fc3e11296 Fix building the runtime test on Windows. 8 years ago
David Chisnall bab334acd4 Fix cmake configuration for Windows builds. 8 years ago
David Chisnall aa558900bd Fix an off-by-one error in the hash table.
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.
8 years ago
David Chisnall 934cd13a7a Initial pass at Windows support.
All tests now pass with the new ABI on x86-64, with the new ABI.  Some
of the code is ugly and other platforms are probably broken.
8 years ago
David Chisnall 4e9fd2ec8a Rename objc_slot and objc_slot_v1.
The objc_slot type was exposed via public interfaces and the renaming
broke things (including the GNUstep build).
8 years ago
David Chisnall d89a1cafb7 Improve protocol test coverage. 8 years ago
David Chisnall 0c9ee8b920 Improve protocol tests and fix bugs.
Also add the new protocol_getProperties2 function.
8 years ago
David Chisnall 8eb06a3b15 Improve ARC test and fix bugs it uncovered.
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.
8 years ago
David Chisnall c6aaf560c1 Fix dangling reference in weak ref code.
Another test added as a result of coverage analysis.
8 years ago
David Chisnall 29a35ab8ba Set profiling environment variable when tests are run.
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.
8 years ago
David Chisnall c865b519b0 Unregister classes when deleting them.
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.
8 years ago
David Chisnall 2934a98503 Support building without support for old ABIs. 8 years ago
David Chisnall b81df02b91 Merge branch 'master' into newabi
Simplify the setSubclass dtable updating mechanism.
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 6c9edcb510 Support new NSConstantString format and update tests. 8 years ago
David Chisnall 67cf43c5a2 Add support for class properties in protocols. 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 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 45d0b8e4c9 Add support for registering aliases.
Also add a test.
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 55a4d763d1 Silence a warning in a test.
The test is doing something unsafe, but which we want to work.
8 years ago
David Chisnall 8b6793aa52 Add a test for forward declared protocols.
Check that a protocol accessed by forward definition in one compilation
unit is the one defined in another compilation unit.
8 years ago
David Chisnall 1dfa6a6785 Explicitly reference a protocol in a test.
With the old ABI, we generated a copy of every protocol in every
compilation unit that declared it.  We now emit protocols only if they
are referenced (and have the linker deduplicate them).

This test was previously failing with the Apple runtime.
8 years ago