summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_function.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_function.h')
-rw-r--r--Include/internal/pycore_function.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/Include/internal/pycore_function.h b/Include/internal/pycore_function.h
index dad6a89..24fbb3d 100644
--- a/Include/internal/pycore_function.h
+++ b/Include/internal/pycore_function.h
@@ -17,20 +17,27 @@ extern PyObject* _PyFunction_Vectorcall(
#define FUNC_MAX_WATCHERS 8
#define FUNC_VERSION_CACHE_SIZE (1<<12) /* Must be a power of 2 */
+
+struct _func_version_cache_item {
+ PyFunctionObject *func;
+ PyObject *code;
+};
+
struct _py_func_state {
uint32_t next_version;
- // Borrowed references to function objects whose
+ // Borrowed references to function and code objects whose
// func_version % FUNC_VERSION_CACHE_SIZE
// once was equal to the index in the table.
- // They are cleared when the function is deallocated.
- PyFunctionObject *func_version_cache[FUNC_VERSION_CACHE_SIZE];
+ // They are cleared when the function or code object is deallocated.
+ struct _func_version_cache_item func_version_cache[FUNC_VERSION_CACHE_SIZE];
};
extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
-PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version);
+void _PyFunction_ClearCodeByVersion(uint32_t version);
+PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code);
extern PyObject *_Py_set_function_type_params(
PyThreadState* unused, PyObject *func, PyObject *type_params);