Skip to content
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
22 changes: 11 additions & 11 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Include/internal/pycore_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx);
extern void _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef sym);
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_sym_set_recorded_value(JitOptContext *ctx, JitOptRef sym, PyObject *value);
extern void _Py_uop_sym_set_recorded_type(JitOptContext *ctx, JitOptRef sym, PyTypeObject *type);
extern void _Py_uop_sym_set_recorded_gen_func(JitOptContext *ctx, JitOptRef ref, PyFunctionObject *value);
extern PyCodeObject *_Py_uop_sym_get_probable_func_code(JitOptRef sym);
extern PyObject *_Py_uop_sym_get_probable_value(JitOptRef sym);

extern void _Py_uop_abstractcontext_init(JitOptContext *ctx);
extern void _Py_uop_abstractcontext_fini(JitOptContext *ctx);
Expand All @@ -308,6 +313,14 @@ extern _Py_UOpsAbstractFrame *_Py_uop_frame_new(
int curr_stackentries,
JitOptRef *args,
int arg_len);

extern _Py_UOpsAbstractFrame *_Py_uop_frame_new_from_symbol(
JitOptContext *ctx,
JitOptRef callable,
int curr_stackentries,
JitOptRef *args,
int arg_len);

extern int _Py_uop_frame_pop(JitOptContext *ctx, PyCodeObject *co, int curr_stackentries);

PyAPI_FUNC(PyObject *) _Py_uop_symbols_test(PyObject *self, PyObject *ignored);
Expand Down Expand Up @@ -341,6 +354,7 @@ _PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame,
int oparg, _PyExecutorObject *current_executor);

PyAPI_FUNC(void) _PyJit_FinalizeTracing(PyThreadState *tstate, int err);
void _PyPrintExecutor(_PyExecutorObject *executor, const _PyUOpInstruction *marker);
void _PyJit_TracerFree(_PyThreadStateImpl *_tstate);

void _PyJit_Tracer_InvalidateDependency(PyThreadState *old_tstate, void *obj);
Expand Down
24 changes: 24 additions & 0 deletions Include/internal/pycore_optimizer_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ typedef enum _JitSymType {
JIT_SYM_TRUTHINESS_TAG = 9,
JIT_SYM_COMPACT_INT = 10,
JIT_SYM_PREDICATE_TAG = 11,
JIT_SYM_RECORDED_VALUE_TAG = 12,
JIT_SYM_RECORDED_TYPE_TAG = 13,
JIT_SYM_RECORDED_GEN_FUNC_TAG = 14,
} JitSymType;

typedef struct _jit_opt_known_class {
Expand Down Expand Up @@ -87,6 +90,24 @@ typedef struct {
uint16_t rhs;
} JitOptPredicate;

typedef struct _jit_opt_recorded_value {
uint8_t tag;
bool known_type;
PyObject *value;
} JitOptRecordedValue;

typedef struct _jit_opt_recorded_type {
uint8_t tag;
PyTypeObject *type;
} JitOptRecordedType;

/* Represents a generator, but we record the
* function as the generator is emphemeral */
typedef struct _jit_opt_recorded_gen_func {
uint8_t tag;
PyFunctionObject *func;
} JitOptRecordedGenFunc;

typedef struct {
uint8_t tag;
} JitOptCompactInt;
Expand All @@ -100,6 +121,9 @@ typedef union _jit_opt_symbol {
JitOptTruthiness truthiness;
JitOptCompactInt compact;
JitOptPredicate predicate;
JitOptRecordedValue recorded_value;
JitOptRecordedType recorded_type;
JitOptRecordedGenFunc recorded_gen_func;
} JitOptSymbol;

// This mimics the _PyStackRef API
Expand Down
Loading
Loading