summaryrefslogtreecommitdiffstats
path: root/Include/cpython/optimizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/cpython/optimizer.h')
-rw-r--r--Include/cpython/optimizer.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/Include/cpython/optimizer.h b/Include/cpython/optimizer.h
index 4753610..2a5251b 100644
--- a/Include/cpython/optimizer.h
+++ b/Include/cpython/optimizer.h
@@ -6,9 +6,27 @@
extern "C" {
#endif
+typedef struct _PyExecutorLinkListNode {
+ struct _PyExecutorObject *next;
+ struct _PyExecutorObject *previous;
+} _PyExecutorLinkListNode;
+
+
+/* Bloom filter with m = 256
+ * https://en.wikipedia.org/wiki/Bloom_filter */
+#define BLOOM_FILTER_WORDS 8
+
+typedef struct _bloom_filter {
+ uint32_t bits[BLOOM_FILTER_WORDS];
+} _PyBloomFilter;
+
typedef struct {
uint8_t opcode;
uint8_t oparg;
+ uint8_t valid;
+ uint8_t linked;
+ _PyBloomFilter bloom;
+ _PyExecutorLinkListNode links;
} _PyVMData;
typedef struct _PyExecutorObject {
@@ -45,6 +63,14 @@ _PyOptimizer_BackEdge(struct _PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_
extern _PyOptimizerObject _PyOptimizer_Default;
+void _Py_ExecutorInit(_PyExecutorObject *, _PyBloomFilter *);
+void _Py_ExecutorClear(_PyExecutorObject *);
+void _Py_BloomFilter_Init(_PyBloomFilter *);
+void _Py_BloomFilter_Add(_PyBloomFilter *bloom, void *obj);
+PyAPI_FUNC(void) _Py_Executor_DependsOn(_PyExecutorObject *executor, void *obj);
+PyAPI_FUNC(void) _Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj);
+extern void _Py_Executors_InvalidateAll(PyInterpreterState *interp);
+
/* For testing */
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void);
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewUOpOptimizer(void);