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
3 changes: 3 additions & 0 deletions changelog.d/9970-product-warnings-dead-code.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions crates/perry-runtime/src/gc/barrier_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions crates/perry-runtime/src/object/regex_proto_thunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,26 +322,32 @@ 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(&REGEXP_PROTOTYPE_PTR_SLOT);
#[cfg(any(test, feature = "regex-engine"))]
pub(crate) static REGEXP_PROTOTYPE_TEST_CLOSURE: super::RealmAtomicU64 =
super::RealmAtomicU64::new(&REGEXP_PROTOTYPE_TEST_CLOSURE_SLOT);

/// How many by-name walks the canonicality proof has done in this process.
/// 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);

Expand Down
Loading