GH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383)

This commit is contained in:
Mark Shannon 2023-07-28 13:55:25 +01:00 committed by GitHub
parent 0aa58fa7a6
commit a1b679572e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -84,7 +84,9 @@ struct _ceval_runtime_state {
struct _ceval_state { struct _ceval_state {
/* This single variable consolidates all requests to break out of /* This single variable consolidates all requests to break out of
the fast path in the eval loop. */ * the fast path in the eval loop.
* It is by far the hottest field in this struct and
* should be placed at the beginning. */
_Py_atomic_int eval_breaker; _Py_atomic_int eval_breaker;
/* Request for dropping the GIL */ /* Request for dropping the GIL */
_Py_atomic_int gil_drop_request; _Py_atomic_int gil_drop_request;

View File

@ -48,6 +48,11 @@ struct _Py_long_state {
*/ */
struct _is { struct _is {
/* This struct countains the eval_breaker,
* which is by far the hottest field in this struct
* and should be placed at the beginning. */
struct _ceval_state ceval;
PyInterpreterState *next; PyInterpreterState *next;
int64_t id; int64_t id;
@ -109,8 +114,6 @@ struct _is {
// Dictionary of the builtins module // Dictionary of the builtins module
PyObject *builtins; PyObject *builtins;
struct _ceval_state ceval;
struct _import_state imports; struct _import_state imports;
/* The per-interpreter GIL, which might not be used. */ /* The per-interpreter GIL, which might not be used. */