8000 gh-115859: Re-enable T2 optimizer pass by default by gvanrossum · Pull Request #116062 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115859: Re-enable T2 optimizer pass by default #116062

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 9 commits into from
Feb 28, 2024
Prev Previous commit
Next Next commit
Add DECREF(temp) and out-of-space checks
  • Loading branch information
gvanrossum committed Feb 28, 2024
commit e64d0c14b80b6e1a365d7d26c7624d7b3908c455
12 changes: 9 additions & 3 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ dummy_func(void) {
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to decref it here too on this error branch? Or am I remembering the ownership wrongly? Same for everything below.

Might be better to write it as:

res = sym_new_const(ctx, temp);
Py_DECREF(temp);
OUT_OF_SPACE_IF_NULL(res);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyLong_Type));
Expand All @@ -137,6 +138,7 @@ dummy_func(void) {
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyLong_Type));
Expand All @@ -155,6 +157,7 @@ dummy_func(void) {
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyLong_Type));
Expand All @@ -171,9 +174,10 @@ dummy_func(void) {
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyFloat_Type));
Expand All @@ -190,9 +194,10 @@ dummy_func(void) {
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyFloat_Type));
Expand All @@ -209,9 +214,10 @@ dummy_func(void) {
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
Py_DECREF(temp);
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyFloat_Type));
Expand Down
12 changes: 9 additions & 3 deletions Python/optimizer_cases.c.h

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

0