8000 gh-131798: Use `sym_new_type` instead of `sym_new_not_null` for _BUILD_STRING, _BUILD_SET by Zheaoli · Pull Request #132564 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131798: Use sym_new_type instead of sym_new_not_null for _BUILD_STRING, _BUILD_SET #132564

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

Merged
merged 13 commits into from
Apr 27, 2025
Prev Previous commit
Next Next commit
gh-131798: Add JIT path for _BUILD_STRING
Signed-off-by: Manjusaka <me@manjusaka.me>
  • Loading branch information
Zheaoli committed Apr 15, 2025
commit 445ec7de60ce9e2294b775aca7083ec4b2213c28
11 changes: 9 additions & 2 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,15 @@ dummy_func(void) {
}

op(_BUILD_STRING, (values[oparg] -- str)) {
if (sym_is_const(ctx, values[oparg])) {
PyObject *val = sym_get_const(ctx, values[oparg]);
bool is_const = true;
for (int i = 0; i < oparg; i++) {
if (!sym_is_const(ctx, values[i])) {
is_const = false;
break;
}
}
if (is_const) {
PyObject *val = sym_get_const(ctx, values[0]);
str = sym_new_const(ctx, val);
Py_DecRef(val);
}
Expand Down
30 changes: 13 additions & 17 deletions Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
0