GH-104580: Don't cache eval breaker in interpreter (GH-104581)

Move eval-breaker to the front of the interpreter state.
This commit is contained in:
Mark Shannon
2023-05-18 10:08:33 +01:00
committed by GitHub
parent 662aede68b
commit 68b5f08b72
6 changed files with 260 additions and 262 deletions
+2 -3
View File
@@ -70,7 +70,6 @@ dummy_func(
_PyInterpreterFrame *frame,
unsigned char opcode,
unsigned int oparg,
_Py_atomic_int * const eval_breaker,
_PyCFrame cframe,
_Py_CODEUNIT *next_instr,
PyObject **stack_pointer,
@@ -143,7 +142,7 @@ dummy_func(
ERROR_IF(err, error);
next_instr--;
}
else if (_Py_atomic_load_relaxed_int32(eval_breaker) && oparg < 2) {
else if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
goto handle_eval_breaker;
}
}
@@ -170,7 +169,7 @@ dummy_func(
next_instr = frame->prev_instr;
DISPATCH();
}
if (_Py_atomic_load_relaxed_int32(eval_breaker) && oparg < 2) {
if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker) && oparg < 2) {
goto handle_eval_breaker;
}
}
-1
View File
@@ -652,7 +652,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
// for the big switch below (in combination with the EXTRA_CASES macro).
uint8_t opcode; /* Current opcode */
int oparg; /* Current opcode argument, if any */
_Py_atomic_int * const eval_breaker = &tstate->interp->ceval.eval_breaker;
#ifdef LLTRACE
int lltrace = 0;
#endif
+1 -1
View File
@@ -116,7 +116,7 @@
#define CHECK_EVAL_BREAKER() \
_Py_CHECK_EMSCRIPTEN_SIGNALS_PERIODICALLY(); \
if (_Py_atomic_load_relaxed_int32(eval_breaker)) { \
if (_Py_atomic_load_relaxed_int32(&tstate->interp->ceval.eval_breaker)) { \
goto handle_eval_breaker; \
}
+253 -253
View File
File diff suppressed because it is too large Load Diff