mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-117066: Tier 2 optimizer: Don't throw away good traces if we can't optimize them perfectly. (GH-117067)
This commit is contained in:
parent
dcaf33a41d
commit
63289b9dfb
3 changed files with 16 additions and 8 deletions
|
@ -406,24 +406,28 @@ optimize_uops(
|
||||||
out_of_space:
|
out_of_space:
|
||||||
DPRINTF(3, "\n");
|
DPRINTF(3, "\n");
|
||||||
DPRINTF(1, "Out of space in abstract interpreter\n");
|
DPRINTF(1, "Out of space in abstract interpreter\n");
|
||||||
_Py_uop_abstractcontext_fini(ctx);
|
goto done;
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
DPRINTF(3, "\n");
|
DPRINTF(3, "\n");
|
||||||
DPRINTF(1, "Encountered error in abstract interpreter\n");
|
DPRINTF(1, "Encountered error in abstract interpreter\n");
|
||||||
_Py_uop_abstractcontext_fini(ctx);
|
_Py_uop_abstractcontext_fini(ctx);
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
hit_bottom:
|
hit_bottom:
|
||||||
// Attempted to push a "bottom" (contradition) symbol onto the stack.
|
// Attempted to push a "bottom" (contradition) symbol onto the stack.
|
||||||
// This means that the abstract interpreter has hit unreachable code.
|
// This means that the abstract interpreter has hit unreachable code.
|
||||||
// We *could* generate an _EXIT_TRACE or _FATAL_ERROR here, but it's
|
// We *could* generate an _EXIT_TRACE or _FATAL_ERROR here, but hitting
|
||||||
// simpler to just admit failure and not create the executor.
|
// bottom indicates type instability, so we are probably better off
|
||||||
|
// retrying later.
|
||||||
DPRINTF(3, "\n");
|
DPRINTF(3, "\n");
|
||||||
DPRINTF(1, "Hit bottom in abstract interpreter\n");
|
DPRINTF(1, "Hit bottom in abstract interpreter\n");
|
||||||
_Py_uop_abstractcontext_fini(ctx);
|
_Py_uop_abstractcontext_fini(ctx);
|
||||||
return 0;
|
return 0;
|
||||||
|
done:
|
||||||
|
/* Cannot optimize further, but there would be no benefit
|
||||||
|
* in retrying later */
|
||||||
|
_Py_uop_abstractcontext_fini(ctx);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,9 @@ dummy_func(void) {
|
||||||
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
|
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
|
||||||
DPRINTF(3, "func: %p ", func);
|
DPRINTF(3, "func: %p ", func);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
goto error;
|
DPRINTF(3, "\n");
|
||||||
|
DPRINTF(1, "Missing function\n");
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
||||||
|
|
||||||
|
|
4
Python/optimizer_cases.c.h
generated
4
Python/optimizer_cases.c.h
generated
|
@ -1599,7 +1599,9 @@
|
||||||
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
|
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
|
||||||
DPRINTF(3, "func: %p ", func);
|
DPRINTF(3, "func: %p ", func);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
goto error;
|
DPRINTF(3, "\n");
|
||||||
|
DPRINTF(1, "Missing function\n");
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
||||||
assert(self_or_null != NULL);
|
assert(self_or_null != NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue