diff --git a/changelog.d/10203-traversal-feedback-hot-tls.md b/changelog.d/10203-traversal-feedback-hot-tls.md new file mode 100644 index 0000000000..a0a93a3d17 --- /dev/null +++ b/changelog.d/10203-traversal-feedback-hot-tls.md @@ -0,0 +1,3 @@ +### fix(json): route the traversal-feedback counters through the hot thread-local cache + +`json/traversal_feedback.rs` declared its two per-thread counters with a raw `thread_local!`, which the thread-local policy ratchet (`scripts/check_thread_locals.py`) rejects; they now use `crate::perry_thread_local!` like every other runtime declaration, so the per-parse read lands in the hot TLS cache instead of a `_tlv_get_addr` call. diff --git a/crates/perry-runtime/src/json/traversal_feedback.rs b/crates/perry-runtime/src/json/traversal_feedback.rs index f3017b0305..55f3ea2d2f 100644 --- a/crates/perry-runtime/src/json/traversal_feedback.rs +++ b/crates/perry-runtime/src/json/traversal_feedback.rs @@ -40,9 +40,8 @@ const SCORE_MAX: u8 = 8; /// the evidence keeps being refreshed. const RESAMPLE_EVERY: u8 = 16; -// Two byte counters read once per parse: plain `thread_local!`, not the hot-TLS -// macro, and no heap pointer can live in either. -thread_local! { +// Two byte counters read once per parse. No heap pointer can live in either. +crate::perry_thread_local! { static SCORE: Cell = const { Cell::new(0) }; static EAGER_RUN: Cell = const { Cell::new(0) }; }