Skip to content
Merged
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
12 changes: 12 additions & 0 deletions changelog.d/8164-stackmap-trace-knob-polarity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
`PERRY_GC_STACKMAP_TRACE` parses its value instead of its presence, restoring
the `lint` gate. The knob arrived in #8131 reading `var_os(..).is_some()`, which
inverts the spelling a reader is most likely to try: `PERRY_GC_STACKMAP_TRACE=0`
still sets the variable, so it turned the trace ON. `check_gc_env_knobs` — a
required-check audit that exists to keep every GC knob on the shared parser —
failed on it, and a red `lint` on main blocks every open PR.

It now uses `gc::env_flag_enabled`, the default-OFF parser (the same shape as
`policy.rs`'s `PERRY_GC_TRACE`), which fails toward the knob's documented
default so a typo leaves the instrument off rather than silently arming it.
`=1`/`on`/`true` still enable it and unset still leaves it off; `=0`/`off`/
`false`/`no` now disable it.
6 changes: 5 additions & 1 deletion crates/perry-runtime/src/gc/roots/stack_maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,11 @@ mod unwind {

fn walk_trace_enabled() -> bool {
static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
*ON.get_or_init(|| std::env::var_os("PERRY_GC_STACKMAP_TRACE").is_some())
// `env_flag_enabled`, not `var_os(..).is_some()`: presence-testing makes
// `PERRY_GC_STACKMAP_TRACE=0` ENABLE the trace, which is the opposite of
// what every other GC knob does and what anyone typing `=0` means. The
// shared parser fails toward the knob's documented default (OFF here).
*ON.get_or_init(|| crate::gc::env_flag_enabled("PERRY_GC_STACKMAP_TRACE"))
}

unsafe extern "C" fn walk_frame<F: FnMut(ResolvedRoot)>(
Expand Down
Loading