diff options
author | Mark Shannon <mark@hotpy.org> | 2022-07-28 09:17:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-28 09:17:22 (GMT) |
commit | b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98 (patch) | |
tree | 2c1c782386166f700a091b064b113082aec31f39 /Python/ceval.c | |
parent | ea269b9a380a52828d4e401fa695737bcd699398 (diff) | |
download | cpython-b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98.zip cpython-b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98.tar.gz cpython-b8b2990fb3218cffedfe7bc92e9e7ae2275b3c98.tar.bz2 |
GH-90081: Run python tracers at full speed (GH-95328)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 3a9b0e5..7ad26a7 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5631,7 +5631,7 @@ handle_eval_breaker: assert(oparg); oparg <<= 8; oparg |= _Py_OPARG(*next_instr); - // We might be tracing. To avoid breaking tracing guarantees in + // We might be tracing. To avoid breaking tracing guarantees in // quickened instructions, always deoptimize the next opcode: opcode = _PyOpcode_Deopt[_Py_OPCODE(*next_instr)]; PRE_DISPATCH_GOTO(); @@ -5661,9 +5661,9 @@ handle_eval_breaker: case DO_TRACING: #endif { - if (tstate->tracing == 0 && - INSTR_OFFSET() >= frame->f_code->_co_firsttraceable - ) { + assert(cframe.use_tracing); + assert(tstate->tracing == 0); + if (INSTR_OFFSET() >= frame->f_code->_co_firsttraceable) { int instr_prev = _PyInterpreterFrame_LASTI(frame); frame->prev_instr = next_instr; TRACING_NEXTOPARG(); @@ -6875,12 +6875,15 @@ void PyThreadState_EnterTracing(PyThreadState *tstate) { tstate->tracing++; + tstate->cframe->use_tracing = 0; } void PyThreadState_LeaveTracing(PyThreadState *tstate) { + assert(tstate->tracing > 0 && tstate->cframe->use_tracing == 0); tstate->tracing--; + _PyThreadState_UpdateTracingState(tstate); } static int |