-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-131798: JIT: Split CALL_STR_1 into several uops #132849
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
| if (sym_matches_type(arg, &PyUnicode_Type)) { | ||
| // e.g. str('foo') or str(foo) where foo is known to be a string | ||
| PyObject *value = sym_get_const(ctx, arg); | ||
| res = sym_new_const(ctx, value); | ||
| } |
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 an optimization that Brandt suggested. When in str(foo), foo is known to be a string, we can propagate it to the output. I also added a test for this case.
brandtbucher
left a comment
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.
Looks great! Just two suggestions:
|
Thanks for the review! |
CALL_STR_1is equivalent tostr(...).Very similar to previous work on splitting up
CALL_TYPE_1: #132419This splits the instruction into a smaller instruction + 2 guards which can be optimized away. This also sets the return type to
str.