gh-107674: Improve performance of sys.settrace (GH-114986)

This commit is contained in:
Tian Gao 2024-02-28 07:21:42 -08:00 committed by GitHub
parent 9578288a3e
commit 0a61e23700
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 64 additions and 53 deletions

View file

@ -339,12 +339,16 @@ do { \
// for an exception handler, displaying the traceback, and so on
#define INSTRUMENTED_JUMP(src, dest, event) \
do { \
_PyFrame_SetStackPointer(frame, stack_pointer); \
next_instr = _Py_call_instrumentation_jump(tstate, event, frame, src, dest); \
stack_pointer = _PyFrame_GetStackPointer(frame); \
if (next_instr == NULL) { \
next_instr = (dest)+1; \
goto error; \
if (tstate->tracing) {\
next_instr = dest; \
} else { \
_PyFrame_SetStackPointer(frame, stack_pointer); \
next_instr = _Py_call_instrumentation_jump(tstate, event, frame, src, dest); \
stack_pointer = _PyFrame_GetStackPointer(frame); \
if (next_instr == NULL) { \
next_instr = (dest)+1; \
goto error; \
} \
} \
} while (0);