Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'main' into dev_143414
  • Loading branch information
cocolato authored Jan 22, 2026
commit 2e9c5a6504d5213b3902372d46b549d550b97004
2 changes: 2 additions & 0 deletions Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ extern void _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef sym);
extern JitOptRef _Py_uop_sym_new_slots_object(JitOptContext *ctx, unsigned int type_version);
extern JitOptRef _Py_uop_sym_slots_getattr(JitOptContext *ctx, JitOptRef ref, uint16_t slot_index);
extern void _Py_uop_sym_slots_setattr(JitOptContext *ctx, JitOptRef ref, uint16_t slot_index, JitOptRef value);
extern JitOptRef _Py_uop_sym_new_predicate(JitOptContext *ctx, JitOptRef lhs_ref, JitOptRef rhs_ref, JitOptPredicateKind kind);
extern void _Py_uop_sym_apply_predicate_narrowing(JitOptContext *ctx, JitOptRef sym, bool branch_is_true);

extern void _Py_uop_abstractcontext_init(JitOptContext *ctx);
extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx);
Expand Down
29 changes: 3 additions & 26 deletions Include/internal/pycore_optimizer_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ typedef enum _JitSymType {
JIT_SYM_TUPLE_TAG = 8,
JIT_SYM_TRUTHINESS_TAG = 9,
JIT_SYM_COMPACT_INT = 10,
JIT_SYM_SLOTS_TAG = 11,
JIT_SYM_PREDICATE_TAG = 11,
JIT_SYM_SLOTS_TAG = 12,
} JitSymType;

typedef struct _jit_opt_known_class {
Expand Down Expand Up @@ -114,6 +115,7 @@ typedef union _jit_opt_symbol {
JitOptTruthiness truthiness;
JitOptCompactInt compact;
JitOptSlotsObject slots;
JitOptPredicate predicate;
} JitOptSymbol;

// This mimics the _PyStackRef API
Expand Down Expand Up @@ -148,31 +150,6 @@ typedef struct slots_arena {
JitOptSlotMapping arena[SLOTS_ARENA_SIZE];
} slots_arena;

typedef struct _JitOptContext {
char done;
char out_of_space;
bool contradiction;
// Has the builtins dict been watched?
bool builtins_watched;
// The current "executing" frame.
_Py_UOpsAbstractFrame *frame;
_Py_UOpsAbstractFrame frames[MAX_ABSTRACT_FRAME_DEPTH];
int curr_frame_depth;

// Arena for the symbolic types.
ty_arena t_arena;

// Arena for slots mappings.
slots_arena s_arena;

JitOptRef *n_consumed;
JitOptRef *limit;
JitOptRef locals_and_stack[MAX_ABSTRACT_INTERP_SIZE];
_PyUOpInstruction *out_buffer;
int out_len;
} JitOptContext;


#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ add_op(JitOptContext *ctx, _PyUOpInstruction *this_instr,
#define sym_new_slots_object _Py_uop_sym_new_slots_object
#define sym_slots_getattr _Py_uop_sym_slots_getattr
#define sym_slots_setattr _Py_uop_sym_slots_setattr
#define sym_new_predicate _Py_uop_sym_new_predicate
#define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing

#define JUMP_TO_LABEL(label) goto label;

Expand Down
2 changes: 2 additions & 0 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ typedef struct _Py_UOpsAbstractFrame _Py_UOpsAbstractFrame;
#define sym_new_slots_object _Py_uop_sym_new_slots_object
#define sym_slots_getattr _Py_uop_sym_slots_getattr
#define sym_slots_setattr _Py_uop_sym_slots_setattr
#define sym_new_predicate _Py_uop_sym_new_predicate
#define sym_apply_predicate_narrowing _Py_uop_sym_apply_predicate_narrowing

extern int
optimize_to_bool(
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.