Skip to content
8 changes: 6 additions & 2 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ compute_frame_penalty(uint16_t fitness_initial)
static int
is_terminator(const _PyUOpInstruction *uop)
{
int opcode = _PyUop_Uncached[uop->opcode];
int opcode = uop->opcode;
assert(opcode <= MAX_UOP_ID);
return (
opcode == _EXIT_TRACE ||
opcode == _DEOPT ||
Expand Down Expand Up @@ -1474,7 +1475,10 @@ sanity_check(_PyExecutorObject *executor)
CHECK(inst->format == UOP_FORMAT_JUMP);
CHECK(inst->error_target < executor->code_size);
}
if (is_terminator(inst)) {
if (base_opcode == _EXIT_TRACE ||
base_opcode == _DEOPT ||
base_opcode == _JUMP_TO_TOP ||
base_opcode == _DYNAMIC_EXIT) {
ended = true;
i++;
break;
Expand Down
2 changes: 2 additions & 0 deletions Python/pystats.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ print_optimization_stats(FILE *out, OptimizationStats *stats)
fprintf(out, "JIT code size: %" PRIu64 "\n", stats->jit_code_size);
fprintf(out, "JIT trampoline size: %" PRIu64 "\n", stats->jit_trampoline_size);
fprintf(out, "JIT data size: %" PRIu64 "\n", stats->jit_data_size);
fprintf(out, "JIT GOT size: %" PRIu64 "\n", stats->jit_got_size);
fprintf(out, "JIT padding size: %" PRIu64 "\n", stats->jit_padding_size);
fprintf(out, "JIT freed memory size: %" PRIu64 "\n", stats->jit_freed_memory_size);

Expand Down Expand Up @@ -484,6 +485,7 @@ merge_optimization_stats(OptimizationStats *dest, const OptimizationStats *src)
dest->jit_code_size += src->jit_code_size;
dest->jit_trampoline_size += src->jit_trampoline_size;
dest->jit_data_size += src->jit_data_size;
dest->jit_got_size += src->jit_got_size;
dest->jit_padding_size += src->jit_padding_size;
dest->jit_freed_memory_size += src->jit_freed_memory_size;

Expand Down
Loading