diff options
author | Mark Shannon <mark@hotpy.org> | 2024-02-20 09:39:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 09:39:55 (GMT) |
commit | 7b21403ccd16c480812a1e857c0ee2deca592be0 (patch) | |
tree | ae54fc68fe298bea063502adff747e3ac1dd734d /Python/ceval_macros.h | |
parent | acda1757bc682922292215906459c2735ee99c04 (diff) | |
download | cpython-7b21403ccd16c480812a1e857c0ee2deca592be0.zip cpython-7b21403ccd16c480812a1e857c0ee2deca592be0.tar.gz cpython-7b21403ccd16c480812a1e857c0ee2deca592be0.tar.bz2 |
GH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142)
Diffstat (limited to 'Python/ceval_macros.h')
-rw-r--r-- | Python/ceval_macros.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 1043966..f796b60 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -394,7 +394,36 @@ stack_pointer = _PyFrame_GetStackPointer(frame); /* Tier-switching macros. */ -#define GOTO_TIER_TWO() goto enter_tier_two; +#ifdef _Py_JIT +#define GOTO_TIER_TWO(EXECUTOR) \ +do { \ + jit_func jitted = (EXECUTOR)->jit_code; \ + next_instr = jitted(frame, stack_pointer, tstate); \ + Py_DECREF(tstate->previous_executor); \ + tstate->previous_executor = NULL; \ + frame = tstate->current_frame; \ + if (next_instr == NULL) { \ + goto resume_with_error; \ + } \ + stack_pointer = _PyFrame_GetStackPointer(frame); \ + DISPATCH(); \ +} while (0) +#else +#define GOTO_TIER_TWO(EXECUTOR) \ +do { \ + next_uop = (EXECUTOR)->trace; \ + assert(next_uop->opcode == _START_EXECUTOR || next_uop->opcode == _COLD_EXIT); \ + goto enter_tier_two; \ +} while (0) +#endif + +#define GOTO_TIER_ONE(TARGET) \ +do { \ + Py_DECREF(tstate->previous_executor); \ + tstate->previous_executor = NULL; \ + next_instr = target; \ + DISPATCH(); \ +} while (0) #define CURRENT_OPARG() (next_uop[-1].oparg) |