955 Commits (bfa19f152f47b4c86ceb9c7f14109bf211f8f0c6)
 

Author SHA1 Message Date
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 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
David Chisnall 7bd78e5b46 Fix a bug in ObjC++ EH.
Throwing an Objective-C exception through a C++ catch block was broken.
This was because the C++ code inserts a cleanup handler to make sure
that it invokes `__cxa_end_catch`.  Unwinding through this catchup
transformed the Objective-C exception into a C++ one.  This case should
have been handled, except for two bugs:

1. A typo (`#ifdef` instead of `#ifndef`) meant that we were not
   extracting the Objective-C exception from the C++ object.
2. We were skipping everything except catchalls after the search phase,
   because we lose some information in the transformation.

Fixes #49
8 years ago
David Chisnall f6709519fa Simplify test case some more.
It appears that the problem occurs when throwing an Objective-C
exception through and Objective-C++ frame.
8 years ago
David Chisnall 760bb785aa Rename files.
minRep is not actually an informative name for a test case.
8 years ago
David Chisnall 9115a909b1 Delete more code.
The reduced test case is now fairly close to minimal.
8 years ago
David Chisnall 8f03e62a84 Delete a lot of redundant code. 8 years ago
David Chisnall 1f2d35006b Make the ObjC++ interop test compile 8 years ago
David Chisnall 9760ae8d48 Merge pull request 50 with test case for exception issue. 8 years ago
David Chisnall 24f3713a4b Fix a bug in weak ref handling.
Weak refs were being left as dangling pointers after being deleted.  The
load that caused the deallocation would return nil, but then the next
one would dereference a dangling pointer.
8 years ago
David Lobron c036265ece Remove changes introduced accidentally because I was using an older
version of this file (sync with 0b5f66393a).
8 years ago
David Lobron 44d05e58a6 Minimal reproducing test case. This creates a test number 47 in the unit
test suite, which fails with an exception.  The exception reproduces the
bug.
8 years ago
David Chisnall 2542638b23 Add a warning to the announcement. 8 years ago
David Chisnall 6d9f2a6586 Add some release announcement text. 8 years ago
David Chisnall 12b820cb99 Add refcount accessor function. 8 years ago
David Chisnall e5b4468867 Improve copying and moving weak refs.
Fixes a bug introduced (replacing a similar bug) in the last rewrite of
objc_moveWeak.  This version should now be correct.

objc_copyWeak was implemented in a naive way, which had a lot more
overhead than required.
8 years ago
David Chisnall 458bd3c7a2 Add interfaces for better integration with Foundation. 8 years ago
David Chisnall bdc20a8bab Add some debugging help for ARC-compilance. 8 years ago
David Chisnall fe579e3f1a Simplify the weak code.
Rather than tracking all of the locations of weak pointers, keep a weak
refcount.  This should also make it easier to add finer-grained locking to weak
references.
8 years ago
David Chisnall af4e0719ff Checkpoint work on improving weak reference efficiency. 8 years ago
David Chisnall a2a80ac5dc Remove debugging printf. 8 years ago
David Chisnall 6451d35e92 Fix block refcounts to use saturating arithmetic. 8 years ago
Zenny Chen 5f01917a49 Update blocks_runtime.h (#45)
Update blocks_runtime.h to be compatible with Apple / LLVM version.
8 years ago
davidchisnall ee12b2362a Merge pull request #38 from theiostream/class-header
Add objc-class.h to objc headers
9 years ago
Daniel Ferreira 1593ac04af Add objc-class.h to objc headers
Some applications still include the old objc-class.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
9 years ago
davidchisnall e285ba83a9 Merge pull request #36 from theiostream/block-headers
build: add compatibility symlink for block headers

Fixes #34
9 years ago
davidchisnall 29f831b4aa Merge pull request #33 from theiostream/objc-runtime-header
Add objc-runtime.h to objc headers
9 years ago
Daniel Ferreira a9aba57e7c build: add compatibility symlink for block headers
On FreeBSD and OSX, the block runtime functions are defined on a Block.h
and a Block_private.h headers on the include path as opposed to
libobjc2's objc/blocks_runtime.h and objc/blocks_private.h respectively.

This commit amends libobjc2's install routine to create the
FreeBSD-style headers as symlinks to the ones provided by libobjc2 for
improved compatibility.
9 years ago
Daniel Ferreira a3e1a0d3ed Add objc-runtime.h to objc headers
Some applications still include the old objc-runtime.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
9 years ago
David Chisnall 21efe9e259 Update dtables for metaclasses when exchanging methods.
Fixes #32
9 years ago
David Chisnall 0b5f66393a Add test for #32. 9 years ago
David Chisnall 2417ec5806 Remove another unused build-breaking header. 9 years ago