Skip to content

fork-instrument: replay pure scalar fork inputs#714

Open
brandonpayton wants to merge 1 commit into
debugger/pr701-catch-state-localsfrom
debugger/pr701-pure-scalar-materialization
Open

fork-instrument: replay pure scalar fork inputs#714
brandonpayton wants to merge 1 commit into
debugger/pr701-catch-state-localsfrom
debugger/pr701-pure-scalar-materialization

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Summary

Adds conservative pure scalar materialization to wasm-fork-instrument so replay-safe call arguments and condition-only nested carryovers are recomputed at the post-call/post-landing point instead of spilled through frame locals.

The whitelist is intentionally small: scalar constants, scalar local.get, and non-trapping scalar integer unary/binary ops. Calls, memory/table ops, globals, refs, div/rem, float ops, local.set/local.tee, and any stack-dependent suffix still fall back to the existing spill-local path.

PR #701 MRE Evidence

Measured with /tmp/kandelo-pr701-mre, Node v24.15.0, node --experimental-wasm-exnref, max cap 20000. Depth ties on this host, but declared locals show the frame-pressure reduction.

artifact benchmark_walk locals max_survived
uninstrumented baseline 4 9,959
pre-PR713 old artifact (chain.before.wasm) 8 9,959
PR #713 packed base (chain.pr713-packed.wasm) 6 9,959
this branch (chain.kd-pme.wasm) 4 9,959

Local-by-local: the PR #713 packed base had benchmark_walk locals (i32 i32 i32 i32 i32 i64). This branch has (i32 i32 i32 i64), matching the uninstrumented baseline. The two removed synthetic i32 locals are the recursive walk(depth - 1) argument spill and the eqz(depth) IfElse condition/carryover spill. Both are now replayed from pure scalar tails.

Verification

  • cargo test -p fork-instrument --target aarch64-apple-darwin --test instrument call_with_ -- --nocapture — 3 passed, 0 failed
  • cargo test -p fork-instrument --target aarch64-apple-darwin --test instrument call_indirect_replays_pure_table_index_arg -- --nocapture — 1 passed, 0 failed
  • cargo test -p fork-instrument --target aarch64-apple-darwin --test switch_dispatch omits_frame_header_state_locals -- --nocapture — 4 passed, 0 failed
  • cargo test -p fork-instrument --target aarch64-apple-darwin --test switch_dispatch pr701_shape_replays_pure_condition_and_recursive_arg -- --nocapture — 1 passed, 0 failed
  • scripts/dev-shell.sh cargo test -p fork-instrument --target aarch64-apple-darwin — 171 passed, 0 failed
  • scripts/dev-shell.sh bash scripts/check-abi-version.sh — ABI snapshot/header/TS bindings up to date; ABI_VERSION and snapshot consistent
  • git diff --check — clean

Not run: full kernel/host/libc/posix gates. This change is isolated to the fork-instrument rewrite tool and documentation; no kernel ABI, host runtime, libc, syscall, package, or browser path changed.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

Phase B-1 matrix build status — pr-714-staging

ABI v15. 52 built, 0 failed, 52 total.

Package Arch Status Sha
bc wasm32 built ed7ce7b8
bzip2 wasm32 built 892df627
coreutils wasm32 built 6c6b2f4d
curl wasm32 built ead181eb
dash wasm32 built c629e5d8
diffutils wasm32 built 456f5322
dinit wasm32 built b39f70a8
fbdoom wasm32 built d7ae7642
file wasm32 built 02660c1a
findutils wasm32 built a6979448
gawk wasm32 built 77f47cb4
git wasm32 built dff0aff7
grep wasm32 built d89c4145
gzip wasm32 built d3e9efc9
kandelo-sdk wasm32 built d9cb395c
kernel wasm32 built 71628a17
less wasm32 built bf2ac5a0
lsof wasm32 built 0712dd67
m4 wasm32 built 9846d848
make wasm32 built 4b7f856d
mariadb wasm32 built 99eb4106
mariadb wasm64 built 6011c9d9
modeset wasm32 built 2fa4678e
msmtpd wasm32 built 0f5d3cd7
nano wasm32 built 699fea5c
ncurses wasm32 built 3b90d7f5
netcat wasm32 built 3041ca64
nginx wasm32 built 8d390dca
php wasm32 built 7cdc999c
posix-utils-lite wasm32 built f108b0ac
sed wasm32 built 371b7e6e
tar wasm32 built 6858b329
tcl wasm32 built 5b7a648e
unzip wasm32 built 78615f88
userspace wasm32 built 1cdedce6
vim wasm32 built e032afe9
wget wasm32 built fd11dcb9
xz wasm32 built 013788d1
zip wasm32 built b9c1bdc7
zstd wasm32 built 5218e086
bash wasm32 built 693899e0
mariadb-test wasm32 built c027b38a
mariadb-vfs wasm32 built 956f0ad1
mariadb-vfs wasm64 built e8842c11
nethack wasm32 built 44186439
vim-browser-bundle wasm32 built 526382ba
nethack-browser-bundle wasm32 built 80fb1ada
rootfs wasm32 built 23a0788f
shell wasm32 built d47bb129
lamp wasm32 built a399cb6c
node-vfs wasm32 built 794aab2f
wordpress wasm32 built becde562

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

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