Skip to content

Commit

Permalink
GH-104580: Put eval_breaker back at the start of the interpreter st…
Browse files Browse the repository at this point in the history
…ate. (GH-107383)
  • Loading branch information
markshannon authored Jul 28, 2023
1 parent 0aa58fa commit a1b6795
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Include/internal/pycore_ceval_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions Include/internal/pycore_interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit a1b6795

Please sign in to comment.