Skip to content

YJIT: Fix getconstant exits after opt_ltlt fusion #10903

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
Jun 4, 2024

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jun 3, 2024

Follow-up to #10401

This PR fixes a crash on SFR. When opt_ltlt fusion returns SkipNextInsn, it updates insn_idx variable to skip the next instruction. When the next instruction is opt_getconstant_path, it calls jump_to_next_insn before jit.insn_idx = insn_idx. For that reason, opt_getconstant_path ends up exiting with a wrong PC, using an old insn_idx.

It also ends the block at opt_ltlt like other method calls. It's probably nice to share the successor block by ending the block like in case the receiver class varies. So we removed SkipNextInsn and just made a jump.

Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
@k0kubun k0kubun marked this pull request as ready for review June 3, 2024 23:15
@matzbot matzbot requested a review from a team June 3, 2024 23:16
@maximecb
Copy link
Contributor

maximecb commented Jun 4, 2024

Good work catching this bug.

One thing that seems slightly annoying is that this would seem to create more blocks, and so increase memory usage? I will merge the PR because correctness is the most important, but I guess in the medium to long term we really want to propagate constants through the context, and/or come up with a better way to do op fusion 🤔

@maximecb maximecb merged commit a2147eb into ruby:master Jun 4, 2024
100 checks passed
@k0kubun k0kubun deleted the yjit-skip-fuse branch June 4, 2024 17:09
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.

2 participants