GH-128939: Refactor JIT optimize structs (GH-128940)

This commit is contained in:
Mark Shannon 2025-01-20 15:49:15 +00:00 committed by GitHub
parent e1fa2fcc7c
commit f0f7b978be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 816 additions and 527 deletions

View file

@ -368,13 +368,17 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
#define sym_truthiness _Py_uop_sym_truthiness
#define frame_new _Py_uop_frame_new
#define frame_pop _Py_uop_frame_pop
#define sym_new_tuple _Py_uop_sym_new_tuple
#define sym_tuple_getitem _Py_uop_sym_tuple_getitem
#define sym_tuple_length _Py_uop_sym_tuple_length
#define sym_is_immortal _Py_uop_sym_is_immortal
static int
optimize_to_bool(
_PyUOpInstruction *this_instr,
_Py_UOpsContext *ctx,
_Py_UopsSymbol *value,
_Py_UopsSymbol **result_ptr)
JitOptContext *ctx,
JitOptSymbol *value,
JitOptSymbol **result_ptr)
{
if (sym_matches_type(value, &PyBool_Type)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
@ -460,8 +464,8 @@ optimize_uops(
)
{
_Py_UOpsContext context;
_Py_UOpsContext *ctx = &context;
JitOptContext context;
JitOptContext *ctx = &context;
uint32_t opcode = UINT16_MAX;
int curr_space = 0;
int max_space = 0;
@ -486,7 +490,7 @@ optimize_uops(
int oparg = this_instr->oparg;
opcode = this_instr->opcode;
_Py_UopsSymbol **stack_pointer = ctx->frame->stack_pointer;
JitOptSymbol **stack_pointer = ctx->frame->stack_pointer;
#ifdef Py_DEBUG
if (get_lltrace() >= 3) {