Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Python/optimizer_bytecodes.c Outdated
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 instr(foo)
,foo
is known to be a string, we can propagate it to the output. I also added a test for this case.
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:
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
0a387b3
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks for the review! |
Uh oh!
There was an error while loading.Please reload this page.
CALL_STR_1
is 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
.