summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-03-01 16:00:34 (GMT)
committerGitHub <noreply@github.com>2022-03-01 16:00:34 (GMT)
commit3b0f1c5a710eff289dc44bec972dbaea353cc54f (patch)
treea3d33b56de327fa0a3abbff54c8013a95da61638 /Include/internal/pycore_code.h
parente91b0a7139d4a4cbd2351ccb5cd021a100cf42d2 (diff)
downloadcpython-3b0f1c5a710eff289dc44bec972dbaea353cc54f.zip
cpython-3b0f1c5a710eff289dc44bec972dbaea353cc54f.tar.gz
cpython-3b0f1c5a710eff289dc44bec972dbaea353cc54f.tar.bz2
bpo-46841: Use inline cache for `BINARY_SUBSCR`. (GH-31618)
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 47c1998..b9671d0 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -92,6 +92,15 @@ typedef struct {
#define INLINE_CACHE_ENTRIES_COMPARE_OP CACHE_ENTRIES(_PyCompareOpCache)
+typedef struct {
+ _Py_CODEUNIT counter;
+ _Py_CODEUNIT type_version;
+ _Py_CODEUNIT _t1;
+ _Py_CODEUNIT func_version;
+} _PyBinarySubscrCache;
+
+#define INLINE_CACHE_ENTRIES_BINARY_SUBSCR CACHE_ENTRIES(_PyBinarySubscrCache)
+
/* Maximum size of code to quicken, in code units. */
#define MAX_SIZE_TO_QUICKEN 5000
@@ -323,7 +332,7 @@ extern int _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObjec
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);
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_BinarySubscr(PyObject *sub, PyObject *container, _Py_CODEUNIT *instr);
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);