#define DPRINTF(level, ...) \
if (get_lltrace() >= (level)) { printf(__VA_ARGS__); }
-
-
static void
dump_abstract_stack(_Py_UOpsAbstractFrame *frame, JitOptRef *stack_pointer)
{
fflush(stdout);
}
+static void
+dump_uop(JitOptContext *ctx, const char *label, int index,
+ const _PyUOpInstruction *instr, JitOptRef *stack_pointer)
+{
+ if (get_lltrace() >= 3) {
+ printf("%4d %s: ", index, label);
+ _PyUOpPrint(instr);
+ printf("\n");
+ if (get_lltrace() >= 5 && ctx->frame->code != ((PyCodeObject *)&_Py_InitCleanup)) {
+ dump_abstract_stack(ctx->frame, stack_pointer);
+ }
+ }
+}
+
+#define DUMP_UOP dump_uop
+
#else
#define DPRINTF(level, ...)
+ #define DUMP_UOP(ctx, label, index, instr, stack_pointer)
#endif
static int
uint64_t push_operand = op->operand0;
if (push_operand & 1) {
co = (PyCodeObject *)(push_operand & ~1);
- DPRINTF(3, "code=%p ", co);
+ DPRINTF(3, " code=%p\n", co);
assert(PyCode_Check(co));
}
else {
PyFunctionObject *func = (PyFunctionObject *)push_operand;
- DPRINTF(3, "func=%p ", func);
+ DPRINTF(3, " func=%p ", func);
if (func == NULL) {
DPRINTF(3, "\n");
DPRINTF(1, "Missing function\n");
return NULL;
}
co = (PyCodeObject *)func->func_code;
- DPRINTF(3, "code=%p ", co);
+ DPRINTF(3, "code=%p\n", co);
}
return co;
}
stack_pointer = ctx->frame->stack_pointer;
}
-#ifdef Py_DEBUG
- if (get_lltrace() >= 3) {
- printf("%4d abs: ", (int)(this_instr - trace));
- _PyUOpPrint(this_instr);
- printf(" \n");
- if (get_lltrace() >= 5 && !CURRENT_FRAME_IS_INIT_SHIM()) {
- dump_abstract_stack(ctx->frame, stack_pointer);
- }
- }
-#endif
+ DUMP_UOP(ctx, "abs", this_instr - trace, this_instr, stack_pointer);
_PyUOpInstruction *out_ptr = ctx->out_buffer.next;
*(ctx->out_buffer.next++) = *this_instr;
}
assert(ctx->frame != NULL);
+ DUMP_UOP(ctx, "out", uop_buffer_length(&ctx->out_buffer) - 1, out_ptr, stack_pointer);
if (!CURRENT_FRAME_IS_INIT_SHIM() && !ctx->done) {
DPRINTF(3, " stack_level %d\n", STACK_LEVEL());
ctx->frame->stack_pointer = stack_pointer;