-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ZJIT: Inline struct aref #15008
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
ZJIT: Inline struct aref #15008
Conversation
a5abdd5 to
7e50aca
Compare
struct.c
Outdated
| } | ||
|
|
||
| bool | ||
| rb_yarv_struct_instances_embedded_p(VALUE klass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the best way to do this. YJIT does it by inspecting an instance, which we don't have. Maybe we could add it to profiles? :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use recv_type.flags().is_embedded()?
EDIT: nevermind it's a different bit for structs than T_OBJECTs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I thought that was only for ivars. If not then yes we can absolutely do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding a new bit
zjit/src/hir.rs
Outdated
| .try_into() | ||
| .unwrap(); | ||
| // Confidence checks | ||
| // assert!(unsafe { RB_TYPE_P(recv, RUBY_T_STRUCT) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to figure out a way to keep these kinds of checks in ZJIT
struct.c
Outdated
| } | ||
|
|
||
| bool | ||
| rb_yarv_struct_instances_embedded_p(VALUE klass) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use recv_type.flags().is_embedded()?
EDIT: nevermind it's a different bit for structs than T_OBJECTs.
7e50aca to
b252afc
Compare
Per #15002, this happens frequently in benchmarks.