Skip to content

ZJIT: Mark the code region executable on partial failures #13937

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
Jul 17, 2025

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jul 17, 2025

This PR fixes a random bus error on yjit-bench for arm64.

ZJIT compilation currently has three phases that run asm.compile():

  1. gen_function(): Compiles the first ISEQ body
  2. gen_entry(): Compiles the trampoline to enter the ISEQ's JIT code
  3. gen_iseq(): Compiles callee ISEQs for JIT-to-JIT calls

Once it reaches the emit pass of (1), it modifies the code region state. So, even if (2) or (3) fails, you need to run cb.mark_all_executable() after (1). Currently, it does not call cb.mark_all_executable() when (3) fails, so that's the problem this PR fixes. To reduce the possibility of making this mistake again, I made a wrapper function that does it.

@k0kubun k0kubun marked this pull request as ready for review July 17, 2025 18:24
@matzbot matzbot requested a review from a team July 17, 2025 18:24
Copy link
Contributor

@tekknolagi tekknolagi left a comment

Choose a reason for hiding this comment

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

Awesome!

@k0kubun k0kubun linked an issue Jul 17, 2025 that may be closed by this pull request
@k0kubun k0kubun merged commit ff77473 into ruby:master Jul 17, 2025
81 of 82 checks passed
@k0kubun k0kubun deleted the zjit-mark-exec branch July 17, 2025 18:39
Copy link

Tests Failed

✖️no tests failed ✔️62106 tests passed(1 flake)

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: Bus Error on micro-benchmarks for arm64
3 participants