diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-03-01 13:53:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 13:53:13 (GMT) |
commit | 7820a5897e7762df23bff1cbe749652130654a08 (patch) | |
tree | d4040cce6aa8a7f0ee8a3edf6bb644e1b0d8a6f4 /Include/internal | |
parent | df9f7597559b6256924fcd3a1c3dc24cd5c5edaf (diff) | |
download | cpython-7820a5897e7762df23bff1cbe749652130654a08.zip cpython-7820a5897e7762df23bff1cbe749652130654a08.tar.gz cpython-7820a5897e7762df23bff1cbe749652130654a08.tar.bz2 |
bpo-46841: Use inline caching for `COMPARE_OP` (GH-31622)
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_code.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index dfa15b8..47c1998 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -77,13 +77,20 @@ typedef struct { } _PyBinaryOpCache; #define INLINE_CACHE_ENTRIES_BINARY_OP CACHE_ENTRIES(_PyBinaryOpCache) + typedef struct { _Py_CODEUNIT counter; } _PyUnpackSequenceCache; - #define INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE \ - (sizeof(_PyUnpackSequenceCache) / sizeof(_Py_CODEUNIT)) + CACHE_ENTRIES(_PyUnpackSequenceCache) + +typedef struct { + _Py_CODEUNIT counter; + _Py_CODEUNIT mask; +} _PyCompareOpCache; + +#define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache) /* Maximum size of code to quicken, in code units. */ #define MAX_SIZE_TO_QUICKEN 5000 @@ -323,8 +330,9 @@ extern int _Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, int narg extern int _Py_Specialize_Precall(PyObject *callable, _Py_CODEUNIT *instr, int nargs, PyObject *kwnames, SpecializedCacheEntry *cache, PyObject *builtins); extern void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, - int oparg); -extern void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache); + int oparg); +extern void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, + _Py_CODEUNIT *instr, int oparg); extern void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr, int oparg); |