Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-19 09:50:46

0001 #ifndef Py_INTERNAL_FUNCTION_H
0002 #define Py_INTERNAL_FUNCTION_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 #include "pycore_lock.h"
0008 
0009 #ifndef Py_BUILD_CORE
0010 #  error "this header requires Py_BUILD_CORE define"
0011 #endif
0012 
0013 extern PyObject* _PyFunction_Vectorcall(
0014     PyObject *func,
0015     PyObject *const *stack,
0016     size_t nargsf,
0017     PyObject *kwnames);
0018 
0019 #define FUNC_MAX_WATCHERS 8
0020 
0021 #define FUNC_VERSION_CACHE_SIZE (1<<12)  /* Must be a power of 2 */
0022 
0023 struct _func_version_cache_item {
0024     PyFunctionObject *func;
0025     PyObject *code;
0026 };
0027 
0028 struct _py_func_state {
0029 #ifdef Py_GIL_DISABLED
0030     // Protects next_version
0031     PyMutex mutex;
0032 #endif
0033 
0034     uint32_t next_version;
0035     // Borrowed references to function and code objects whose
0036     // func_version % FUNC_VERSION_CACHE_SIZE
0037     // once was equal to the index in the table.
0038     // They are cleared when the function or code object is deallocated.
0039     struct _func_version_cache_item func_version_cache[FUNC_VERSION_CACHE_SIZE];
0040 };
0041 
0042 extern PyFunctionObject* _PyFunction_FromConstructor(PyFrameConstructor *constr);
0043 
0044 extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
0045 PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t version);
0046 void _PyFunction_ClearCodeByVersion(uint32_t version);
0047 PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code);
0048 
0049 extern PyObject *_Py_set_function_type_params(
0050     PyThreadState* unused, PyObject *func, PyObject *type_params);
0051 
0052 #ifdef __cplusplus
0053 }
0054 #endif
0055 #endif /* !Py_INTERNAL_FUNCTION_H */