Skip to content

Eagerly allocate stack map spill slots when processing a block#13498

Merged
fitzgen merged 3 commits into
bytecodealliance:mainfrom
fitzgen:wasmtime-issue-13480
May 27, 2026
Merged

Eagerly allocate stack map spill slots when processing a block#13498
fitzgen merged 3 commits into
bytecodealliance:mainfrom
fitzgen:wasmtime-issue-13480

Conversation

@fitzgen

@fitzgen fitzgen commented May 27, 2026

Copy link
Copy Markdown
Member

In the safepoint spiller, eagerly allocate stack map spill slots when processing a block. This ensures that values that are live-out in the same block can never share a single stack map spill slot, which could otherwise happen with loop-invariant values that need inclusion in stack maps but which "don't" have an overlapping live range with a value defined inside the loop body if you only consider a single iteration (which is effectively what ignoring the live-out set accidentally did).

Supersedes #13480

Fixes #13461

In the safepoint spiller, eagerly allocate stack map spill slots when processing
a block. This ensures that values that are live-out in the same block can never
share a single stack map spill slot, which could otherwise happen with
loop-invariant values that need inclusion in stack maps but which "don't" have
an overlapping live range with a value defined inside the loop body if you only
consider a single iteration (which is effectively what ignoring the live-out set
accidentally did).

Co-Authored-By: Jérôme Vouillon <jerome.vouillon@gmail.com>
@fitzgen fitzgen requested review from a team as code owners May 27, 2026 18:53
@fitzgen fitzgen requested review from cfallin and removed request for a team May 27, 2026 18:53

@cfallin cfallin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fitzgen fitzgen mentioned this pull request May 27, 2026
14 tasks
@cfallin cfallin enabled auto-merge May 27, 2026 18:55
Comment thread tests/disas/gc/copying/ref-test-array.wat Outdated
@fitzgen fitzgen disabled auto-merge May 27, 2026 20:03
@fitzgen fitzgen enabled auto-merge May 27, 2026 20:03
@fitzgen fitzgen added this pull request to the merge queue May 27, 2026
Merged via the queue into bytecodealliance:main with commit 6f1afec May 27, 2026
51 checks passed
@fitzgen fitzgen deleted the wasmtime-issue-13480 branch May 27, 2026 20:37
yagehu pushed a commit to yagehu/wasmtime-x that referenced this pull request Jun 1, 2026
…odealliance#13498)

* Eagerly allocate stack map spill slots when processing a block

In the safepoint spiller, eagerly allocate stack map spill slots when processing
a block. This ensures that values that are live-out in the same block can never
share a single stack map spill slot, which could otherwise happen with
loop-invariant values that need inclusion in stack maps but which "don't" have
an overlapping live range with a value defined inside the loop body if you only
consider a single iteration (which is effectively what ignoring the live-out set
accidentally did).

Co-Authored-By: Jérôme Vouillon <jerome.vouillon@gmail.com>

* update disas test expectations

* Only pre-allocate stack slots for values that are live across a safepoint

---------

Co-authored-by: Jérôme Vouillon <jerome.vouillon@gmail.com>
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.

Cranelift: GC reference reads back as null after a call safepoint (regression from #13228)

3 participants