8000 GH-136410: Faster side exits by markshannon · Pull Request #136411 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

GH-136410: Faster side exits #136411

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Include/cpython/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ struct _ts {

PyObject *current_executor;

/* Internal to the JIT */
struct _PyExitData *jit_exit;

uint64_t dict_global_version;

/* Used to store/retrieve `threading.local` keys/values for this thread */
Expand Down
1 change: 1 addition & 0 deletions Include/internal/pycore_interp_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ struct _is {
bool jit;
struct _PyExecutorObject *executor_list_head;
struct _PyExecutorObject *executor_deletion_list_head;
struct _PyExecutorObject *cold_executor;
int executor_deletion_list_remaining_capacity;
size_t trace_run_counter;
_rare_events rare_events;
Expand Down
11 changes: 10 additions & 1 deletion Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ typedef struct {
#endif
} _PyUOpInstruction;

typedef struct {
typedef struct _PyExitData {
uint32_t target;
uint16_t index;
_Py_BackoffCounter temperature;
struct _PyExecutorObject *executor;
} _PyExitData;
Expand Down Expand Up @@ -354,6 +355,14 @@ PyAPI_FUNC(PyObject *) _Py_uop_symbols_test(PyObject *self, PyObject *ignored);

PyAPI_FUNC(int) _PyOptimizer_Optimize(_PyInterpreterFrame *frame, _Py_CODEUNIT *start, _PyExecutorObject **exec_ptr, int chain_depth);

static inline _PyExecutorObject *_PyExecutor_FromExit(_PyExitData *exit)
{
_PyExitData *exit0 = exit - exit->index;
return (_PyExecutorObject *)(((char *)exit0) - offsetof(_PyExecutorObject, exits));
}

extern _PyExecutorObject *_PyExecutor_GetColdExecutor(void);

static inline int is_terminator(const _PyUOpInstruction *uop)
{
int opcode = uop->opcode;
Expand Down
Loading
Loading
0