8000 YJIT: Stop padding nops at jump instructions on Arm by k0kubun · Pull Request #6755 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

YJIT: Stop padding nops at jump instructions on Arm #6755

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

Closed
wants to merge 1 commit into from

Conversation

k0kubun
Copy link
Member
@k0kubun k0kubun commented Nov 17, 2022

Background

When we ported YJIT to Arm64, jump instructions used to appear very often in short blocks that could be invalidated. Small invalidation points were typically a YJIT entry, a jump instruction, or just long enough. So it was enough to just pad YJIT entries (with PadEntryExit IR, which was then renamed to PadInvalPatch) and jump instructions.

However, when we changed the code layout #6460 for Code GC, many other instructions also started to appear in places that need invalidation; the beginning of a page. So we built a more robust solution to the padding for invalidation: PadInvalPatch, which is an IR added to every invalidation point, including YJIT entries.

As long as we have PadInvalPatch on every invalidation point, the PadInvalPatch should be able to add padding even if jump instructions don't do that.

Changes

So this PR stops padding nops on jump instructions, fully delegating the job to PadInvalPatch. This makes A LOT of jump instructions on Arm shorter. This is the actual performance gain that #6460 was supposed to deliver.

@k0kubun k0kubun changed the title YJIT: Stop padding nops at emit_conditional_jump YJIT: Stop padding nops at jump instructions on Arm Nov 17, 2022
@k0kubun
Copy link
Member Author
k0kubun commented Nov 17, 2022

looks like invalidation was not the only consideration point; we also need to make the "branch stubs should never enlarge branches" assertion happy. I think this approach is still a valid idea, but I'll revisit/reopen this after fixing it locally.

@k0kubun k0kubun closed this Nov 17, 2022
@k0kubun k0kubun deleted the yjit-arm64-padding branch November 17, 2022 22:56
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
0