Fix safepoint stack slot reuse#13469
Open
angelnereira wants to merge 1 commit into
Open
Conversation
gfx
added a commit
to wado-lang/wasmtime
that referenced
this pull request
May 24, 2026
Backport of bytecodealliance#13469 (fixes bytecodealliance#13461). The safepoint spiller walks instructions backwards and can free a stack slot for a value defined by a safepoint instruction before assigning stack-map slots for values live across that same safepoint. If the freed slot is reused, the stack map can point at a slot that contains the instruction result rather than the value that must remain live across the call. This surfaced as a `null reference` trap on a provably non-null GC ref carried across a call safepoint. Reorder the rewrite so safepoint stack-map entries are assigned before result slots for that instruction are freed for reuse. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Confirmed — this fixes #13461 on our end. We originally hit the What I did:
Thanks for the quick turnaround. |
gfx
added a commit
to wado-lang/wado
that referenced
this pull request
May 24, 2026
Bump the vendor/wasmtime fork (wado-lang/wasmtime, gfx/wasmtime-45) to pick up the backport of bytecodealliance/wasmtime#13469, which fixes the Cranelift safepoint-spiller regression (#13461) that miscompiled GC refs live across call safepoints into null reads. This unblocks the wasmtime 44->45 upgrade: the 7 previously failing e2e tests (serde_json_* and value_copy_nested_array_helper_chain) now pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gfx
added a commit
to wado-lang/wado
that referenced
this pull request
May 24, 2026
Bump the vendor/wasmtime fork (wado-lang/wasmtime, gfx/wasmtime-45) to pick up the backport of bytecodealliance/wasmtime#13469, which fixes the Cranelift safepoint-spiller regression (#13461) that miscompiled GC refs live across call safepoints into null reads. This unblocks the wasmtime 44->45 upgrade: the 7 previously failing e2e tests (serde_json_* and value_copy_nested_array_helper_chain) now pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gfx
added a commit
to wado-lang/wado
that referenced
this pull request
May 24, 2026
Bump the vendor/wasmtime fork (wado-lang/wasmtime, gfx/wasmtime-45) to pick up the backport of bytecodealliance/wasmtime#13469, which fixes the Cranelift safepoint-spiller regression (#13461) that miscompiled GC refs live across call safepoints into null reads. This unblocks the wasmtime 44->45 upgrade: the 7 previously failing e2e tests (serde_json_* and value_copy_nested_array_helper_chain) now pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #13461.
The safepoint spiller walks instructions backwards and can free a stack slot for a value defined by a safepoint instruction before assigning stack-map slots for values live across that same safepoint. If the freed slot is reused, the stack map can point at a slot that contains the instruction result rather than the value that must remain live across the call.
This changes the rewrite order so safepoint stack-map entries are assigned before result slots for that instruction are freed for reuse. It also adds the GC regression test from the issue to cover the null-reference trap that exposed this.
Testing