Skip to content

Commit

Permalink
Improve trace construction debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Feb 21, 2024
1 parent 2537f75 commit cdf96e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ translate_bytecode_to_trace(
uint32_t oparg = instr->op.arg;
uint32_t extended = 0;

DPRINTF(3, "%d: %s(%d)\n", target, _PyOpcode_OpName[opcode], oparg);

if (opcode == ENTER_EXECUTOR) {
assert(oparg < 256);
_PyExecutorObject *executor = code->co_executors->executors[oparg];
Expand Down Expand Up @@ -604,8 +606,8 @@ translate_bytecode_to_trace(
confidence = confidence * (18 - bitcount) / 20;
}
uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_likely];
DPRINTF(2, "%s(%d): counter=%x, bitcount=%d, likely=%d, confidence=%d, uopcode=%s\n",
_PyOpcode_OpName[opcode], oparg,
DPRINTF(2, "%d: %s(%d): counter=%x, bitcount=%d, likely=%d, confidence=%d, uopcode=%s\n",
target, _PyOpcode_OpName[opcode], oparg,
counter, bitcount, jump_likely, confidence, _PyUOpName(uopcode));
if (confidence < CONFIDENCE_CUTOFF) {
DPRINTF(2, "Confidence too low (%d < %d)\n", confidence, CONFIDENCE_CUTOFF);
Expand Down

0 comments on commit cdf96e2

Please sign in to comment.