Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-104580: Put eval_breaker back at the start of the interpreter state. #107383

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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