Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Tier 2 optimizer: Don't throw away good traces if we can't optimize t…
…hem perfectly.
  • Loading branch information
markshannon committed Mar 20, 2024
commit 711d7e760eee64bfe1ae591eb3dc1a0e5b8f713c
13 changes: 7 additions & 6 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,24 +406,25 @@ optimize_uops(
out_of_space:
DPRINTF(3, "\n");
DPRINTF(1, "Out of space in abstract interpreter\n");
_Py_uop_abstractcontext_fini(ctx);
return 0;

goto done;
error:
DPRINTF(3, "\n");
DPRINTF(1, "Encountered error in abstract interpreter\n");
_Py_uop_abstractcontext_fini(ctx);
return 0;
return -1;

hit_bottom:
// Attempted to push a "bottom" (contradition) symbol onto the stack.
// This means that the abstract interpreter has hit unreachable code.
// We *could* generate an _EXIT_TRACE or _FATAL_ERROR here, but it's
// simpler to just admit failure and not create the executor.
// simpler to just leave the rest of the trace alone.
DPRINTF(3, "\n");
DPRINTF(1, "Hit bottom in abstract interpreter\n");
done:
/* Cannot optimize further, but there would be no benefit
* in retrying later */
Comment thread
gvanrossum marked this conversation as resolved.
_Py_uop_abstractcontext_fini(ctx);
return 0;
return 1;
}


Expand Down
4 changes: 3 additions & 1 deletion Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,9 @@ dummy_func(void) {
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
DPRINTF(3, "func: %p ", func);
if (func == NULL) {
goto error;
DPRINTF(3, "\n");
DPRINTF(1, "Missing function\n");
goto done;
Comment thread
gvanrossum marked this conversation as resolved.
}
PyCodeObject *co = (PyCodeObject *)func->func_code;

Expand Down
4 changes: 3 additions & 1 deletion Python/optimizer_cases.c.h

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