diff options
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_code.h | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 2791495..d83df5e 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -259,9 +259,35 @@ PyAPI_FUNC(PyCodeObject *) _PyCode_New(struct _PyCodeConstructor *); /* Private API */ /* Getters for internal PyCodeObject data. */ -PyAPI_FUNC(PyObject *) _PyCode_GetVarnames(PyCodeObject *); -PyAPI_FUNC(PyObject *) _PyCode_GetCellvars(PyCodeObject *); -PyAPI_FUNC(PyObject *) _PyCode_GetFreevars(PyCodeObject *); +extern PyObject* _PyCode_GetVarnames(PyCodeObject *); +extern PyObject* _PyCode_GetCellvars(PyCodeObject *); +extern PyObject* _PyCode_GetFreevars(PyCodeObject *); + +/* Return the ending source code line number from a bytecode index. */ +extern int _PyCode_Addr2EndLine(PyCodeObject *, int); + +/* Return the ending source code line number from a bytecode index. */ +extern int _PyCode_Addr2EndLine(PyCodeObject *, int); +/* Return the starting source code column offset from a bytecode index. */ +extern int _PyCode_Addr2Offset(PyCodeObject *, int); +/* Return the ending source code column offset from a bytecode index. */ +extern int _PyCode_Addr2EndOffset(PyCodeObject *, int); + +/** API for initializing the line number tables. */ +extern int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds); +extern int _PyCode_InitEndAddressRange(PyCodeObject* co, PyCodeAddressRange* bounds); + +/** Out of process API for initializing the line number table. */ +extern void _PyLineTable_InitAddressRange( + const char *linetable, + Py_ssize_t length, + int firstlineno, + PyCodeAddressRange *range); + +/** API for traversing the line number table. */ +extern int _PyLineTable_NextAddressRange(PyCodeAddressRange *range); +extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range); + #define ADAPTIVE_CACHE_BACKOFF 64 @@ -272,26 +298,26 @@ cache_backoff(_PyAdaptiveEntry *entry) { /* Specialization functions */ -int _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); -int _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); -int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); -int _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); -int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); -int _Py_Specialize_StoreSubscr(PyObject *container, PyObject *sub, _Py_CODEUNIT *instr); -int _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, int nargs, +extern int _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); +extern int _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); +extern int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); +extern int _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name, SpecializedCacheEntry *cache); +extern int _Py_Specialize_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); +extern int _Py_Specialize_StoreSubscr(PyObject *container, PyObject *sub, _Py_CODEUNIT *instr); +extern int _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, int nargs, PyObject *kwnames, SpecializedCacheEntry *cache); -int _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, int nargs, +extern int _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, int nargs, PyObject *kwnames, SpecializedCacheEntry *cache, PyObject *builtins); -void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, +extern void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, int oparg); -void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); -void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, +extern void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); +extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); /* Deallocator function for static codeobjects used in deepfreeze.py */ -void _PyStaticCode_Dealloc(PyCodeObject *co); +extern void _PyStaticCode_Dealloc(PyCodeObject *co); /* Function to intern strings of codeobjects */ -void _PyStaticCode_InternStrings(PyCodeObject *co); +extern void _PyStaticCode_InternStrings(PyCodeObject *co); #ifdef Py_STATS @@ -343,9 +369,9 @@ extern PyStats _py_stats; #define CALL_STAT_INC(name) _py_stats.call_stats.name++ #define OBJECT_STAT_INC(name) _py_stats.object_stats.name++ -void _Py_PrintSpecializationStats(int to_file); +extern void _Py_PrintSpecializationStats(int to_file); -PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); +extern PyObject* _Py_GetSpecializationStats(void); #else #define STAT_INC(opname, name) ((void)0) |