Cleanup tier2 debug output (#116920)
Various tweaks, including a slight refactor of the special cases for `_PUSH_FRAME`/`_POP_FRAME` to show the actual operand emitted.
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
#ifdef Py_DEBUG
|
||||
extern const char *_PyUOpName(int index);
|
||||
extern void _PyUOpPrint(const _PyUOpInstruction *uop);
|
||||
static const char *const DEBUG_ENV = "PYTHON_OPT_DEBUG";
|
||||
static inline int get_lltrace(void) {
|
||||
char *uop_debug = Py_GETENV(DEBUG_ENV);
|
||||
@@ -377,14 +378,20 @@ optimize_uops(
|
||||
|
||||
_Py_UopsSymbol **stack_pointer = ctx->frame->stack_pointer;
|
||||
|
||||
DPRINTF(3, "Abstract interpreting %s:%d ",
|
||||
_PyUOpName(opcode),
|
||||
oparg);
|
||||
#ifdef Py_DEBUG
|
||||
if (get_lltrace() >= 3) {
|
||||
printf("%4d abs: ", (int)(this_instr - trace));
|
||||
_PyUOpPrint(this_instr);
|
||||
printf(" ");
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (opcode) {
|
||||
|
||||
#include "optimizer_cases.c.h"
|
||||
|
||||
default:
|
||||
DPRINTF(1, "Unknown opcode in abstract interpreter\n");
|
||||
DPRINTF(1, "\nUnknown opcode in abstract interpreter\n");
|
||||
Py_UNREACHABLE();
|
||||
}
|
||||
assert(ctx->frame != NULL);
|
||||
@@ -397,11 +404,13 @@ optimize_uops(
|
||||
return 1;
|
||||
|
||||
out_of_space:
|
||||
DPRINTF(3, "\n");
|
||||
DPRINTF(1, "Out of space in abstract interpreter\n");
|
||||
_Py_uop_abstractcontext_fini(ctx);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
DPRINTF(3, "\n");
|
||||
DPRINTF(1, "Encountered error in abstract interpreter\n");
|
||||
_Py_uop_abstractcontext_fini(ctx);
|
||||
return 0;
|
||||
@@ -411,6 +420,7 @@ hit_bottom:
|
||||
// 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.
|
||||
DPRINTF(3, "\n");
|
||||
DPRINTF(1, "Hit bottom in abstract interpreter\n");
|
||||
_Py_uop_abstractcontext_fini(ctx);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user