156 Commits (369c84db35a6a1e94f8a4689a695fabdac056166)

Author SHA1 Message Date
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
davidchisnall b8badbb28e
Merge pull request #63 from Microsoft/assocloss
always look beyond the first page of associated objects
8 years ago
Dustin Howett 828e6ebf70 always look beyond the first page of associated objects
Without this fix, we would lose associated objects silently after adding
the 11th. We would also allocate full pages for each object after the
11th because we couldn't find empty slots.
8 years ago
Dustin Howett 7fb4f5684f Merge remote-tracking branch 'upstream/master' into HEAD 8 years ago
Dustin Howett 14cb893509 Add a test for class_setSuperclass 8 years ago
Dustin Howett 81f7b16af5 Add a test for e3b069c (association policy) 8 years ago
David Chisnall 7539d7e042 Fix warnings in test. 8 years ago
Dustin Howett 45f6572379 Add a test for a0eec52 8 years ago
David Chisnall 7b8e741f39 Remove a test for a thing that was false.
There is no guarantee that two selectors will be equal.
8 years ago