Skip to content

Commit

Permalink
Simplify DISPATCH by hoisting eval_breaker ahead of time. (pythongh-1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently authored Mar 9, 2019
1 parent d5a70c6 commit 7bda9de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
PyObject **fastlocals, **freevars;
PyObject *retval = NULL; /* Return value */
PyThreadState *tstate = _PyThreadState_GET();
_Py_atomic_int *eval_breaker = &_PyRuntime.ceval.eval_breaker;
PyCodeObject *co;

/* when tracing we set things up so that
Expand Down Expand Up @@ -687,7 +688,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)

#define DISPATCH() \
{ \
if (!_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) { \
if (!_Py_atomic_load_relaxed(eval_breaker)) { \
FAST_DISPATCH(); \
} \
continue; \
Expand Down Expand Up @@ -989,7 +990,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
async I/O handler); see Py_AddPendingCall() and
Py_MakePendingCalls() above. */

if (_Py_atomic_load_relaxed(&_PyRuntime.ceval.eval_breaker)) {
if (_Py_atomic_load_relaxed(eval_breaker)) {
opcode = _Py_OPCODE(*next_instr);
if (opcode == SETUP_FINALLY ||
opcode == SETUP_WITH ||
Expand Down

0 comments on commit 7bda9de

Please sign in to comment.