fix(gc): route the census thread-locals through hot TLS - #9781
fix(gc): route the census thread-locals through hot TLS#9781proggeramlug wants to merge 2 commits into
Conversation
`scripts/check_thread_locals.py` fails on main, taking the
`self-test-checkers` job down on every PR:
thread-local policy check FAILED:
crates/perry-runtime/src/gc/census.rs: 2 raw `thread_local!` block(s),
none allowed.
`gc::census` is compiled unconditionally (`pub(crate) mod census;`), so its
two ungated `thread_local!` blocks are in shipping builds and pay
`_tlv_get_addr` per access on Darwin — exactly what PerryTS#7469's policy exists to
prevent. The third block in the file is `#[cfg(test)]` and is out of scope by
construction.
Converted to `crate::perry_thread_local!`, which is the same syntax and the
same `.with()` at every call site — all nine uses of ARMED/SEQ/LABEL/
PASS1_MARKED already go through `.with()`, so nothing else changes. This is
the same treatment 12efed1 gave the four other recent declarations; census
was missed.
Claude-Session: https://claude.ai/code/session_01YPfnmWZmSpSWpmnoXvH8z2
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe census module replaces two standard thread-local declarations with ChangesCensus thread-local declarations
Estimated code review effort: 1 (Trivial) | ~5 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing as a duplicate of #9774, which fixes the same |
The break
scripts/check_thread_locals.pyfails onmain, which takes theself-test-checkersjob of the TLS Budget workflow down — on main itself (run 33945210479) and on every open
PR, including unrelated ones:
In that workflow the expensive
tls-budgetjob passes (13m19s); only this 12-secondhermetic checker fails.
Why it is a real finding, not just a ratchet
gc::censusis compiled unconditionally —crates/perry-runtime/src/gc/mod.rs:247declarespub(crate) mod census;with nocfg— so both blocks are in shipping builds and pay_tlv_get_addrper access on Darwin, which is exactly the cost #7469's policy exists toprevent. (The census is runtime-gated by
PERRY_GC_CENSUS, but that gate is read throughARMED, one of these very thread-locals.)The file's third
thread_local!is#[cfg(test)]and is out of scope by construction, asthe checker's own header documents — hence "2 raw blocks", not 3.
This is the same treatment
12efed122("perf(runtime): route four recent thread_localdeclarations through hot TLS") gave four other recent declarations;
census.rswas missed.The change
Both blocks become
crate::perry_thread_local!. The macro takes the same syntax — multiplestatics per block, doc comments,
const { … }initialisers — and yields the same.with()API. All nine call sites of
ARMED/SEQ/LABEL/PASS1_MARKEDalready go through.with()(verified: zero non-.with()uses), so nothing else changes.Verification
Checker, run locally against the tree:
Compile, on linux-x86_64 —
cargo check -p perry-runtime --all-targets:Note: with
RUSTFLAGS=-D warningsthis branch does not build, but for an unrelatedreason — the three
clashing_extern_declarationserrors fixed by #9776, none of whichcome from
census.rs. That is why the compile check above is run without-D warnings;once #9776 lands, both hold together.
Scope
One of several independent breakages on
main, which is currently red across six workflows.Also open from this sweep: #9776 (
warnings), #9777 (cargo-test), #9780(
check+ext-link).https://claude.ai/code/session_01YPfnmWZmSpSWpmnoXvH8z2
Summary by CodeRabbit
Performance
Reliability