summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-02-28 11:54:14 (GMT)
committerGitHub <noreply@github.com>2022-02-28 11:54:14 (GMT)
commit424ecab494d538650ba34937cdd710094ccb2275 (patch)
treefe50c89dca09df2c3f2ff49cc937af75a9450c75 /Include/internal/pycore_code.h
parentc32aef48533769161e1247927a5b418322e0860c (diff)
downloadcpython-424ecab494d538650ba34937cdd710094ccb2275.zip
cpython-424ecab494d538650ba34937cdd710094ccb2275.tar.gz
cpython-424ecab494d538650ba34937cdd710094ccb2275.tar.bz2
bpo-46841: Use inline caching for `UNPACK_SEQUENCE` (GH-31591)
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 0c4850f..0e401d6 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);