mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
GH-117121: Add pystats to JIT builds (GH-117346)
This commit is contained in:
parent
14f1ca7d53
commit
26d328b2ba
3 changed files with 10 additions and 1 deletions
|
@ -990,7 +990,7 @@ enter_tier_two:
|
||||||
#define DPRINTF(level, ...)
|
#define DPRINTF(level, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OPT_STAT_INC(traces_executed);
|
; // dummy statement after a label, before a declaration
|
||||||
uint16_t uopcode;
|
uint16_t uopcode;
|
||||||
#ifdef Py_STATS
|
#ifdef Py_STATS
|
||||||
uint64_t trace_uop_execution_counter = 0;
|
uint64_t trace_uop_execution_counter = 0;
|
||||||
|
|
|
@ -392,6 +392,7 @@ stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
#ifdef _Py_JIT
|
#ifdef _Py_JIT
|
||||||
#define GOTO_TIER_TWO(EXECUTOR) \
|
#define GOTO_TIER_TWO(EXECUTOR) \
|
||||||
do { \
|
do { \
|
||||||
|
OPT_STAT_INC(traces_executed); \
|
||||||
jit_func jitted = (EXECUTOR)->jit_code; \
|
jit_func jitted = (EXECUTOR)->jit_code; \
|
||||||
next_instr = jitted(frame, stack_pointer, tstate); \
|
next_instr = jitted(frame, stack_pointer, tstate); \
|
||||||
Py_DECREF(tstate->previous_executor); \
|
Py_DECREF(tstate->previous_executor); \
|
||||||
|
@ -406,6 +407,7 @@ do { \
|
||||||
#else
|
#else
|
||||||
#define GOTO_TIER_TWO(EXECUTOR) \
|
#define GOTO_TIER_TWO(EXECUTOR) \
|
||||||
do { \
|
do { \
|
||||||
|
OPT_STAT_INC(traces_executed); \
|
||||||
next_uop = (EXECUTOR)->trace; \
|
next_uop = (EXECUTOR)->trace; \
|
||||||
assert(next_uop->opcode == _START_EXECUTOR || next_uop->opcode == _COLD_EXIT); \
|
assert(next_uop->opcode == _START_EXECUTOR || next_uop->opcode == _COLD_EXIT); \
|
||||||
goto enter_tier_two; \
|
goto enter_tier_two; \
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#undef GOTO_TIER_TWO
|
#undef GOTO_TIER_TWO
|
||||||
#define GOTO_TIER_TWO(EXECUTOR) \
|
#define GOTO_TIER_TWO(EXECUTOR) \
|
||||||
do { \
|
do { \
|
||||||
|
OPT_STAT_INC(traces_executed); \
|
||||||
__attribute__((musttail)) \
|
__attribute__((musttail)) \
|
||||||
return ((jit_func)((EXECUTOR)->jit_code))(frame, stack_pointer, tstate); \
|
return ((jit_func)((EXECUTOR)->jit_code))(frame, stack_pointer, tstate); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -88,6 +89,10 @@ _JIT_ENTRY(_PyInterpreterFrame *frame, PyObject **stack_pointer, PyThreadState *
|
||||||
PATCH_VALUE(uint64_t, _operand, _JIT_OPERAND)
|
PATCH_VALUE(uint64_t, _operand, _JIT_OPERAND)
|
||||||
PATCH_VALUE(uint32_t, _target, _JIT_TARGET)
|
PATCH_VALUE(uint32_t, _target, _JIT_TARGET)
|
||||||
PATCH_VALUE(uint16_t, _exit_index, _JIT_EXIT_INDEX)
|
PATCH_VALUE(uint16_t, _exit_index, _JIT_EXIT_INDEX)
|
||||||
|
|
||||||
|
OPT_STAT_INC(uops_executed);
|
||||||
|
UOP_STAT_INC(opcode, execution_count);
|
||||||
|
|
||||||
// The actual instruction definitions (only one will be used):
|
// The actual instruction definitions (only one will be used):
|
||||||
if (opcode == _JUMP_TO_TOP) {
|
if (opcode == _JUMP_TO_TOP) {
|
||||||
CHECK_EVAL_BREAKER();
|
CHECK_EVAL_BREAKER();
|
||||||
|
@ -106,9 +111,11 @@ error_tier_two:
|
||||||
GOTO_TIER_ONE(NULL);
|
GOTO_TIER_ONE(NULL);
|
||||||
exit_to_tier1:
|
exit_to_tier1:
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
|
UOP_STAT_INC(opcode, miss);
|
||||||
GOTO_TIER_ONE(_PyCode_CODE(_PyFrame_GetCode(frame)) + _target);
|
GOTO_TIER_ONE(_PyCode_CODE(_PyFrame_GetCode(frame)) + _target);
|
||||||
exit_to_trace:
|
exit_to_trace:
|
||||||
{
|
{
|
||||||
|
UOP_STAT_INC(opcode, miss);
|
||||||
_PyExitData *exit = ¤t_executor->exits[_exit_index];
|
_PyExitData *exit = ¤t_executor->exits[_exit_index];
|
||||||
Py_INCREF(exit->executor);
|
Py_INCREF(exit->executor);
|
||||||
tstate->previous_executor = (PyObject *)current_executor;
|
tstate->previous_executor = (PyObject *)current_executor;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue