summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-12-14 18:22:44 (GMT)
committerGitHub <noreply@github.com>2021-12-14 18:22:44 (GMT)
commit9f8f45144b6f0ad481e80570538cce89b414f7f9 (patch)
treebde67ec27794633c1e58d7349be4bf16687a1949 /Include
parentd60457a6673cf0263213c2f2be02c633ec2e2038 (diff)
downloadcpython-9f8f45144b6f0ad481e80570538cce89b414f7f9.zip
cpython-9f8f45144b6f0ad481e80570538cce89b414f7f9.tar.gz
cpython-9f8f45144b6f0ad481e80570538cce89b414f7f9.tar.bz2
bpo-44525: Split calls into PRECALL and CALL (GH-30011)
* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW. * Update specialization to handle new CALL opcodes. * Specialize call to method descriptors. * Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_code.h4
-rw-r--r--Include/opcode.h68
2 files changed, 37 insertions, 35 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index 496d52f..b0463e3 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -271,7 +271,7 @@ int _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, _Py_CODEUNI
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_CallFunction(PyObject *callable, _Py_CODEUNIT *instr, int nargs, SpecializedCacheEntry *cache, PyObject *builtins);
+int _Py_Specialize_CallNoKw(PyObject *callable, _Py_CODEUNIT *instr, int nargs, SpecializedCacheEntry *cache, PyObject *builtins);
void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
SpecializedCacheEntry *cache);
void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache);
@@ -288,7 +288,7 @@ void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
#define COLLECT_SPECIALIZATION_STATS_DETAILED PRINT_SPECIALIZATION_STATS_DETAILED
#endif
-#define SPECIALIZATION_FAILURE_KINDS 20
+#define SPECIALIZATION_FAILURE_KINDS 30
#if COLLECT_SPECIALIZATION_STATS
diff --git a/Include/opcode.h b/Include/opcode.h
index 1341a8a..4d14081 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -87,7 +87,6 @@ extern "C" {
#define JUMP_IF_NOT_EG_MATCH 127
#define GEN_START 129
#define RAISE_VARARGS 130
-#define CALL_FUNCTION 131
#define MAKE_FUNCTION 132
#define BUILD_SLICE 133
#define MAKE_CELL 135
@@ -95,7 +94,6 @@ extern "C" {
#define LOAD_DEREF 137
#define STORE_DEREF 138
#define DELETE_DEREF 139
-#define CALL_FUNCTION_KW 141
#define CALL_FUNCTION_EX 142
#define EXTENDED_ARG 144
#define LIST_APPEND 145
@@ -108,12 +106,13 @@ extern "C" {
#define BUILD_CONST_KEY_MAP 156
#define BUILD_STRING 157
#define LOAD_METHOD 160
-#define CALL_METHOD 161
#define LIST_EXTEND 162
#define SET_UPDATE 163
#define DICT_MERGE 164
#define DICT_UPDATE 165
-#define CALL_METHOD_KW 166
+#define PRECALL_METHOD 168
+#define CALL_NO_KW 169
+#define CALL_KW 170
#define BINARY_OP_ADAPTIVE 7
#define BINARY_OP_ADD_INT 8
#define BINARY_OP_ADD_FLOAT 13
@@ -135,35 +134,38 @@ extern "C" {
#define STORE_SUBSCR_ADAPTIVE 36
#define STORE_SUBSCR_LIST_INT 38
#define STORE_SUBSCR_DICT 39
-#define CALL_FUNCTION_ADAPTIVE 40
-#define CALL_FUNCTION_BUILTIN_O 41
-#define CALL_FUNCTION_BUILTIN_FAST 42
-#define CALL_FUNCTION_LEN 43
-#define CALL_FUNCTION_ISINSTANCE 44
-#define CALL_FUNCTION_PY_SIMPLE 45
-#define JUMP_ABSOLUTE_QUICK 46
-#define LOAD_ATTR_ADAPTIVE 47
-#define LOAD_ATTR_INSTANCE_VALUE 48
-#define LOAD_ATTR_WITH_HINT 55
-#define LOAD_ATTR_SLOT 56
-#define LOAD_ATTR_MODULE 57
-#define LOAD_GLOBAL_ADAPTIVE 58
-#define LOAD_GLOBAL_MODULE 59
-#define LOAD_GLOBAL_BUILTIN 62
-#define LOAD_METHOD_ADAPTIVE 63
-#define LOAD_METHOD_CACHED 64
-#define LOAD_METHOD_CLASS 65
-#define LOAD_METHOD_MODULE 66
-#define LOAD_METHOD_NO_DICT 67
-#define STORE_ATTR_ADAPTIVE 75
-#define STORE_ATTR_INSTANCE_VALUE 76
-#define STORE_ATTR_SLOT 77
-#define STORE_ATTR_WITH_HINT 78
-#define LOAD_FAST__LOAD_FAST 79
-#define STORE_FAST__LOAD_FAST 80
-#define LOAD_FAST__LOAD_CONST 81
-#define LOAD_CONST__LOAD_FAST 87
-#define STORE_FAST__STORE_FAST 123
+#define CALL_NO_KW_ADAPTIVE 40
+#define CALL_NO_KW_BUILTIN_O 41
+#define CALL_NO_KW_BUILTIN_FAST 42
+#define CALL_NO_KW_LEN 43
+#define CALL_NO_KW_ISINSTANCE 44
+#define CALL_NO_KW_PY_SIMPLE 45
+#define CALL_NO_KW_LIST_APPEND 46
+#define CALL_NO_KW_METHOD_DESCRIPTOR_O 47
+#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 48
+#define JUMP_ABSOLUTE_QUICK 55
+#define LOAD_ATTR_ADAPTIVE 56
+#define LOAD_ATTR_INSTANCE_VALUE 57
+#define LOAD_ATTR_WITH_HINT 58
+#define LOAD_ATTR_SLOT 59
+#define LOAD_ATTR_MODULE 62
+#define LOAD_GLOBAL_ADAPTIVE 63
+#define LOAD_GLOBAL_MODULE 64
+#define LOAD_GLOBAL_BUILTIN 65
+#define LOAD_METHOD_ADAPTIVE 66
+#define LOAD_METHOD_CACHED 67
+#define LOAD_METHOD_CLASS 75
+#define LOAD_METHOD_MODULE 76
+#define LOAD_METHOD_NO_DICT 77
+#define STORE_ATTR_ADAPTIVE 78
+#define STORE_ATTR_INSTANCE_VALUE 79
+#define STORE_ATTR_SLOT 80
+#define STORE_ATTR_WITH_HINT 81
+#define LOAD_FAST__LOAD_FAST 87
+#define STORE_FAST__LOAD_FAST 123
+#define LOAD_FAST__LOAD_CONST 128
+#define LOAD_CONST__LOAD_FAST 131
+#define STORE_FAST__STORE_FAST 134
#define DO_TRACING 255
#ifdef NEED_OPCODE_JUMP_TABLES
static uint32_t _PyOpcode_RelativeJump[8] = {