]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-104580: Put `eval_breaker` back at the start of the interpreter state. (GH-107383)
authorMark Shannon <mark@hotpy.org>
Fri, 28 Jul 2023 12:55:25 +0000 (13:55 +0100)
committerGitHub <noreply@github.com>
Fri, 28 Jul 2023 12:55:25 +0000 (13:55 +0100)
Include/internal/pycore_ceval_state.h
Include/internal/pycore_interp.h

index e56e43c6e0c6a7f247de227910e4f1f5e0e10f35..1ebfcc9bebd0ab62ee8b42d3898c206f5e0a67aa 100644 (file)
@@ -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;
index bd6a9f28f468a0b556e2b7d1387c051fbf8177e2..91c473e58eaba26e7e421691f6b4ae42dd765367 100644 (file)
@@ -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. */