Skip to content

ZJIT: Add newrange support #13505

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 3 commits into from
Jun 5, 2025
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jun 3, 2025

@matzbot matzbot requested a review from a team June 3, 2025 18:41

This comment has been minimized.

@st0012 st0012 force-pushed the add-range-support-to-zjit branch from a093af0 to d73b3ab Compare June 3, 2025 20:35
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.

lgtm pending some comments!

flag: u32,
state: &FrameState,
) -> lir::Opnd {
asm_comment!(asm, "call rb_range_new");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this should go by the ccall

Copy link
Member Author

Choose a reason for hiding this comment

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

In gen_array_dup it also uses call rb_ary_resurrect while doing asm.ccall. Should we be consistent and update that and other occurrences like this to use ccall {instruction name}?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we should probably move the comments. I think it is a quirk of the PC saving being added later

zjit/src/hir.rs Outdated
@@ -334,6 +334,7 @@ pub enum Insn {
NewArray { elements: Vec<InsnId>, state: InsnId },
/// NewHash contains a vec of (key, value) pairs
NewHash { elements: Vec<(InsnId,InsnId)>, state: InsnId },
NewRange { low: InsnId, high: InsnId, flag: u32, state: InsnId },
Copy link
Contributor

Choose a reason for hiding this comment

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

Please convert flag into a Rust-style enum if it's just Inclusive|Exclusive

Copy link
Contributor

Choose a reason for hiding this comment

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

(What are the options?)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, it's a bool called exclude_end. i think enum { Inclusive, Exclusive } makes sense here

Copy link
Contributor

Choose a reason for hiding this comment

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

Last, we don't have this yet, but in a stack @tenderlove and I are working on, we have an ObjectAlloc instruction, so we can probably eventually split this into ObjectAlloc+FieldSet+FieldSet or something similar. But again, these instructions don't exist now

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean we will be splitting new_something instructions into a combination of field set instructions + ObjectAlloc?

Copy link
Contributor

Choose a reason for hiding this comment

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

Likely yes

@tekknolagi
Copy link
Contributor

Oh also I think PR/comment should be prefixed with "ZJIT:" like "ZJIT: Parse newrange into HIR"

@st0012 st0012 changed the title Add newrange support to zjit ZJIT: Add newrange support Jun 4, 2025
@st0012 st0012 force-pushed the add-range-support-to-zjit branch 3 times, most recently from 27447c4 to fb9f3d4 Compare June 4, 2025 20:19
@st0012 st0012 requested a review from tekknolagi June 4, 2025 20:19
@st0012 st0012 force-pushed the add-range-support-to-zjit branch from fb9f3d4 to 207ee93 Compare June 4, 2025 22:00
Copy link
Member

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

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

👍

@k0kubun k0kubun merged commit 111986f into ruby:master Jun 5, 2025
82 checks passed
@k0kubun k0kubun deleted the add-range-support-to-zjit branch June 5, 2025 01:51
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.

3 participants