Repository navigation
Add write barriers for generational GC - #23
Merged
Merged
Conversation
The write-barrier checker of Acton's generational GC mode found pointer stores without a barrier: libuv's stores into the uv handles, and our stores into the channel write queues. In generational mode such a store can let the collector free an object that is still in use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes the C extension correct in Acton's generational GC mode and runs the write-barrier checker in CI. It needs the barrier API of actonlang/acton#3390 (acton_malloc_rescanned and ACTON_STORE). That PR is merged, but the tip release that CI installs does not have it yet, so the first CI run of this PR fails to compile. CI runs again once the tip release has actonlang/acton#3390.
The checker found pointer stores without a barrier in this package. On the gate of actonlang/acton#3390 (AMD Ryzen 9 5950X, Linux), a program that links this package exited with status 70 on a store by libuv into the handle queue of a uv_poll_t that src/lib.ext.c allocated as plain GC memory. In this repository, acton test --gc-check on main exits with status 70 in every run, in PipeOrderTester, on the stores into the channel write queues. 5 of its 36 reports were of the kind where the collector would free an object that is still in use.
The test suite alone does not find a uv handle in plain GC memory: with only the client poll put back on acton_calloc, 50 runs of acton test --gc-check passed. src/fanout.act, with many concurrent connections, finds it, so CI also runs it under the checker.
Tested with Acton built from the head of actonlang/acton#3390, 7c248ccfa, on an Apple M4 Pro with macOS 15.7.9 and OpenSSH 9.9p2. acton test --tag openssh passed 5 runs in ordinary mode and 20 runs in generational mode. acton test --gc-check passed 100 runs, 10 more runs with --min-time 2000 --max-time 10000 and 20 runs with --fast, with no checker report. The example programs passed in ordinary, generational and checker mode. With only the client poll put back on acton_calloc, fanout under ACTON_GC_CHECK=1 exited with status 70 in 5 of 5 debug runs and 5 of 5 --fast runs.