-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
GH-131798: Remove JIT guards for dict
, frozenset
, list
, set
, and tuple
#132289
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
GH-131798: Remove JIT guards for dict
, frozenset
, list
, set
, and tuple
#132289
Conversation
@Zheaoli and @tomasr8, you might be interested in checking this out. Specifically, see the changes in You can see that this PR breaks up the old, larger |
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.
Just one concern.
@@ -396,7 +396,6 @@ dummy_func(void) { | |||
op(_TO_BOOL_LIST, (value -- res)) { | |||
int already_bool = optimize_to_bool(this_instr, ctx, value, &res); | |||
if (!already_bool) { | |||
sym_set_type(value, &PyList_Type); |
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.
Does CONTAIN_OP_SET and CONTAIN_OP_DICT need to remove their sym setting type as well? Or is that not even happening at the moment?
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.
Not happening currently,. _CONTAINS_OP_SET
can't even set anything, since it handles both set
and frozenset
(this might be worth re-evaluating, or splitting up).
Thanks! I think I might need some time to understand this PR! Thanks for your patience! |
Going to go ahead and merge this to reduce the risk of merge conflicts, but let me know if you have any questions @Zheaoli! |
According to the stats, this removes:
tuple
guards (25%)set
/frozenset
guards (19%)dict
guards (42%)list
guards (34%)It also fixes a bug that I encountered in the optimizer's logic for
_UNPACK_SEQUENCE_TUPLE
, which puts items on the stack in reverse order.