985 Commits (a5a0f70a03fbd182e526955a237085e81ef4d5ef)
 

Author SHA1 Message Date
David Chisnall a5a0f70a03 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 554c6623dc Back-port constant string test from newabi branch. 8 years ago
David Chisnall f2b5988596 Add constant string test. 8 years ago
David Chisnall 0828b11125 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 ca1d45a4e6 Fix dangling reference in weak ref code.
Another test added as a result of coverage analysis.
8 years ago
David Chisnall 8021533d4c Don't allocate objects of size 0.
There's nowhere for the class pointer, so there's nothing that you can
do with them.
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 a4f97f7563 Refactor locking in setSuperclass.
Now all lock ownership is tied to scopes, so will be released correctly
in all return paths.
8 years ago
David Chisnall 00d23b0013 Fix LOCK_SCOPE to allow multiple locks per scope. 8 years ago
davidchisnall fd526bc31f
Merge pull request #70 from Microsoft/css_deadlock
Let go of the runtime lock properly in class_setSuperclass
8 years ago
Dustin Howett d32bafc6e1 Let go of the runtime lock properly in class_setSuperclass 8 years ago
Jason Barmparesos 682717b08d Clang++ provides its own exception types on Linux. (#68)
Fix type of `__cxa_allocate_exception` with recent libsupc++.

Recent versions of GNU libsupc++ provide a definition of `__cxa_allocate_exception` that has a `noexcept` qualifier.  This is sensible (if allocating an exception throws an exception, then something is badly wrong) but it not what the ABI spec says.  We provide our own definition of this, which must match another if provided.

This wouldn't normally be a problem, but recent libstdc++ headers appear to leak libsupc++ headers into the namespace, so we're seeing these definitions even without explicitly including any C++ ABI-related headers.
8 years ago
davidchisnall bdf7299af9
Merge pull request #62 from Microsoft/cherry-pick-acd3fcc
fix objc_msgSend.x86-32.S for win32
8 years ago
davidchisnall b8badbb28e
Merge pull request #63 from Microsoft/assocloss
always look beyond the first page of associated objects
8 years ago
davidchisnall b1494c8823
Merge pull request #59 from Microsoft/cherry-pick-7a226d8
win32: use native threading APIs instead of pthreads
8 years ago
davidchisnall c5b96fafe9
Merge pull request #56 from Microsoft/cherry-pick-aa58f6f
teach class_setSuperclass about metaclasses, subclass lists, and dtables
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 d66d6e5a14 Fix a warning in runtime.c 8 years ago
Dustin Howett 072972600a fix objc_msgSend.x86-32.S for win32 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 82d4d3fbfd merge dtables inplace, don't hold rt lock while initializing 8 years ago
Dustin Howett 9459f53ffa Add a class inheritance helper 8 years ago
Dustin Howett 6af4fcb219 Fix eh_personality for NO_PTHREADS 8 years ago
Dustin L. Howett 430ab75014 win32: use native threading APIs instead of pthreads
* use fiber local storage if NO_PTHREADS is defined
* use critical sections instead of mutexes

Contributing-author: Ben Viglietta <benvi@microsoft.com>
8 years ago
davidchisnall ebed8468a1
Merge pull request #61 from Microsoft/assoc_test
Add a test for e3b069c (association policy)
8 years ago
Dustin Howett 81f7b16af5 Add a test for e3b069c (association policy) 8 years ago
David Chisnall 3c036b3f4f Use nullptr for nil in C++11. 8 years ago
David Chisnall 7539d7e042 Fix warnings in test. 8 years ago
davidchisnall bfa19f152f
Merge pull request #60 from Microsoft/hash-test
Add a hash table deletion test to validate a0eec52
8 years ago
Dustin Howett 45f6572379 Add a test for a0eec52 8 years ago
davidchisnall b9d5523cc2
Merge pull request #53 from Microsoft/cherry-pick-038543f
fix a mismanagement of the hash table that could lead to data loss
8 years ago
davidchisnall c66f61c0f9
Merge pull request #54 from Microsoft/cherry-pick-8c8534e
Wrap some headers in extern "C" for C++ compatibility
8 years ago
davidchisnall 5cb60562c5
Merge pull request #55 from Microsoft/cherry-pick-0b2cfdc
Use the old association policy to determine whether to release an object
8 years ago
davidchisnall b0e85c6f35
Merge pull request #58 from Microsoft/cherry-pick-cd4f43d
fix flipped sense on ASSERT()
8 years ago
davidchisnall 447504392c
Merge pull request #57 from Microsoft/cherry-pick-f503a3d
fix objc_resolve_class_links to actually rescan the unresolved list
8 years ago
Dustin L. Howett e3b069cedc Use the old association policy to determine whether to release an object
This commit has been augmented to address the comments in
https://github.com/Microsoft/libobjc2/commit/df7f9061670cce994730d1720150adc
8 years ago
Dustin L. Howett 21ad183e3e Wrap some headers in extern C for C++ compat. 8 years ago
Dustin L. Howett a421d62821 teach class_setSuperclass about metaclasses, subclass lists, and dtables 8 years ago
Dustin L. Howett 7d5a0ff85e fix objc_resolve_class_links to actually rescan the unresolved list
It looks like this was the initial intent of 4ea82e1, but as implemented
it would still only scan the unresolved class list once. Since
unresolved_class_list represents the head and classes are pushed onto
the head, any classes added to the resolution list after resolution
started would be skipped.
8 years ago
Dustin L. Howett a0eec52bb8 fix a mismanagement of the hash table that could lead to data loss
This commit fixes a data loss bug in our hopscotch table implementation.
Removing values from the table can result in other values becoming
disconnected and lost.

Let A, B, and C be values that all hash to cell 0.
Assume the hopscotch distance factor H = 2.

   0     1     2
+-----+-----+-----+
|     |     |     |
+-----+-----+-----+

After adding A
   0     1     2
+-----+-----+-----+
|  A  |     |     |
+-----+-----+-----+
   |
   +-Neighbors =

After adding B
   0     1     2
+-----+-----+-----+
|  A  |  B  |     |
+-----+-----+-----+
   |
   +-Neighbors = 1

After adding C
   0     1     2
+-----+-----+-----+
|  A  |  B  |  C  |
+-----+-----+-----+
   |
   +-Neighbors = 1, 2

If we then remove B,
   0     1     2
+-----+-----+-----+
|  A  | [X] |  C  |
+-----+-----+-----+
   |
   +-Neighbors = 1, 2

* It is replaced with a placeholder [X].
* A's neighbor table is not updated to reflect the loss.

If we then remove A,
   0     1     2
+-----+-----+-----+
| [X] | [X] | [C] |
+-----+-----+-----+
   |
   +-Neighbors = 2

* The table is rebalanced to promote A's lowest neighbor to the primary
  cell position.
* C from cell 2 remains cell 0's neighbor.

The bug manifests if [X] the placeholder value passes the null check set
out in MAP_TABLE_VALUE_NULL; that is, the placeholder is "effectively
null".

Looking up the key that matches C will first evaluate its base cell, the
one that collided with the key in the first place. Since that is
placeholder [X], and [X] is "effectively null", the lookup stops.

C is never retrieved from the hash table.

---
The expedient solution to this bug is to update cell 0's neighbors when
B is first removed, effectively skipping the hole:

If we remove B as above,
   0     1     2
+-----+-----+-----+
|  A  | [X] |  C  |
+-----+-----+-----+
   |
   +-Neighbors = 2 <<< HERE

but clear the neighbor bit for cell 1, the promotion that happens when A
is later removed places C in cell 0.

   0     1     2
+-----+-----+-----+
|  C  | [X] | [X] |
+-----+-----+-----+
   |
   +-Neighbors =
8 years ago
Dustin Howett 2e45da40c4 fix flipped sense on ASSERT() 8 years ago
David Chisnall 14889c540f Bump cmake minimum version.
Fixes #51
8 years ago
David Chisnall e235ffbff1 Add some more release notes. 8 years ago
David Chisnall 587cf3f27b Another try at making CMake work. 8 years ago
David Chisnall bb78abb662 Fix copy and paste type. 8 years ago
David Chisnall 7832765112 Improve detection of libsupc++ 8 years ago
David Chisnall dc9b8313a4 Rework C++ library detection.
macOS ships with libc++abi, which doesn't provide the hooks required
for interop, so this was causing all of the tests to fail to link in
the Travis macOS test.  We're now correctly detecting that it won't
work on macOS and disabling those tests.
8 years ago
David Chisnall fefb333b01 Remove the separate libobjcxx.
If we don't find a separate dynamically linkable C++ runtime, then
depend on the C++ standard library implementation.
8 years ago
David Chisnall 82b3abf93e Fix test warning on GNU platforms. 8 years ago