14 Commits (55b3fba9c9b002630dedafc3df133b5d9814c12b)

Author SHA1 Message Date
David Chisnall 7ccc1db5a8 Modernise CI
CI was failing because a number of our host platforms were no longer
supported.  This commit:

 - Moves to the latest FreeBSD 12, 13, and 14 branch releases.
 - Moves to modern Ubuntu.
 - Replaces Windows 2016 with 2022
 - Moves from Azure Pipelines to GitHub for the non-FreeBSD tests.
 - Fixes some tests that are not reliable in some contexts.
3 years ago
Graham--M 14619f2905
Fix autorelease pool emptying when new references are added (#218)
* Add test for emptying autorelease pool

* Fix arc autorelease pool emptying when adding further references
When releasing a reference in the arc autorelease pool, it is
possible and anticipated that new references may added to the pool.
This fix addresses an edge case where releasing a reference in the
same pool page as the stop position can add more references which
cause the insertion of a new page and emptyPool() returns early
after emptying the new page.
4 years ago
Frederik Seiffert b32ee7787d
Fix weak ref handling during dealloc (#215)
Add test for setting weak ref during dealloc

Fixes #214
4 years ago
Graham--M 921e3c3386 Strong retain calls should always return the instance pointer.
This fixes a regression in 73132a6 (#200) where nil was returned
from a retain call after the object begins deallocating. Normal
retains of a deallocating object are still expected to return an
instance pointer inside its dealloc method and code compiled with ARC
will generate calls to objc_storeStrong() when a block captures the
self pointer inside the dealloc method.
5 years ago
Graham--M 38f44a8752 Remove unused declares 5 years ago
Graham--M 73132a6c98
Avoid dangling weak references to deallocating objects. (#200)
The previous checks for a deallocating object with negative reference count did not work because:
    1. the sign bit has to be recreated as was happening in objc_delete_weak_refs()
    2. there was no distinction between a saturated count and a negative reference count

refcount_max now indicates when the refcount has saturated and should no longer be mutated.
An underflow to -1 still maps to refcount_mask, allowing us to detect when an object is supposed to be deallocated.
Neither objc_release_fast_no_destroy_np() nor objc_retain_fast_np() mutate the refcount when it is one of those values, so the comment in objc_delete_weak_refs() was adjusted.
5 years ago
David Chisnall 41808111aa Fix compiling with libc++ but not linking with libc++. 5 years ago
Dustin L. Howett bfc0b9afe4 Operate on the real weak ref table when erasing an entry
Fixes #144.

(cherry picked from commit 9702494b902eedf9383e9194df372a4482d7a044)
6 years ago
Dustin L. Howett 7ad75c07d6 Revert "Fix test failure."
This reverts commit 336d8a828c.

(cherry picked from commit 194d2ba8db86a03a08ef825501627d7d178e4202)
6 years ago
David Chisnall 75ad9243a1 Prevent libc++ from using exceptions. 6 years ago
David Chisnall 457361354c Merge remote-tracking branch 'origin/master' into arc-cxx 6 years ago
David Chisnall 336d8a828c Fix test failure.
This bug is also present in the original version:

When removing a WeakRef from the map, we use its obj field to find the
key, but the obj field has already been zeroed by this point and so we
end up leaving dangling pointers in the map.
7 years ago
David Chisnall af55c29007 Fix the build on Windows. 7 years ago
David Chisnall 3f38f691af Rework ARC code as C++.
Move the weak references hash table to use a well-tested third-party
implementation instead of the hand-rolled version.
7 years ago