Skip to content

Commit 72ebedd

Browse files
committed
Add value recording to JIT tracing front-end
1 parent 1f55caf commit 72ebedd

21 files changed

+1698
-1272
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 67 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_optimizer.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ typedef struct _PyJitTracerPreviousState {
9090
PyCodeObject *instr_code; // Strong
9191
struct _PyInterpreterFrame *instr_frame;
9292
_PyBloomFilter dependencies;
93+
PyObject *recorded_value; // Strong, may be NULL
9394
} _PyJitTracerPreviousState;
9495

9596
typedef struct _PyJitTracerTranslatorState {
@@ -336,14 +337,20 @@ PyAPI_FUNC(int) _PyJit_translate_single_bytecode_to_trace(PyThreadState *tstate,
336337
PyAPI_FUNC(int)
337338
_PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame,
338339
_Py_CODEUNIT *curr_instr, _Py_CODEUNIT *start_instr,
339-
_Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit,
340+
_Py_CODEUNIT *close_loop_instr, _PyStackRef *stack_pointer, int chain_depth, _PyExitData *exit,
340341
int oparg, _PyExecutorObject *current_executor);
341342

342343
PyAPI_FUNC(void) _PyJit_FinalizeTracing(PyThreadState *tstate, int err);
343344
void _PyJit_TracerFree(_PyThreadStateImpl *_tstate);
344345

345346
void _PyJit_Tracer_InvalidateDependency(PyThreadState *old_tstate, void *obj);
346347

348+
#ifdef _Py_TIER2
349+
typedef void (*_Py_RecordFuncPtr)(_PyInterpreterFrame *frame, _PyStackRef *stackpointer, int oparg, PyObject **recorded_value);
350+
PyAPI_DATA(const _Py_RecordFuncPtr) _PyOpcode_RecordFunctions[];
351+
PyAPI_DATA(const uint8_t) _PyOpcode_RecordFunctionIndices[256];
352+
#endif
353+
347354
#ifdef __cplusplus
348355
}
349356
#endif

0 commit comments

Comments
 (0)