-
Notifications
You must be signed in to change notification settings - Fork 5.4k
YJIT: Side-exit on String#dup when it's not leaf #13921
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
Conversation
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.
lgtm with one q
shape.h
Outdated
@@ -48,7 +48,8 @@ enum shape_id_fl_type { | |||
|
|||
// This masks allows to check if a shape_id contains any ivar. | |||
// It rely on ROOT_SHAPE_WITH_OBJ_ID==1. | |||
#define SHAPE_ID_HAS_IVAR_MASK (SHAPE_ID_FL_TOO_COMPLEX | (SHAPE_ID_OFFSET_MASK - 1)) | |||
#define SHAPE_ID_HAS_IVAR_MASK 0x807fffe |
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.
Why do you need this constant inline?
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.
For bindgen.
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.
This is a bindgen limitation where it can't tell whether a macro is a constant. An alternative is to put the expression in an anonymous enum, which bindgen can figure out since it's a language level thing to force a value to be compile time known and not allocate storage for it.
Could you try that? If it doesn't work for some C code or whatever, as is isn't too horrible.
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.
sure thing
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.
A secret third thing is to make a uint32_t abc = SHAPE_ID_HAS_IVAR_MASK
in jit.c
and then bindgen 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.
(If we care about signedness, which it looks like we do, we can't really rely on enum signedness. and I think enum width, too)
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.
like this? fae2039
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.
No need to worry about signedness because the operands in the expression come from enum themselves 😁 Go integer promotion.
This fixes ccbbe06.
rb_obj_dup
is not leaf, so it gives a wrong backtrace if you skip pushing a frame when the string has ivars and falls back torb_obj_dup
. This PR changes it to side-exit, reversing the simplification we made in #13606.