diff options
author | Michael Droettboom <mdboom@gmail.com> | 2024-04-04 22:49:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 22:49:18 (GMT) |
commit | 0edde64a41c2c3eeb4fd495efe7fff3d631cae4b (patch) | |
tree | 77a915f41ec39a4893384e1f9f1bc881bf719ac5 /Tools | |
parent | b5e60918afa53dfd59ad26a9f4b5207a9b304bc1 (diff) | |
download | cpython-0edde64a41c2c3eeb4fd495efe7fff3d631cae4b.zip cpython-0edde64a41c2c3eeb4fd495efe7fff3d631cae4b.tar.gz cpython-0edde64a41c2c3eeb4fd495efe7fff3d631cae4b.tar.bz2 |
GH-117457: Correct pystats uop "miss" counts (GH-117477)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/cases_generator/tier2_generator.py | 10 | ||||
-rw-r--r-- | Tools/jit/template.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/Tools/cases_generator/tier2_generator.py b/Tools/cases_generator/tier2_generator.py index 114d28e..944d134 100644 --- a/Tools/cases_generator/tier2_generator.py +++ b/Tools/cases_generator/tier2_generator.py @@ -100,7 +100,10 @@ def tier2_replace_deopt( out.emit(next(tkn_iter)) emit_to(out, tkn_iter, "RPAREN") next(tkn_iter) # Semi colon - out.emit(") JUMP_TO_JUMP_TARGET();\n") + out.emit(") {\n") + out.emit("UOP_STAT_INC(uopcode, miss);\n") + out.emit("JUMP_TO_JUMP_TARGET();\n"); + out.emit("}\n") def tier2_replace_exit_if( @@ -115,7 +118,10 @@ def tier2_replace_exit_if( out.emit(next(tkn_iter)) emit_to(out, tkn_iter, "RPAREN") next(tkn_iter) # Semi colon - out.emit(") JUMP_TO_JUMP_TARGET();\n") + out.emit(") {\n") + out.emit("UOP_STAT_INC(uopcode, miss);\n") + out.emit("JUMP_TO_JUMP_TARGET();\n") + out.emit("}\n") def tier2_replace_oparg( diff --git a/Tools/jit/template.c b/Tools/jit/template.c index 351bc2f..2300bd0 100644 --- a/Tools/jit/template.c +++ b/Tools/jit/template.c @@ -85,7 +85,7 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState * // Locals that the instruction implementations expect to exist: PATCH_VALUE(_PyExecutorObject *, current_executor, _JIT_EXECUTOR) int oparg; - int opcode = _JIT_OPCODE; + int uopcode = _JIT_OPCODE; // Other stuff we need handy: PATCH_VALUE(uint16_t, _oparg, _JIT_OPARG) PATCH_VALUE(uint64_t, _operand, _JIT_OPERAND) @@ -93,14 +93,14 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState * PATCH_VALUE(uint16_t, _exit_index, _JIT_EXIT_INDEX) OPT_STAT_INC(uops_executed); - UOP_STAT_INC(opcode, execution_count); + UOP_STAT_INC(uopcode, execution_count); // The actual instruction definitions (only one will be used): - if (opcode == _JUMP_TO_TOP) { + if (uopcode == _JUMP_TO_TOP) { CHECK_EVAL_BREAKER(); PATCH_JUMP(_JIT_TOP); } - switch (opcode) { + switch (uopcode) { #include "executor_cases.c.h" default: Py_UNREACHABLE(); @@ -113,11 +113,9 @@ error_tier_two: GOTO_TIER_ONE(NULL); exit_to_tier1: tstate->previous_executor = (PyObject *)current_executor; - UOP_STAT_INC(opcode, miss); GOTO_TIER_ONE(_PyCode_CODE(_PyFrame_GetCode(frame)) + _target); exit_to_trace: { - UOP_STAT_INC(opcode, miss); _PyExitData *exit = ¤t_executor->exits[_exit_index]; Py_INCREF(exit->executor); tstate->previous_executor = (PyObject *)current_executor; |