summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_uops.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_uops.h')
-rw-r--r--Include/internal/pycore_uops.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Include/internal/pycore_uops.h b/Include/internal/pycore_uops.h
new file mode 100644
index 0000000..0e88d7e
--- /dev/null
+++ b/Include/internal/pycore_uops.h
@@ -0,0 +1,31 @@
+#ifndef Py_INTERNAL_UOPS_H
+#define Py_INTERNAL_UOPS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+# error "this header requires Py_BUILD_CORE define"
+#endif
+
+#define _Py_UOP_MAX_TRACE_LENGTH 16
+
+typedef struct {
+ int opcode;
+ uint64_t operand; // Sometimes oparg, sometimes a cache entry
+} _PyUOpInstruction;
+
+typedef struct {
+ _PyExecutorObject base;
+ _PyUOpInstruction trace[_Py_UOP_MAX_TRACE_LENGTH]; // TODO: variable length
+} _PyUOpExecutorObject;
+
+_PyInterpreterFrame *_PyUopExecute(
+ _PyExecutorObject *executor,
+ _PyInterpreterFrame *frame,
+ PyObject **stack_pointer);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_UOPS_H */