Skip to content

ZJIT: Spill whole FrameState in Insn::SendWithoutBlock #14308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2025

Conversation

XrXr
Copy link
Member

@XrXr XrXr commented Aug 22, 2025

Previously, we only spilled the arguments necessary for the particular
send. In case the callee raises and a rescue resumes the ISEQ, that
did not present a complete stack state. E.g. in [1, (raise rescue 2)]
the raise send only spills self, when 1 also needs to be spilled.

Spill the whole stack. Adjust parsing for opt_aref_with since the
key argument for the send now needs to be described by the frame state
of the send.

This changes the contract for Insn::SendWithoutBlock to use arguments
from the interpreter stack as described by its frame state.


self_val and args are now redundant, but I'd like to do the removal
in a separate diff to keep this one focused on the bugfix.

@matzbot matzbot requested a review from a team August 22, 2025 18:27
@XrXr XrXr linked an issue Aug 22, 2025 that may be closed by this pull request
Copy link
Member

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

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

Nice!

It seems like you need to fix HIR tests to pass zjit-check.

Previously, we only spilled the arguments necessary for the particular
send. In case the callee raises and a rescue resumes the ISEQ, that
did not present a complete stack state. E.g. in `[1, (raise rescue 2)]`
the raise send only spills `self`, when `1` also needs to be spilled.

Spill the whole stack. Adjust parsing for `opt_aref_with` since the
key argument for the send now needs to be described by the frame state
of the send.

This changes the contract for `Insn::SendWithoutBlock` to use arguments
from the interpreter stack as described by its frame state.
@XrXr XrXr force-pushed the zjit-fallback-full-spill branch from b1bc679 to 6260b20 Compare August 22, 2025 21:31
@XrXr XrXr enabled auto-merge (rebase) August 22, 2025 21:52
@XrXr XrXr merged commit 5b5b5b3 into ruby:master Aug 23, 2025
89 of 91 checks passed
@XrXr XrXr deleted the zjit-fallback-full-spill branch August 23, 2025 00:13
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.

ZJIT: SendWithoutBlock should spill the entire stack
2 participants