ZJIT: Add a simple HIR validator by Fidget-Spinner · Pull Request #13780 · ruby/ruby · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

ZJIT: Add a simple HIR validator #13780

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 6 commits into
base: master
Choose a base branch
from

Conversation

Fidget-Spinner
Copy link

This PR adds a simple validator for ZJIT's HIR.

See issue Shopify#591

@matzbot matzbot requested a review from a team July 3, 2025 14:47
@Fidget-Spinner
Copy link
Author

cc @tekknolagi

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.

Nice start--looking good

zjit/src/hir.rs Outdated
}

fn validate_block_uses(&self) {
// TODO(kenjin): Need to validate all uses and kills are properly gen-ed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Will you be doing this in this PR? If not, let's remove this function for now

Copy link
Author

Choose a reason for hiding this comment

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

Removed this function, will be done in another follow-up, as it might be a little slow to run.

@Fidget-Spinner
Copy link
Author

Sorry: new to ruby contributing. Should I force push or will you squash merge at the end?

@tekknolagi
Copy link
Contributor

I can squash at the end. If you have multiple logical commits that you would like preserved, you should force push and I can rebase

@Fidget-Spinner
Copy link
Author

I can squash at the end. If you have multiple logical commits that you would like preserved, you should force push and I can rebase

Nope I don't. Please squash and overwrite the commit message with your own at the end. Thanks!

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.

Nice, looks good!

@tekknolagi
Copy link
Contributor

If you have time, please add some tests for this, but it's not dire. I will otherwise merge tonight or Monday

@Fidget-Spinner
Copy link
Author

I would add tests, but I'm not too sure how to at the moment. We'd basically need to pass a malformed iseq to the translation function and have it fail on validation right? Not sure how to construct an iseq in Rust in the first place considering rb_iseq_t is an opaque struct in Rust. There's probably some way to do it in C land, but I'm not familiar enough with the Ruby internals to achieve that yet.

@tekknolagi
Copy link
Contributor

No, we'd construct the HIR manually---not from an ISEQ

@Fidget-Spinner
Copy link
Author

Ah ok, I was under the impression you wanted an integration test for iseq_to_hir with the validator. That makes more sense now :). I'll add tests for this in another PR if you're okay with it. The fact it passes everything is a pretty strong indicator it's at least not detecting any false positives.

@Fidget-Spinner
Copy link
Author

Fidget-Spinner commented Jul 3, 2025

Oh nevermind, I just found out rpo_tests exists. I can just copy some tests from there. Will have it done by tomorrow.

This comment has been minimized.

@Fidget-Spinner
Copy link
Author

The failures look to be flakiness of Ractor tests. This PR doesnt touch Ractors at all so I'm not concerned.

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

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.