From 31a9d087929af27b2a86de8b02fa97b6f1d33572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Mon, 7 Sep 2026 18:01:57 +0200 Subject: [PATCH 1/2] fix(runtime): gate feature-only product helpers Keep the no-default-features product build free of dead-code warnings while retaining every helper where its regex feature or unit tests need it. Dispositions: - newborn_parent_needs_barrier: cfg(test or regex-engine); feature + tests use it. - REGEXP_PROTOTYPE_PTR_SLOT: cfg(test or regex-engine); feature GC root backing. - REGEXP_PROTOTYPE_TEST_CLOSURE_SLOT: cfg(test or regex-engine); feature root backing. - REGEXP_PROTOTYPE_TEST_INDEX_SLOT: cfg(test or regex-engine); feature scalar backing. - REGEXP_PROTOTYPE_PTR: cfg(test or regex-engine); feature fast path/root scanner. - REGEXP_PROTOTYPE_TEST_CLOSURE: cfg(test or regex-engine); feature fast path/scanner. - REGEXP_PROTOTYPE_TEST_WALKS: cfg(test or regex-engine); feature/test diagnostic. Claude-Session: https://claude.ai/code/session_011dhBmdn4vGgNibjo3oZqTo --- changelog.d/9949-product-warnings-dead-code.md | 3 +++ crates/perry-runtime/src/gc/barrier_store.rs | 1 + crates/perry-runtime/src/object/regex_proto_thunks.rs | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 changelog.d/9949-product-warnings-dead-code.md diff --git a/changelog.d/9949-product-warnings-dead-code.md b/changelog.d/9949-product-warnings-dead-code.md new file mode 100644 index 0000000000..3469ac0bcd --- /dev/null +++ b/changelog.d/9949-product-warnings-dead-code.md @@ -0,0 +1,3 @@ +Fix the no-default-features product build under `-D warnings` by compiling +RegExp-only GC barrier and prototype-site state only for tests or when the +`regex-engine` feature is enabled. diff --git a/crates/perry-runtime/src/gc/barrier_store.rs b/crates/perry-runtime/src/gc/barrier_store.rs index 2b43c80240..3891f84e50 100644 --- a/crates/perry-runtime/src/gc/barrier_store.rs +++ b/crates/perry-runtime/src/gc/barrier_store.rs @@ -370,6 +370,7 @@ pub(super) fn barrier_remembering_active() -> bool { /// validated) — the same contract `emit_parent_may_need_remembering_check` /// places on its caller. #[inline] +#[cfg(any(test, feature = "regex-engine"))] pub(crate) unsafe fn newborn_parent_needs_barrier(parent_addr: usize) -> bool { if !super::barrier::incremental_mark_barrier_globally_idle() { return true; diff --git a/crates/perry-runtime/src/object/regex_proto_thunks.rs b/crates/perry-runtime/src/object/regex_proto_thunks.rs index 389499db5d..58bbc07d59 100644 --- a/crates/perry-runtime/src/object/regex_proto_thunks.rs +++ b/crates/perry-runtime/src/object/regex_proto_thunks.rs @@ -322,19 +322,24 @@ crate::perry_thread_local! { /// towers, which both marks it and rewrites it when the collector moves the /// object. A recorded address that is not scanned is a stale pointer the /// first time the prototype moves — the #9539/#9445 shape. + #[cfg(any(test, feature = "regex-engine"))] static REGEXP_PROTOTYPE_PTR_SLOT: std::sync::atomic::AtomicI64 = const { std::sync::atomic::AtomicI64::new(0) }; /// The canonical `test` closure, NaN-boxed. Also a root, visited as a /// nanbox word so the collector rewrites the pointer inside it. + #[cfg(any(test, feature = "regex-engine"))] static REGEXP_PROTOTYPE_TEST_CLOSURE_SLOT: std::sync::atomic::AtomicU64 = const { std::sync::atomic::AtomicU64::new(0) }; /// The field index its own `test` occupies. Not an address, so not a root. + #[cfg(any(test, feature = "regex-engine"))] static REGEXP_PROTOTYPE_TEST_INDEX_SLOT: std::sync::atomic::AtomicU32 = const { std::sync::atomic::AtomicU32::new(u32::MAX) }; } +#[cfg(any(test, feature = "regex-engine"))] pub(crate) static REGEXP_PROTOTYPE_PTR: super::RealmAtomicI64 = super::RealmAtomicI64::new(®EXP_PROTOTYPE_PTR_SLOT); +#[cfg(any(test, feature = "regex-engine"))] pub(crate) static REGEXP_PROTOTYPE_TEST_CLOSURE: super::RealmAtomicU64 = super::RealmAtomicU64::new(®EXP_PROTOTYPE_TEST_CLOSURE_SLOT); @@ -342,6 +347,7 @@ pub(crate) static REGEXP_PROTOTYPE_TEST_CLOSURE: super::RealmAtomicU64 = /// The fast path does none: the only walk is the one-time recording below, so /// this must read **1 per realm**, not one per call. It is the counter that /// says the fast path is actually the path being taken. +#[cfg(any(test, feature = "regex-engine"))] pub(crate) static REGEXP_PROTOTYPE_TEST_WALKS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); From d5115dfc1f5c8ac976cfe4a64e1ec9c17f1c08d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Mon, 7 Sep 2026 18:04:25 +0200 Subject: [PATCH 2/2] chore(changelog): name the fragment after its PR (#9970) Claude-Session: https://claude.ai/code/session_011dhBmdn4vGgNibjo3oZqTo --- ...t-warnings-dead-code.md => 9970-product-warnings-dead-code.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{9949-product-warnings-dead-code.md => 9970-product-warnings-dead-code.md} (100%) diff --git a/changelog.d/9949-product-warnings-dead-code.md b/changelog.d/9970-product-warnings-dead-code.md similarity index 100% rename from changelog.d/9949-product-warnings-dead-code.md rename to changelog.d/9970-product-warnings-dead-code.md