diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2024-02-29 22:46:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 07:46:33 +0100 |
commit | 7895a61168aad4565a1d953104c9ec620e7c588f (patch) | |
tree | 8234320f8978961688f8abc4baf1f6ad7faf5c2d /Python/bytecodes.c | |
parent | 339c8e1c13adc299a0e2e49c93067e7817692380 (diff) | |
download | cpython-7895a61168aad4565a1d953104c9ec620e7c588f.tar.gz cpython-7895a61168aad4565a1d953104c9ec620e7c588f.zip |
gh-116098: Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)" (GH-116178)
Revert "gh-107674: Improve performance of `sys.settrace` (GH-114986)"
This reverts commit 0a61e237009bf6b833e13ac635299ee063377699.
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 095982d64f3..396a8f09f3f 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -143,23 +143,22 @@ dummy_func( tier1 inst(RESUME, (--)) { assert(frame == tstate->current_frame); - if (tstate->tracing == 0) { - uintptr_t global_version = - _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & - ~_PY_EVAL_EVENTS_MASK; - uintptr_t code_version = _PyFrame_GetCode(frame)->_co_instrumentation_version; - assert((code_version & 255) == 0); - if (code_version != global_version) { - int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp); - ERROR_IF(err, error); - next_instr = this_instr; - DISPATCH(); - } + uintptr_t global_version = + _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & + ~_PY_EVAL_EVENTS_MASK; + uintptr_t code_version = _PyFrame_GetCode(frame)->_co_instrumentation_version; + assert((code_version & 255) == 0); + if (code_version != global_version) { + int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp); + ERROR_IF(err, error); + next_instr = this_instr; } - if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) { - CHECK_EVAL_BREAKER(); + else { + if ((oparg & RESUME_OPARG_LOCATION_MASK) < RESUME_AFTER_YIELD_FROM) { + CHECK_EVAL_BREAKER(); + } + this_instr->op.code = RESUME_CHECK; } - this_instr->op.code = RESUME_CHECK; } inst(RESUME_CHECK, (--)) { @@ -170,13 +169,13 @@ dummy_func( uintptr_t eval_breaker = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker); uintptr_t version = _PyFrame_GetCode(frame)->_co_instrumentation_version; assert((version & _PY_EVAL_EVENTS_MASK) == 0); - DEOPT_IF(eval_breaker != version && tstate->tracing == 0); + DEOPT_IF(eval_breaker != version); } inst(INSTRUMENTED_RESUME, (--)) { uintptr_t global_version = _Py_atomic_load_uintptr_relaxed(&tstate->eval_breaker) & ~_PY_EVAL_EVENTS_MASK; uintptr_t code_version = _PyFrame_GetCode(frame)->_co_instrumentation_version; - if (code_version != global_version && tstate->tracing == 0) { + if (code_version != global_version) { if (_Py_Instrument(_PyFrame_GetCode(frame), tstate->interp)) { GOTO_ERROR(error); } |