Skip to content

ZJIT: Stop tracking EP == BP assumption on JIT entry #13752

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jun 30, 2025

This PR stops tracking the EP == BP assumption when loading method parameters on JIT entry. It makes test_gc.rb and test_thread.rb pass and reduces the number of failures in test_eval.rb and test_insns.rb.

The current gen_getlocal() function (renamed to gen_entry_param() in this PR) was meant to be used for any Ruby local variable read, so it keeps track of the EP == BP assumption for optimization. However, we ended up using the function only for loading method parameters. In that case, because we load them before the main JIT code, no arbitrary method runs before the loads. So we don't need to invalidate them.

I do think we need to implement a PatchPoint in HIR that assumes EP == BP at some point. So I left the track_no_ep_escape_assumption / iseq_escapes_ep machinery in invariants.rs as is for now.

Copy link

launchable-app bot commented Jul 1, 2025

Tests Failed

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

@tekknolagi
Copy link
Contributor

I'm unfamiliar with this particular assumption. When might EP not be BP? Is this a global effect or scoped to a frame? An ISEQ? Something else? Is this recognizable statically in HIR or do we have to track it happening somewhere in the runtime with a hook?

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