From: Mark Shannon Date: Fri, 28 Jul 2023 12:55:25 +0000 (+0100) Subject: GH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383) X-Git-Tag: v3.13.0a1~1157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a1b679572e7156bc4299819e73235dc608d4a570;p=thirdparty%2FPython%2Fcpython.git GH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383) --- diff --git a/Include/internal/pycore_ceval_state.h b/Include/internal/pycore_ceval_state.h index e56e43c6e0c6..1ebfcc9bebd0 100644 --- a/Include/internal/pycore_ceval_state.h +++ b/Include/internal/pycore_ceval_state.h @@ -84,7 +84,9 @@ struct _ceval_runtime_state { struct _ceval_state { /* 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; /* Request for dropping the GIL */ _Py_atomic_int gil_drop_request; diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index bd6a9f28f468..91c473e58eab 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -48,6 +48,11 @@ struct _Py_long_state { */ 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; int64_t id; @@ -109,8 +114,6 @@ struct _is { // Dictionary of the builtins module PyObject *builtins; - struct _ceval_state ceval; - struct _import_state imports; /* The per-interpreter GIL, which might not be used. */