From 424ecab494d538650ba34937cdd710094ccb2275 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Mon, 28 Feb 2022 03:54:14 -0800 Subject: bpo-46841: Use inline caching for `UNPACK_SEQUENCE` (GH-31591) --- Include/internal/pycore_code.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Include/internal/pycore_code.h') diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 0c4850f98a..0e401d61f7 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -68,9 +68,16 @@ typedef struct { _Py_CODEUNIT counter; } _PyBinaryOpCache; +typedef struct { + _Py_CODEUNIT counter; +} _PyUnpackSequenceCache; + #define INLINE_CACHE_ENTRIES_BINARY_OP \ (sizeof(_PyBinaryOpCache) / sizeof(_Py_CODEUNIT)) +#define INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE \ + (sizeof(_PyUnpackSequenceCache) / sizeof(_Py_CODEUNIT)) + /* Maximum size of code to quicken, in code units. */ #define MAX_SIZE_TO_QUICKEN 5000 @@ -312,7 +319,7 @@ extern void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT * int oparg); 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); + int oparg); /* Deallocator function for static codeobjects used in deepfreeze.py */ extern void _PyStaticCode_Dealloc(PyCodeObject *co); -- cgit v1.2.1