Simplify DISPATCH by hoisting eval_breaker ahead of time. (gh-12243)
This commit is contained in:
parent
d5a70c6b03
commit
7bda9de550
|
@ -602,6 +602,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
PyObject **fastlocals, **freevars;
|
PyObject **fastlocals, **freevars;
|
||||||
PyObject *retval = NULL; /* Return value */
|
PyObject *retval = NULL; /* Return value */
|
||||||
PyThreadState *tstate = _PyThreadState_GET();
|
PyThreadState *tstate = _PyThreadState_GET();
|
||||||
|
_Py_atomic_int *eval_breaker = &_PyRuntime.ceval.eval_breaker;
|
||||||
PyCodeObject *co;
|
PyCodeObject *co;
|
||||||
|
|
||||||
/* when tracing we set things up so that
|
/* when tracing we set things up so that
|
||||||
|
@ -687,7 +688,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
|
|
||||||
#define DISPATCH() \
|
#define DISPATCH() \
|
||||||
{ \
|
{ \
|
||||||
if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \
|
if (!_Py_atomic_load_relaxed(eval_breaker)) { \
|
||||||
FAST_DISPATCH(); \
|
FAST_DISPATCH(); \
|
||||||
} \
|
} \
|
||||||
continue; \
|
continue; \
|
||||||
|
@ -989,7 +990,7 @@ main_loop:
|
||||||
async I/O handler); see Py_AddPendingCall() and
|
async I/O handler); see Py_AddPendingCall() and
|
||||||
Py_MakePendingCalls() above. */
|
Py_MakePendingCalls() above. */
|
||||||
|
|
||||||
if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) {
|
if (_Py_atomic_load_relaxed(eval_breaker)) {
|
||||||
opcode = _Py_OPCODE(*next_instr);
|
opcode = _Py_OPCODE(*next_instr);
|
||||||
if (opcode == SETUP_FINALLY ||
|
if (opcode == SETUP_FINALLY ||
|
||||||
opcode == SETUP_WITH ||
|
opcode == SETUP_WITH ||
|
||||||
|
|
Loading…
Reference in New Issue