Skip to content

Commit a27ee2d

Browse files
Fix instrumentation completely
1 parent 6ae3e03 commit a27ee2d

File tree

4 files changed

+7074
-7966
lines changed

4 files changed

+7074
-7966
lines changed

Python/ceval.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,11 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
785785
#include "generated_tail_call_handlers.c.h"
786786
static inline PyObject *_TAIL_CALL_shim(TAIL_CALL_PARAMS)
787787
{
788+
opcode = next_instr->op.code;
788789
#ifdef LLTRACE
789-
return (INSTRUCTION_TABLE[next_instr->op.code])(frame, stack_pointer, tstate, next_instr, next_instr->op.arg, entry_frame, lltrace);
790+
return (INSTRUCTION_TABLE[opcode])(frame, stack_pointer, tstate, next_instr, opcode, next_instr->op.arg, entry_frame, lltrace);
790791
#else
791-
return (INSTRUCTION_TABLE[next_instr->op.code])(frame, stack_pointer, tstate, next_instr, next_instr->op.arg, entry_frame);
792+
return (INSTRUCTION_TABLE[opcode])(frame, stack_pointer, tstate, next_instr, opcode, next_instr->op.arg, entry_frame);
792793
#endif
793794
}
794795
#endif
@@ -908,9 +909,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
908909

909910
#ifdef Py_TAIL_CALL_INTERP
910911
#ifdef LLTRACE
911-
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame, lltrace);
912+
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame, lltrace);
912913
#else
913-
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame);
914+
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame);
914915
#endif
915916
#else
916917
DISPATCH();
@@ -1032,9 +1033,9 @@ TAIL_CALL_TARGET(exception_unwind):
10321033
DISPATCH();
10331034
# else
10341035
# ifdef LLTRACE
1035-
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame, lltrace);
1036+
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame, lltrace);
10361037
# else
1037-
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, entry_frame);
1038+
return _TAIL_CALL_shim(frame, stack_pointer, tstate, next_instr, 0, 0, entry_frame);
10381039
# endif
10391040
# endif
10401041
#else

Python/ceval_macros.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
#endif
7272

7373
#ifdef LLTRACE
74-
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, _PyInterpreterFrame *entry_frame, int lltrace
75-
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, entry_frame, lltrace
74+
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int opcode, int oparg, _PyInterpreterFrame *entry_frame, int lltrace
75+
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, opcode, oparg, entry_frame, lltrace
7676
#else
77-
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int oparg, _PyInterpreterFrame *entry_frame
78-
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, oparg, entry_frame
77+
# define TAIL_CALL_PARAMS _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate, _Py_CODEUNIT *next_instr, int opcode, int oparg, _PyInterpreterFrame *entry_frame
78+
# define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, opcode, oparg, entry_frame
7979
#endif
8080

8181
#ifdef Py_TAIL_CALL_INTERP
@@ -331,12 +331,12 @@ GETITEM(PyObject *v, Py_ssize_t i) {
331331
#ifdef LLTRACE
332332
#define GO_TO_INSTRUCTION(op) do { \
333333
Py_MUSTTAIL \
334-
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame, lltrace); \
334+
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], opcode, oparg, entry_frame, lltrace); \
335335
} while (0)
336336
#else
337-
#define GO_TO_INSTRUCTION(op) do { \
337+
#define GO_TO_INSTRUCTION(op) do { \
338338
Py_MUSTTAIL \
339-
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame); \
339+
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], opcode, oparg, entry_frame); \
340340
} while (0)
341341
#endif
342342
#else

0 commit comments

Comments
 (0)