Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog.d/9781-census-hot-tls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**The GC census thread-locals no longer pay `_tlv_get_addr`.** `gc::census`
is compiled unconditionally, so its two ungated `thread_local!` blocks were
in shipping builds and cost an out-of-line libdyld call per access on Darwin
— including the `ARMED` flag that gates whether the census does anything at
all. Both now use `crate::perry_thread_local!`, the same treatment the four
other recent declarations received; every call site already went through
`.with()`, so nothing else changed.

This also restores the `self-test-checkers` job, whose thread-local policy
ratchet (#7469) had been failing on main and on every open PR.
4 changes: 2 additions & 2 deletions crates/perry-runtime/src/gc/census.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static SIGNAL_PENDING: AtomicBool = AtomicBool::new(false);
static SIGNAL_INSTALLED: AtomicBool = AtomicBool::new(false);
static MAIN_THREAD: OnceLock<std::thread::ThreadId> = OnceLock::new();

thread_local! {
crate::perry_thread_local! {
static ARMED: Cell<bool> = const { Cell::new(false) };
static SEQ: Cell<u32> = const { Cell::new(0) };
static LABEL: RefCell<&'static str> = const { RefCell::new("manual") };
Expand Down Expand Up @@ -177,7 +177,7 @@ fn census_service_signal() {
super::js_gc_collect();
}

thread_local! {
crate::perry_thread_local! {
/// Pass-1 snapshot: sorted header addresses that were marked when mark
/// propagation finished (see the module docs).
static PASS1_MARKED: RefCell<Option<Vec<usize>>> = const { RefCell::new(None) };
Expand Down
Loading