Skip to content

runtime: the super path no longer reads PERRY_SUPER_DEBUG (three leftover debug prints removed) - #14474

Merged
proggeramlug merged 2 commits into
mainfrom
runtime/super-debug-prints-removed
Nov 11, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
runtime/super-debug-prints-removed

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Removes the three if std::env::var_os("PERRY_SUPER_DEBUG").is_some() { eprintln!(...) } blocks from crates/perry-runtime/src/object/class_constructors.rs (super_apply entry, super_apply resolved ancestor, flat_super). The super path no longer reads any environment variable. git grep PERRY_SUPER_DEBUG -- crates/ is empty. 25 lines deleted, nothing added.

Why

The switch is a leftover from two old fixes (#5050, #5959); nothing else reads it. Each block cost an environment lookup per super call. The alternative, reading it once through a OnceLock, was rejected: it adds a once-check on the hot run_class_constructor_on_this_flat path and bytes to every binary:

witness once-reader Ir delta .text delta
hello 0 +64
commander_help -166 +64
commander 0 +64
fastify_inject +9 +64
awfy_richards +1 +80
binary_trees 0 +64

Startup may not grow and a debug switch should not cost bytes in every binary, so the prints are deleted.

Gate (exact callgrind Ir, 5 runs/arm, main arm b2a72cf = base, same binary path, setarch -R, /root/ctl controls; A/A all 0)

witness main head delta fns +
hello 868708 868708 0 0
commander_help 17211127 17211150 +23 2
commander 17517323 17517323 0 0
fastify_inject 151158952 151158952 0 0
awfy_richards 37339467 37339476 +9 1
binary_trees 14490929721 14490929689 -32 0

The two + rows are layout-derived:

  • awfy_richards +9: one function, core::str::converts::from_utf8 (+30 Ir). Per-callee call counts are identical (2292 callees, 0 differing; from_utf8 2109 calls both arms). run_class_constructor_on_this_flat itself is -3 Ir.
  • commander_help +23: _Unwind_Find_FDE +160 and capture_js_return_addresses +2, offset by -5/-28 in find_handler / gimli parse. _Unwind_Find_FDE is called 18 times in both arms; the only differing call counts are gimli parse_encoded_pointer 117 vs 116 and parse_encoded_value 133 vs 132, i.e. one fewer step in the eh_frame_hdr binary search, which follows the FDE table (the head runtime has one more FDE). Not in any touched function.
  • The once-reader variant's decode_raw_pointer_candidate 3845 vs 3848 does not recur: fastify_inject is 3845/3845, 0 differing callees.

.text (readelf, bytes)

witness main head delta (unpadded) padded gate binaries
hello 5931150 5930430 -720 equal (5931150)
commander_help 9934974 9934270 -704 equal
commander 9934974 9934270 -704 equal
fastify_inject 23961406 23960702 -704 equal
awfy_richards 9770382 9768878 -1504 equal
binary_trees 5964862 5964142 -720 equal

hello file size 8942592 -> 8942464 (-128). hello md5 (unpadded) main 228e8a063dd2740528e3e15348d6253c, head 9f3f1d86f58dcb01176ae6f605a4fcb6.

Tests

  • RUSTFLAGS="-D warnings" cargo check -p perry-runtime: fails only on main's existing unused import at crates/perry-runtime/src/intl.rs:72 (no warning in class_constructors.rs).
  • cargo check --workspace --exclude perry-ui-gtk4: ok.
  • RUST_TEST_THREADS=1 cargo test --release -p perry-runtime: 6667 passed, 0 failed, 48 ignored.

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@proggeramlug
proggeramlug marked this pull request as ready for review November 11, 2026 15:52
@proggeramlug
proggeramlug merged commit 3a943a3 into main Nov 11, 2026
95 of 102 checks passed
@proggeramlug
proggeramlug deleted the runtime/super-debug-prints-removed branch November 11, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant