Skip to content

Commit

Permalink
Fix instrumentation completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Jan 10, 2025
1 parent 6ae3e03 commit a27ee2d
Show file tree
Hide file tree
Showing 4 changed files with 7,074 additions and 7,966 deletions.
13 changes: 7 additions & 6 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,11 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
#include "generated_tail_call_handlers.c.h"
static inline PyObject *_TAIL_CALL_shim(TAIL_CALL_PARAMS)
{
opcode = next_instr->op.code;
#ifdef LLTRACE
return (INSTRUCTION_TABLE[next_instr->op.code])(frame, stack_pointer, tstate, next_instr, next_instr->op.arg, entry_frame, lltrace);
return (INSTRUCTION_TABLE[opcode])(frame, stack_pointer, tstate, next_instr, opcode, next_instr->op.arg, entry_frame, lltrace);
#else
return (INSTRUCTION_TABLE[next_instr->op.code])(frame, stack_pointer, tstate, next_instr, next_instr->op.arg, entry_frame);
return (INSTRUCTION_TABLE[opcode])(frame, stack_pointer, tstate, next_instr, opcode, next_instr->op.arg, entry_frame);
#endif
}
#endif
Expand Down Expand Up @@ -908,9 +909,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

#ifdef Py_TAIL_CALL_INTERP
#ifdef LLTRACE
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame, lltrace);
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame, lltrace);
#else
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame);
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame);
#endif
#else
DISPATCH();
Expand Down Expand Up @@ -1032,9 +1033,9 @@ TAIL_CALL_TARGET(exception_unwind):
DISPATCH();
# else
# ifdef LLTRACE
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame, lltrace);
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame, lltrace);
# else
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame);
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame);
# endif
# endif
#else
Expand Down
14 changes: 7 additions & 7 deletions Python/ceval_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
#endif

#ifdef LLTRACE
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, _PyInterpreterFrame *entry_frame, int lltrace
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, entry_frame, lltrace
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int opcode, int oparg, _PyInterpreterFrame *entry_frame, int lltrace
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, opcode, oparg, entry_frame, lltrace
#else
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, _PyInterpreterFrame *entry_frame
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, entry_frame
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int opcode, int oparg, _PyInterpreterFrame *entry_frame
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, opcode, oparg, entry_frame
#endif

#ifdef Py_TAIL_CALL_INTERP
Expand Down Expand Up @@ -331,12 +331,12 @@ GETITEM(PyObject *v, Py_ssize_t i) {
#ifdef LLTRACE
#define GO_TO_INSTRUCTION(op) do { \
Py_MUSTTAIL \
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame, lltrace); \
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], opcode, oparg, entry_frame, lltrace); \
} while (0)
#else
#define GO_TO_INSTRUCTION(op) do { \
#define GO_TO_INSTRUCTION(op) do { \
Py_MUSTTAIL \
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame); \
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], opcode, oparg, entry_frame); \
} while (0)
#endif
#else
Expand Down
Loading

0 comments on commit a27ee2d

Please sign in to comment.