summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-10 10:40:35 (GMT)
committerGitHub <noreply@github.com>2023-07-10 10:40:35 (GMT)
commit0c90e7561046a2deb358e6695148060a1c199b49 (patch)
tree981359878b814a308c6fe977dd0c552e99bdd653
parent34c14147a2c52930b8b471905074509639e82d5b (diff)
downloadcpython-0c90e7561046a2deb358e6695148060a1c199b49.zip
cpython-0c90e7561046a2deb358e6695148060a1c199b49.tar.gz
cpython-0c90e7561046a2deb358e6695148060a1c199b49.tar.bz2
GH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)
* Add two more specializations of LOAD_ATTR.
-rw-r--r--Include/internal/pycore_opcode.h40
-rw-r--r--Include/opcode.h52
-rw-r--r--Lib/_opcode_metadata.py2
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-07-04-04-50-14.gh-issue-100288.yNQ1ez.rst3
-rw-r--r--Python/bytecodes.c43
-rw-r--r--Python/executor_cases.c.h70
-rw-r--r--Python/generated_cases.c.h398
-rw-r--r--Python/opcode_metadata.h16
-rw-r--r--Python/opcode_targets.h36
-rw-r--r--Python/specialize.c35
10 files changed, 405 insertions, 290 deletions
diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h
index c7c2fdc..d7f6b84 100644
--- a/Include/internal/pycore_opcode.h
+++ b/Include/internal/pycore_opcode.h
@@ -158,6 +158,8 @@ const uint8_t _PyOpcode_Deopt[256] = {
[LOAD_ATTR_METHOD_NO_DICT] = LOAD_ATTR,
[LOAD_ATTR_METHOD_WITH_VALUES] = LOAD_ATTR,
[LOAD_ATTR_MODULE] = LOAD_ATTR,
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = LOAD_ATTR,
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = LOAD_ATTR,
[LOAD_ATTR_PROPERTY] = LOAD_ATTR,
[LOAD_ATTR_SLOT] = LOAD_ATTR,
[LOAD_ATTR_WITH_HINT] = LOAD_ATTR,
@@ -328,14 +330,14 @@ const char *const _PyOpcode_OpName[268] = {
[LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES",
[LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT",
[LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT",
- [COMPARE_OP_FLOAT] = "COMPARE_OP_FLOAT",
- [COMPARE_OP_INT] = "COMPARE_OP_INT",
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = "LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES",
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = "LOAD_ATTR_NONDESCRIPTOR_NO_DICT",
[RETURN_VALUE] = "RETURN_VALUE",
- [COMPARE_OP_STR] = "COMPARE_OP_STR",
+ [COMPARE_OP_FLOAT] = "COMPARE_OP_FLOAT",
[SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS",
- [FOR_ITER_LIST] = "FOR_ITER_LIST",
+ [COMPARE_OP_INT] = "COMPARE_OP_INT",
[LOAD_LOCALS] = "LOAD_LOCALS",
- [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE",
+ [COMPARE_OP_STR] = "COMPARE_OP_STR",
[POP_EXCEPT] = "POP_EXCEPT",
[STORE_NAME] = "STORE_NAME",
[DELETE_NAME] = "DELETE_NAME",
@@ -358,9 +360,9 @@ const char *const _PyOpcode_OpName[268] = {
[IMPORT_NAME] = "IMPORT_NAME",
[IMPORT_FROM] = "IMPORT_FROM",
[JUMP_FORWARD] = "JUMP_FORWARD",
+ [FOR_ITER_LIST] = "FOR_ITER_LIST",
+ [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE",
[FOR_ITER_RANGE] = "FOR_ITER_RANGE",
- [FOR_ITER_GEN] = "FOR_ITER_GEN",
- [CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS",
[POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE",
[POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE",
[LOAD_GLOBAL] = "LOAD_GLOBAL",
@@ -379,11 +381,11 @@ const char *const _PyOpcode_OpName[268] = {
[POP_JUMP_IF_NONE] = "POP_JUMP_IF_NONE",
[RAISE_VARARGS] = "RAISE_VARARGS",
[GET_AWAITABLE] = "GET_AWAITABLE",
- [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS",
+ [FOR_ITER_GEN] = "FOR_ITER_GEN",
[BUILD_SLICE] = "BUILD_SLICE",
[JUMP_BACKWARD_NO_INTERRUPT] = "JUMP_BACKWARD_NO_INTERRUPT",
[MAKE_CELL] = "MAKE_CELL",
- [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS",
+ [CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS",
[LOAD_DEREF] = "LOAD_DEREF",
[STORE_DEREF] = "STORE_DEREF",
[DELETE_DEREF] = "DELETE_DEREF",
@@ -395,26 +397,26 @@ const char *const _PyOpcode_OpName[268] = {
[LIST_APPEND] = "LIST_APPEND",
[SET_ADD] = "SET_ADD",
[MAP_ADD] = "MAP_ADD",
- [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1",
+ [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS",
[COPY_FREE_VARS] = "COPY_FREE_VARS",
[YIELD_VALUE] = "YIELD_VALUE",
[RESUME] = "RESUME",
[MATCH_CLASS] = "MATCH_CLASS",
+ [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS",
+ [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1",
[CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1",
- [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1",
- [CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS",
[BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP",
[BUILD_STRING] = "BUILD_STRING",
[CONVERT_VALUE] = "CONVERT_VALUE",
+ [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1",
+ [CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS",
[CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O",
- [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST",
- [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS",
[LIST_EXTEND] = "LIST_EXTEND",
[SET_UPDATE] = "SET_UPDATE",
[DICT_MERGE] = "DICT_MERGE",
[DICT_UPDATE] = "DICT_UPDATE",
- [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN",
- [CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE",
+ [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST",
+ [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS",
[LOAD_FAST_LOAD_FAST] = "LOAD_FAST_LOAD_FAST",
[STORE_FAST_LOAD_FAST] = "STORE_FAST_LOAD_FAST",
[STORE_FAST_STORE_FAST] = "STORE_FAST_STORE_FAST",
@@ -425,14 +427,14 @@ const char *const _PyOpcode_OpName[268] = {
[LOAD_FROM_DICT_OR_GLOBALS] = "LOAD_FROM_DICT_OR_GLOBALS",
[LOAD_FROM_DICT_OR_DEREF] = "LOAD_FROM_DICT_OR_DEREF",
[SET_FUNCTION_ATTRIBUTE] = "SET_FUNCTION_ATTRIBUTE",
+ [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN",
+ [CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE",
[CALL_NO_KW_LIST_APPEND] = "CALL_NO_KW_LIST_APPEND",
[CALL_NO_KW_METHOD_DESCRIPTOR_O] = "CALL_NO_KW_METHOD_DESCRIPTOR_O",
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
[CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
[CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "CALL_NO_KW_METHOD_DESCRIPTOR_FAST",
[CALL_NO_KW_ALLOC_AND_ENTER_INIT] = "CALL_NO_KW_ALLOC_AND_ENTER_INIT",
- [184] = "<184>",
- [185] = "<185>",
[186] = "<186>",
[187] = "<187>",
[188] = "<188>",
@@ -519,8 +521,6 @@ const char *const _PyOpcode_OpName[268] = {
#endif // NEED_OPCODE_TABLES
#define EXTRA_CASES \
- case 184: \
- case 185: \
case 186: \
case 187: \
case 188: \
diff --git a/Include/opcode.h b/Include/opcode.h
index 6b855bd..6975209 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -201,31 +201,33 @@ extern "C" {
#define LOAD_ATTR_METHOD_WITH_VALUES 78
#define LOAD_ATTR_METHOD_NO_DICT 79
#define LOAD_ATTR_METHOD_LAZY_DICT 80
-#define COMPARE_OP_FLOAT 81
-#define COMPARE_OP_INT 82
-#define COMPARE_OP_STR 84
-#define FOR_ITER_LIST 86
-#define FOR_ITER_TUPLE 88
-#define FOR_ITER_RANGE 111
-#define FOR_ITER_GEN 112
-#define CALL_BOUND_METHOD_EXACT_ARGS 113
-#define CALL_PY_EXACT_ARGS 132
-#define CALL_PY_WITH_DEFAULTS 136
-#define CALL_NO_KW_TYPE_1 148
-#define CALL_NO_KW_STR_1 153
-#define CALL_NO_KW_TUPLE_1 154
-#define CALL_BUILTIN_CLASS 155
-#define CALL_NO_KW_BUILTIN_O 159
-#define CALL_NO_KW_BUILTIN_FAST 160
-#define CALL_BUILTIN_FAST_WITH_KEYWORDS 161
-#define CALL_NO_KW_LEN 166
-#define CALL_NO_KW_ISINSTANCE 167
-#define CALL_NO_KW_LIST_APPEND 178
-#define CALL_NO_KW_METHOD_DESCRIPTOR_O 179
-#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 180
-#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 181
-#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 182
-#define CALL_NO_KW_ALLOC_AND_ENTER_INIT 183
+#define LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES 81
+#define LOAD_ATTR_NONDESCRIPTOR_NO_DICT 82
+#define COMPARE_OP_FLOAT 84
+#define COMPARE_OP_INT 86
+#define COMPARE_OP_STR 88
+#define FOR_ITER_LIST 111
+#define FOR_ITER_TUPLE 112
+#define FOR_ITER_RANGE 113
+#define FOR_ITER_GEN 132
+#define CALL_BOUND_METHOD_EXACT_ARGS 136
+#define CALL_PY_EXACT_ARGS 148
+#define CALL_PY_WITH_DEFAULTS 153
+#define CALL_NO_KW_TYPE_1 154
+#define CALL_NO_KW_STR_1 155
+#define CALL_NO_KW_TUPLE_1 159
+#define CALL_BUILTIN_CLASS 160
+#define CALL_NO_KW_BUILTIN_O 161
+#define CALL_NO_KW_BUILTIN_FAST 166
+#define CALL_BUILTIN_FAST_WITH_KEYWORDS 167
+#define CALL_NO_KW_LEN 178
+#define CALL_NO_KW_ISINSTANCE 179
+#define CALL_NO_KW_LIST_APPEND 180
+#define CALL_NO_KW_METHOD_DESCRIPTOR_O 181
+#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 182
+#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 183
+#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 184
+#define CALL_NO_KW_ALLOC_AND_ENTER_INIT 185
#define NB_ADD 0
#define NB_AND 1
diff --git a/Lib/_opcode_metadata.py b/Lib/_opcode_metadata.py
index b0fcd1a..fd8ecdb 100644
--- a/Lib/_opcode_metadata.py
+++ b/Lib/_opcode_metadata.py
@@ -63,6 +63,8 @@ _specializations = {
"LOAD_ATTR_METHOD_WITH_VALUES",
"LOAD_ATTR_METHOD_NO_DICT",
"LOAD_ATTR_METHOD_LAZY_DICT",
+ "LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES",
+ "LOAD_ATTR_NONDESCRIPTOR_NO_DICT",
],
"COMPARE_OP": [
"COMPARE_OP_FLOAT",
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-07-04-04-50-14.gh-issue-100288.yNQ1ez.rst b/Misc/NEWS.d/next/Core and Builtins/2023-07-04-04-50-14.gh-issue-100288.yNQ1ez.rst
new file mode 100644
index 0000000..faf43bd
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-07-04-04-50-14.gh-issue-100288.yNQ1ez.rst
@@ -0,0 +1,3 @@
+Specialize :opcode:`LOAD_ATTR` for non-descriptors on the class. Adds
+:opcode:`LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES` and :opcode
+`LOAD_ATTR_NONDESCRIPTOR_NO_DICT`.
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 89b077a..0848bbf 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1809,6 +1809,8 @@ dummy_func(
LOAD_ATTR_METHOD_WITH_VALUES,
LOAD_ATTR_METHOD_NO_DICT,
LOAD_ATTR_METHOD_LAZY_DICT,
+ LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES,
+ LOAD_ATTR_NONDESCRIPTOR_NO_DICT,
};
inst(LOAD_ATTR, (unused/9, owner -- res2 if (oparg & 1), res)) {
@@ -2657,7 +2659,8 @@ dummy_func(
exc_info->exc_value = Py_NewRef(new_exc);
}
- inst(LOAD_ATTR_METHOD_WITH_VALUES, (unused/1, type_version/2, keys_version/2, descr/4, self -- res2 if (oparg & 1), res)) {
+ inst(LOAD_ATTR_METHOD_WITH_VALUES, (unused/1, type_version/2, keys_version/2, descr/4, self -- res2 if (1), res)) {
+ assert(oparg & 1);
/* Cached method object */
PyTypeObject *self_cls = Py_TYPE(self);
assert(type_version != 0);
@@ -2673,10 +2676,10 @@ dummy_func(
res2 = Py_NewRef(descr);
assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR));
res = self;
- assert(oparg & 1);
}
- inst(LOAD_ATTR_METHOD_NO_DICT, (unused/1, type_version/2, unused/2, descr/4, self -- res2 if (oparg & 1), res)) {
+ inst(LOAD_ATTR_METHOD_NO_DICT, (unused/1, type_version/2, unused/2, descr/4, self -- res2 if (1), res)) {
+ assert(oparg & 1);
PyTypeObject *self_cls = Py_TYPE(self);
DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
assert(self_cls->tp_dictoffset == 0);
@@ -2685,10 +2688,39 @@ dummy_func(
assert(_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR));
res2 = Py_NewRef(descr);
res = self;
- assert(oparg & 1);
}
- inst(LOAD_ATTR_METHOD_LAZY_DICT, (unused/1, type_version/2, unused/2, descr/4, self -- res2 if (oparg & 1), res)) {
+ inst(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES, (unused/1, type_version/2, keys_version/2, descr/4, self -- res2 if (0), res)) {
+ assert((oparg & 1) == 0);
+ PyTypeObject *self_cls = Py_TYPE(self);
+ assert(type_version != 0);
+ DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
+ assert(self_cls->tp_flags & Py_TPFLAGS_MANAGED_DICT);
+ PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(self);
+ DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
+ PyHeapTypeObject *self_heap_type = (PyHeapTypeObject *)self_cls;
+ DEOPT_IF(self_heap_type->ht_cached_keys->dk_version !=
+ keys_version, LOAD_ATTR);
+ STAT_INC(LOAD_ATTR, hit);
+ assert(descr != NULL);
+ DECREF_INPUTS();
+ res = Py_NewRef(descr);
+ }
+
+ inst(LOAD_ATTR_NONDESCRIPTOR_NO_DICT, (unused/1, type_version/2, unused/2, descr/4, self -- res2 if (0), res)) {
+ assert((oparg & 1) == 0);
+ PyTypeObject *self_cls = Py_TYPE(self);
+ assert(type_version != 0);
+ DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
+ assert(self_cls->tp_dictoffset == 0);
+ STAT_INC(LOAD_ATTR, hit);
+ assert(descr != NULL);
+ DECREF_INPUTS();
+ res = Py_NewRef(descr);
+ }
+
+ inst(LOAD_ATTR_METHOD_LAZY_DICT, (unused/1, type_version/2, unused/2, descr/4, self -- res2 if (1), res)) {
+ assert(oparg & 1);
PyTypeObject *self_cls = Py_TYPE(self);
DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
Py_ssize_t dictoffset = self_cls->tp_dictoffset;
@@ -2701,7 +2733,6 @@ dummy_func(
assert(_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR));
res2 = Py_NewRef(descr);
res = self;
- assert(oparg & 1);
}
inst(KW_NAMES, (--)) {
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 32efeb0..0ef7522 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1738,7 +1738,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2114 "Python/bytecodes.c"
+ #line 2116 "Python/bytecodes.c"
DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP);
STAT_INC(COMPARE_OP, hit);
@@ -1760,7 +1760,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2129 "Python/bytecodes.c"
+ #line 2131 "Python/bytecodes.c"
DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP);
DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP);
@@ -1786,7 +1786,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2148 "Python/bytecodes.c"
+ #line 2150 "Python/bytecodes.c"
DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP);
STAT_INC(COMPARE_OP, hit);
@@ -1809,12 +1809,12 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2163 "Python/bytecodes.c"
+ #line 2165 "Python/bytecodes.c"
int res = Py_Is(left, right) ^ oparg;
#line 1815 "Python/executor_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 2165 "Python/bytecodes.c"
+ #line 2167 "Python/bytecodes.c"
b = res ? Py_True : Py_False;
#line 1820 "Python/executor_cases.c.h"
STACK_SHRINK(1);
@@ -1826,12 +1826,12 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2169 "Python/bytecodes.c"
+ #line 2171 "Python/bytecodes.c"
int res = PySequence_Contains(right, left);
#line 1832 "Python/executor_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 2171 "Python/bytecodes.c"
+ #line 2173 "Python/bytecodes.c"
if (res < 0) goto pop_2_error;
b = (res ^ oparg) ? Py_True : Py_False;
#line 1838 "Python/executor_cases.c.h"
@@ -1845,12 +1845,12 @@
PyObject *exc_value = stack_pointer[-2];
PyObject *rest;
PyObject *match;
- #line 2176 "Python/bytecodes.c"
+ #line 2178 "Python/bytecodes.c"
if (check_except_star_type_valid(tstate, match_type) < 0) {
#line 1851 "Python/executor_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 2178 "Python/bytecodes.c"
+ #line 2180 "Python/bytecodes.c"
if (true) goto pop_2_error;
}
@@ -1861,7 +1861,7 @@
#line 1862 "Python/executor_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 2186 "Python/bytecodes.c"
+ #line 2188 "Python/bytecodes.c"
if (res < 0) goto pop_2_error;
assert((match == NULL) == (rest == NULL));
@@ -1880,19 +1880,19 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2197 "Python/bytecodes.c"
+ #line 2199 "Python/bytecodes.c"
assert(PyExceptionInstance_Check(left));
if (check_except_type_valid(tstate, right) < 0) {
#line 1887 "Python/executor_cases.c.h"
Py_DECREF(right);
- #line 2200 "Python/bytecodes.c"
+ #line 2202 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
int res = PyErr_GivenExceptionMatches(left, right);
#line 1894 "Python/executor_cases.c.h"
Py_DECREF(right);
- #line 2205 "Python/bytecodes.c"
+ #line 2207 "Python/bytecodes.c"
b = res ? Py_True : Py_False;
#line 1898 "Python/executor_cases.c.h"
stack_pointer[-1] = b;
@@ -1902,7 +1902,7 @@
case GET_LEN: {
PyObject *obj = stack_pointer[-1];
PyObject *len_o;
- #line 2309 "Python/bytecodes.c"
+ #line 2311 "Python/bytecodes.c"
// PUSH(len(TOS))
Py_ssize_t len_i = PyObject_Length(obj);
if (len_i < 0) goto error;
@@ -1919,7 +1919,7 @@
PyObject *type = stack_pointer[-2];
PyObject *subject = stack_pointer[-3];
PyObject *attrs;
- #line 2317 "Python/bytecodes.c"
+ #line 2319 "Python/bytecodes.c"
// Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or
// None on failure.
assert(PyTuple_CheckExact(names));
@@ -1928,7 +1928,7 @@
Py_DECREF(subject);
Py_DECREF(type);
Py_DECREF(names);
- #line 2322 "Python/bytecodes.c"
+ #line 2324 "Python/bytecodes.c"
if (attrs) {
assert(PyTuple_CheckExact(attrs)); // Success!
}
@@ -1945,7 +1945,7 @@
case MATCH_MAPPING: {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2332 "Python/bytecodes.c"
+ #line 2334 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res = match ? Py_True : Py_False;
#line 1952 "Python/executor_cases.c.h"
@@ -1957,7 +1957,7 @@
case MATCH_SEQUENCE: {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2337 "Python/bytecodes.c"
+ #line 2339 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res = match ? Py_True : Py_False;
#line 1964 "Python/executor_cases.c.h"
@@ -1970,7 +1970,7 @@
PyObject *keys = stack_pointer[-1];
PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
- #line 2342 "Python/bytecodes.c"
+ #line 2344 "Python/bytecodes.c"
// On successful match, PUSH(values). Otherwise, PUSH(None).
values_or_none = match_keys(tstate, subject, keys);
if (values_or_none == NULL) goto error;
@@ -1983,12 +1983,12 @@
case GET_ITER: {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2348 "Python/bytecodes.c"
+ #line 2350 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
#line 1990 "Python/executor_cases.c.h"
Py_DECREF(iterable);
- #line 2351 "Python/bytecodes.c"
+ #line 2353 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
#line 1994 "Python/executor_cases.c.h"
stack_pointer[-1] = iter;
@@ -1998,7 +1998,7 @@
case GET_YIELD_FROM_ITER: {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2355 "Python/bytecodes.c"
+ #line 2357 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
/* `iterable` is a coroutine */
@@ -2023,7 +2023,7 @@
}
#line 2025 "Python/executor_cases.c.h"
Py_DECREF(iterable);
- #line 2378 "Python/bytecodes.c"
+ #line 2380 "Python/bytecodes.c"
}
#line 2029 "Python/executor_cases.c.h"
stack_pointer[-1] = iter;
@@ -2035,7 +2035,7 @@
PyObject *lasti = stack_pointer[-3];
PyObject *exit_func = stack_pointer[-4];
PyObject *res;
- #line 2610 "Python/bytecodes.c"
+ #line 2612 "Python/bytecodes.c"
/* At the top of the stack are 4 values:
- val: TOP = exc_info()
- unused: SECOND = previous exception
@@ -2065,7 +2065,7 @@
case PUSH_EXC_INFO: {
PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
- #line 2649 "Python/bytecodes.c"
+ #line 2651 "Python/bytecodes.c"
_PyErr_StackItem *exc_info = tstate->exc_info;
if (exc_info->exc_value != NULL) {
prev_exc = exc_info->exc_value;
@@ -2084,7 +2084,7 @@
case EXIT_INIT_CHECK: {
PyObject *should_be_none = stack_pointer[-1];
- #line 3019 "Python/bytecodes.c"
+ #line 3050 "Python/bytecodes.c"
assert(STACK_LEVEL() == 2);
if (should_be_none != Py_None) {
PyErr_Format(PyExc_TypeError,
@@ -2100,7 +2100,7 @@
case MAKE_FUNCTION: {
PyObject *codeobj = stack_pointer[-1];
PyObject *func;
- #line 3433 "Python/bytecodes.c"
+ #line 3464 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@@ -2120,7 +2120,7 @@
case SET_FUNCTION_ATTRIBUTE: {
PyObject *func = stack_pointer[-1];
PyObject *attr = stack_pointer[-2];
- #line 3447 "Python/bytecodes.c"
+ #line 3478 "Python/bytecodes.c"
assert(PyFunction_Check(func));
PyFunctionObject *func_obj = (PyFunctionObject *)func;
switch(oparg) {
@@ -2156,13 +2156,13 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
- #line 3497 "Python/bytecodes.c"
+ #line 3528 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
#line 2162 "Python/executor_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
- #line 3499 "Python/bytecodes.c"
+ #line 3530 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
#line 2168 "Python/executor_cases.c.h"
STACK_SHRINK(((oparg == 3) ? 1 : 0));
@@ -2174,7 +2174,7 @@
case CONVERT_VALUE: {
PyObject *value = stack_pointer[-1];
PyObject *result;
- #line 3503 "Python/bytecodes.c"
+ #line 3534 "Python/bytecodes.c"
convertion_func_ptr conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
conv_fn = CONVERSION_FUNCTIONS[oparg];
@@ -2189,7 +2189,7 @@
case FORMAT_SIMPLE: {
PyObject *value = stack_pointer[-1];
PyObject *res;
- #line 3512 "Python/bytecodes.c"
+ #line 3543 "Python/bytecodes.c"
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value)) {
@@ -2209,7 +2209,7 @@
PyObject *fmt_spec = stack_pointer[-1];
PyObject *value = stack_pointer[-2];
PyObject *res;
- #line 3525 "Python/bytecodes.c"
+ #line 3556 "Python/bytecodes.c"
res = PyObject_Format(value, fmt_spec);
Py_DECREF(value);
Py_DECREF(fmt_spec);
@@ -2223,7 +2223,7 @@
case COPY: {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
- #line 3532 "Python/bytecodes.c"
+ #line 3563 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
#line 2230 "Python/executor_cases.c.h"
@@ -2266,7 +2266,7 @@
case SWAP: {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
- #line 3557 "Python/bytecodes.c"
+ #line 3588 "Python/bytecodes.c"
assert(oparg >= 2);
#line 2272 "Python/executor_cases.c.h"
stack_pointer[-1] = bottom;
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index eb8b50e..11823cf 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2563,7 +2563,7 @@
PyObject *owner = stack_pointer[-1];
PyObject *res2 = NULL;
PyObject *res;
- #line 1815 "Python/bytecodes.c"
+ #line 1817 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -2599,7 +2599,7 @@
*/
#line 2601 "Python/generated_cases.c.h"
Py_DECREF(owner);
- #line 1849 "Python/bytecodes.c"
+ #line 1851 "Python/bytecodes.c"
if (meth == NULL) goto pop_1_error;
res2 = NULL;
res = meth;
@@ -2610,7 +2610,7 @@
res = PyObject_GetAttr(owner, name);
#line 2612 "Python/generated_cases.c.h"
Py_DECREF(owner);
- #line 1858 "Python/bytecodes.c"
+ #line 1860 "Python/bytecodes.c"
if (res == NULL) goto pop_1_error;
}
#line 2617 "Python/generated_cases.c.h"
@@ -2627,7 +2627,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 1867 "Python/bytecodes.c"
+ #line 1869 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR);
@@ -2655,7 +2655,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 1883 "Python/bytecodes.c"
+ #line 1885 "Python/bytecodes.c"
DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR);
PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict;
assert(dict != NULL);
@@ -2683,7 +2683,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 1899 "Python/bytecodes.c"
+ #line 1901 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR);
@@ -2725,7 +2725,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 1929 "Python/bytecodes.c"
+ #line 1931 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR);
@@ -2750,7 +2750,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 1942 "Python/bytecodes.c"
+ #line 1944 "Python/bytecodes.c"
DEOPT_IF(!PyType_Check(cls), LOAD_ATTR);
DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version,
@@ -2776,7 +2776,7 @@
uint32_t type_version = read_u32(&next_instr[1].cache);
uint32_t func_version = read_u32(&next_instr[3].cache);
PyObject *fget = read_obj(&next_instr[5].cache);
- #line 1957 "Python/bytecodes.c"
+ #line 1959 "Python/bytecodes.c"
DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR);
PyTypeObject *cls = Py_TYPE(owner);
@@ -2808,7 +2808,7 @@
uint32_t type_version = read_u32(&next_instr[1].cache);
uint32_t func_version = read_u32(&next_instr[3].cache);
PyObject *getattribute = read_obj(&next_instr[5].cache);
- #line 1983 "Python/bytecodes.c"
+ #line 1985 "Python/bytecodes.c"
DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR);
PyTypeObject *cls = Py_TYPE(owner);
DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR);
@@ -2842,7 +2842,7 @@
PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 2011 "Python/bytecodes.c"
+ #line 2013 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
@@ -2871,7 +2871,7 @@
PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t hint = read_u16(&next_instr[3].cache);
- #line 2031 "Python/bytecodes.c"
+ #line 2033 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
@@ -2921,7 +2921,7 @@
PyObject *value = stack_pointer[-2];
uint32_t type_version = read_u32(&next_instr[1].cache);
uint16_t index = read_u16(&next_instr[3].cache);
- #line 2072 "Python/bytecodes.c"
+ #line 2074 "Python/bytecodes.c"
PyTypeObject *tp = Py_TYPE(owner);
assert(type_version != 0);
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
@@ -2943,7 +2943,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2091 "Python/bytecodes.c"
+ #line 2093 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -2959,7 +2959,7 @@
#line 2960 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 2104 "Python/bytecodes.c"
+ #line 2106 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
if (oparg & 16) {
int res_bool = PyObject_IsTrue(res);
@@ -2978,7 +2978,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2114 "Python/bytecodes.c"
+ #line 2116 "Python/bytecodes.c"
DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP);
STAT_INC(COMPARE_OP, hit);
@@ -3001,7 +3001,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2129 "Python/bytecodes.c"
+ #line 2131 "Python/bytecodes.c"
DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP);
DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP);
@@ -3028,7 +3028,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 2148 "Python/bytecodes.c"
+ #line 2150 "Python/bytecodes.c"
DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP);
DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP);
STAT_INC(COMPARE_OP, hit);
@@ -3052,12 +3052,12 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2163 "Python/bytecodes.c"
+ #line 2165 "Python/bytecodes.c"
int res = Py_Is(left, right) ^ oparg;
#line 3058 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 2165 "Python/bytecodes.c"
+ #line 2167 "Python/bytecodes.c"
b = res ? Py_True : Py_False;
#line 3063 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -3069,12 +3069,12 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2169 "Python/bytecodes.c"
+ #line 2171 "Python/bytecodes.c"
int res = PySequence_Contains(right, left);
#line 3075 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 2171 "Python/bytecodes.c"
+ #line 2173 "Python/bytecodes.c"
if (res < 0) goto pop_2_error;
b = (res ^ oparg) ? Py_True : Py_False;
#line 3081 "Python/generated_cases.c.h"
@@ -3088,12 +3088,12 @@
PyObject *exc_value = stack_pointer[-2];
PyObject *rest;
PyObject *match;
- #line 2176 "Python/bytecodes.c"
+ #line 2178 "Python/bytecodes.c"
if (check_except_star_type_valid(tstate, match_type) < 0) {
#line 3094 "Python/generated_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 2178 "Python/bytecodes.c"
+ #line 2180 "Python/bytecodes.c"
if (true) goto pop_2_error;
}
@@ -3104,7 +3104,7 @@
#line 3105 "Python/generated_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 2186 "Python/bytecodes.c"
+ #line 2188 "Python/bytecodes.c"
if (res < 0) goto pop_2_error;
assert((match == NULL) == (rest == NULL));
@@ -3123,19 +3123,19 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 2197 "Python/bytecodes.c"
+ #line 2199 "Python/bytecodes.c"
assert(PyExceptionInstance_Check(left));
if (check_except_type_valid(tstate, right) < 0) {
#line 3130 "Python/generated_cases.c.h"
Py_DECREF(right);
- #line 2200 "Python/bytecodes.c"
+ #line 2202 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
int res = PyErr_GivenExceptionMatches(left, right);
#line 3137 "Python/generated_cases.c.h"
Py_DECREF(right);
- #line 2205 "Python/bytecodes.c"
+ #line 2207 "Python/bytecodes.c"
b = res ? Py_True : Py_False;
#line 3141 "Python/generated_cases.c.h"
stack_pointer[-1] = b;
@@ -3146,13 +3146,13 @@
PyObject *fromlist = stack_pointer[-1];
PyObject *level = stack_pointer[-2];
PyObject *res;
- #line 2209 "Python/bytecodes.c"
+ #line 2211 "Python/bytecodes.c"
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
res = import_name(tstate, frame, name, fromlist, level);
#line 3153 "Python/generated_cases.c.h"
Py_DECREF(level);
Py_DECREF(fromlist);
- #line 2212 "Python/bytecodes.c"
+ #line 2214 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
#line 3158 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -3163,7 +3163,7 @@
TARGET(IMPORT_FROM) {
PyObject *from = stack_pointer[-1];
PyObject *res;
- #line 2216 "Python/bytecodes.c"
+ #line 2218 "Python/bytecodes.c"
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
res = import_from(tstate, from, name);
if (res == NULL) goto error;
@@ -3174,14 +3174,14 @@
}
TARGET(JUMP_FORWARD) {
- #line 2222 "Python/bytecodes.c"
+ #line 2224 "Python/bytecodes.c"
JUMPBY(oparg);
#line 3180 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(JUMP_BACKWARD) {
- #line 2226 "Python/bytecodes.c"
+ #line 2228 "Python/bytecodes.c"
CHECK_EVAL_BREAKER();
_Py_CODEUNIT *here = next_instr - 1;
assert(oparg <= INSTR_OFFSET());
@@ -3205,7 +3205,7 @@
}
TARGET(ENTER_EXECUTOR) {
- #line 2257 "Python/bytecodes.c"
+ #line 2259 "Python/bytecodes.c"
CHECK_EVAL_BREAKER();
PyCodeObject *code = _PyFrame_GetCode(frame);
@@ -3225,7 +3225,7 @@
TARGET(POP_JUMP_IF_FALSE) {
PyObject *cond = stack_pointer[-1];
- #line 2274 "Python/bytecodes.c"
+ #line 2276 "Python/bytecodes.c"
assert(PyBool_Check(cond));
JUMPBY(oparg * Py_IsFalse(cond));
#line 3232 "Python/generated_cases.c.h"
@@ -3235,7 +3235,7 @@
TARGET(POP_JUMP_IF_TRUE) {
PyObject *cond = stack_pointer[-1];
- #line 2279 "Python/bytecodes.c"
+ #line 2281 "Python/bytecodes.c"
assert(PyBool_Check(cond));
JUMPBY(oparg * Py_IsTrue(cond));
#line 3242 "Python/generated_cases.c.h"
@@ -3245,11 +3245,11 @@
TARGET(POP_JUMP_IF_NOT_NONE) {
PyObject *value = stack_pointer[-1];
- #line 2284 "Python/bytecodes.c"
+ #line 2286 "Python/bytecodes.c"
if (!Py_IsNone(value)) {
#line 3251 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2286 "Python/bytecodes.c"
+ #line 2288 "Python/bytecodes.c"
JUMPBY(oparg);
}
#line 3256 "Python/generated_cases.c.h"
@@ -3259,14 +3259,14 @@
TARGET(POP_JUMP_IF_NONE) {
PyObject *value = stack_pointer[-1];
- #line 2291 "Python/bytecodes.c"
+ #line 2293 "Python/bytecodes.c"
if (Py_IsNone(value)) {
JUMPBY(oparg);
}
else {
#line 3268 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2296 "Python/bytecodes.c"
+ #line 2298 "Python/bytecodes.c"
}
#line 3272 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -3274,7 +3274,7 @@
}
TARGET(JUMP_BACKWARD_NO_INTERRUPT) {
- #line 2300 "Python/bytecodes.c"
+ #line 2302 "Python/bytecodes.c"
/* This bytecode is used in the `yield from` or `await` loop.
* If there is an interrupt, we want it handled in the innermost
* generator or coroutine, so we deliberately do not check it here.
@@ -3288,7 +3288,7 @@
TARGET(GET_LEN) {
PyObject *obj = stack_pointer[-1];
PyObject *len_o;
- #line 2309 "Python/bytecodes.c"
+ #line 2311 "Python/bytecodes.c"
// PUSH(len(TOS))
Py_ssize_t len_i = PyObject_Length(obj);
if (len_i < 0) goto error;
@@ -3305,7 +3305,7 @@
PyObject *type = stack_pointer[-2];
PyObject *subject = stack_pointer[-3];
PyObject *attrs;
- #line 2317 "Python/bytecodes.c"
+ #line 2319 "Python/bytecodes.c"
// Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or
// None on failure.
assert(PyTuple_CheckExact(names));
@@ -3314,7 +3314,7 @@
Py_DECREF(subject);
Py_DECREF(type);
Py_DECREF(names);
- #line 2322 "Python/bytecodes.c"
+ #line 2324 "Python/bytecodes.c"
if (attrs) {
assert(PyTuple_CheckExact(attrs)); // Success!
}
@@ -3331,7 +3331,7 @@
TARGET(MATCH_MAPPING) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2332 "Python/bytecodes.c"
+ #line 2334 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING;
res = match ? Py_True : Py_False;
#line 3338 "Python/generated_cases.c.h"
@@ -3343,7 +3343,7 @@
TARGET(MATCH_SEQUENCE) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2337 "Python/bytecodes.c"
+ #line 2339 "Python/bytecodes.c"
int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE;
res = match ? Py_True : Py_False;
#line 3350 "Python/generated_cases.c.h"
@@ -3356,7 +3356,7 @@
PyObject *keys = stack_pointer[-1];
PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
- #line 2342 "Python/bytecodes.c"
+ #line 2344 "Python/bytecodes.c"
// On successful match, PUSH(values). Otherwise, PUSH(None).
values_or_none = match_keys(tstate, subject, keys);
if (values_or_none == NULL) goto error;
@@ -3369,12 +3369,12 @@
TARGET(GET_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2348 "Python/bytecodes.c"
+ #line 2350 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
#line 3376 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2351 "Python/bytecodes.c"
+ #line 2353 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
#line 3380 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
@@ -3384,7 +3384,7 @@
TARGET(GET_YIELD_FROM_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2355 "Python/bytecodes.c"
+ #line 2357 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
/* `iterable` is a coroutine */
@@ -3409,7 +3409,7 @@
}
#line 3411 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2378 "Python/bytecodes.c"
+ #line 2380 "Python/bytecodes.c"
}
#line 3415 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
@@ -3421,7 +3421,7 @@
static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size");
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2396 "Python/bytecodes.c"
+ #line 2398 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyForIterCache *cache = (_PyForIterCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -3461,7 +3461,7 @@
}
TARGET(INSTRUMENTED_FOR_ITER) {
- #line 2430 "Python/bytecodes.c"
+ #line 2432 "Python/bytecodes.c"
_Py_CODEUNIT *here = next_instr-1;
_Py_CODEUNIT *target;
PyObject *iter = TOP();
@@ -3494,7 +3494,7 @@
TARGET(FOR_ITER_LIST) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2458 "Python/bytecodes.c"
+ #line 2460 "Python/bytecodes.c"
DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER);
_PyListIterObject *it = (_PyListIterObject *)iter;
STAT_INC(FOR_ITER, hit);
@@ -3525,7 +3525,7 @@
TARGET(FOR_ITER_TUPLE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2481 "Python/bytecodes.c"
+ #line 2483 "Python/bytecodes.c"
_PyTupleIterObject *it = (_PyTupleIterObject *)iter;
DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER);
STAT_INC(FOR_ITER, hit);
@@ -3556,7 +3556,7 @@
TARGET(FOR_ITER_RANGE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2504 "Python/bytecodes.c"
+ #line 2506 "Python/bytecodes.c"
_PyRangeIterObject *r = (_PyRangeIterObject *)iter;
DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER);
STAT_INC(FOR_ITER, hit);
@@ -3584,7 +3584,7 @@
TARGET(FOR_ITER_GEN) {
PyObject *iter = stack_pointer[-1];
- #line 2525 "Python/bytecodes.c"
+ #line 2527 "Python/bytecodes.c"
DEOPT_IF(tstate->interp->eval_frame, FOR_ITER);
PyGenObject *gen = (PyGenObject *)iter;
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER);
@@ -3607,7 +3607,7 @@
PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
- #line 2543 "Python/bytecodes.c"
+ #line 2545 "Python/bytecodes.c"
PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__));
if (enter == NULL) {
if (!_PyErr_Occurred(tstate)) {
@@ -3632,7 +3632,7 @@
}
#line 3634 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2566 "Python/bytecodes.c"
+ #line 2568 "Python/bytecodes.c"
res = _PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
@@ -3650,7 +3650,7 @@
PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
- #line 2575 "Python/bytecodes.c"
+ #line 2577 "Python/bytecodes.c"
/* pop the context manager, push its __exit__ and the
* value returned from calling its __enter__
*/
@@ -3678,7 +3678,7 @@
}
#line 3680 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2601 "Python/bytecodes.c"
+ #line 2603 "Python/bytecodes.c"
res = _PyObject_CallNoArgs(enter);
Py_DECREF(enter);
if (res == NULL) {
@@ -3697,7 +3697,7 @@
PyObject *lasti = stack_pointer[-3];
PyObject *exit_func = stack_pointer[-4];
PyObject *res;
- #line 2610 "Python/bytecodes.c"
+ #line 2612 "Python/bytecodes.c"
/* At the top of the stack are 4 values:
- val: TOP = exc_info()
- unused: SECOND = previous exception
@@ -3727,7 +3727,7 @@
TARGET(PUSH_EXC_INFO) {
PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
- #line 2649 "Python/bytecodes.c"
+ #line 2651 "Python/bytecodes.c"
_PyErr_StackItem *exc_info = tstate->exc_info;
if (exc_info->exc_value != NULL) {
prev_exc = exc_info->exc_value;
@@ -3751,7 +3751,8 @@
uint32_t type_version = read_u32(&next_instr[1].cache);
uint32_t keys_version = read_u32(&next_instr[3].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2661 "Python/bytecodes.c"
+ #line 2663 "Python/bytecodes.c"
+ assert(oparg & 1);
/* Cached method object */
PyTypeObject *self_cls = Py_TYPE(self);
assert(type_version != 0);
@@ -3767,11 +3768,10 @@
res2 = Py_NewRef(descr);
assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR));
res = self;
- assert(oparg & 1);
#line 3772 "Python/generated_cases.c.h"
- STACK_GROW(((oparg & 1) ? 1 : 0));
+ STACK_GROW((1 ? 1 : 0));
stack_pointer[-1] = res;
- if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ if (1) { stack_pointer[-(1 + (1 ? 1 : 0))] = res2; }
next_instr += 9;
DISPATCH();
}
@@ -3782,7 +3782,8 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2680 "Python/bytecodes.c"
+ #line 2682 "Python/bytecodes.c"
+ assert(oparg & 1);
PyTypeObject *self_cls = Py_TYPE(self);
DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
assert(self_cls->tp_dictoffset == 0);
@@ -3791,11 +3792,68 @@
assert(_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR));
res2 = Py_NewRef(descr);
res = self;
- assert(oparg & 1);
#line 3796 "Python/generated_cases.c.h"
- STACK_GROW(((oparg & 1) ? 1 : 0));
+ STACK_GROW((1 ? 1 : 0));
stack_pointer[-1] = res;
- if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ if (1) { stack_pointer[-(1 + (1 ? 1 : 0))] = res2; }
+ next_instr += 9;
+ DISPATCH();
+ }
+
+ TARGET(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES) {
+ PyObject *self = stack_pointer[-1];
+ PyObject *res2 = NULL;
+ PyObject *res;
+ uint32_t type_version = read_u32(&next_instr[1].cache);
+ uint32_t keys_version = read_u32(&next_instr[3].cache);
+ PyObject *descr = read_obj(&next_instr[5].cache);
+ #line 2694 "Python/bytecodes.c"
+ assert((oparg & 1) == 0);
+ PyTypeObject *self_cls = Py_TYPE(self);
+ assert(type_version != 0);
+ DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
+ assert(self_cls->tp_flags & Py_TPFLAGS_MANAGED_DICT);
+ PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(self);
+ DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
+ PyHeapTypeObject *self_heap_type = (PyHeapTypeObject *)self_cls;
+ DEOPT_IF(self_heap_type->ht_cached_keys->dk_version !=
+ keys_version, LOAD_ATTR);
+ STAT_INC(LOAD_ATTR, hit);
+ assert(descr != NULL);
+ #line 3824 "Python/generated_cases.c.h"
+ Py_DECREF(self);
+ #line 2707 "Python/bytecodes.c"
+ res = Py_NewRef(descr);
+ #line 3828 "Python/generated_cases.c.h"
+ STACK_GROW((0 ? 1 : 0));
+ stack_pointer[-1] = res;
+ if (0) { stack_pointer[-(1 + (0 ? 1 : 0))] = res2; }
+ next_instr += 9;
+ DISPATCH();
+ }
+
+ TARGET(LOAD_ATTR_NONDESCRIPTOR_NO_DICT) {
+ PyObject *self = stack_pointer[-1];
+ PyObject *res2 = NULL;
+ PyObject *res;
+ uint32_t type_version = read_u32(&next_instr[1].cache);
+ PyObject *descr = read_obj(&next_instr[5].cache);
+ #line 2711 "Python/bytecodes.c"
+ assert((oparg & 1) == 0);
+ PyTypeObject *self_cls = Py_TYPE(self);
+ assert(type_version != 0);
+ DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
+ assert(self_cls->tp_dictoffset == 0);
+ STAT_INC(LOAD_ATTR, hit);
+ assert(descr != NULL);
+ #line 3850 "Python/generated_cases.c.h"
+ Py_DECREF(self);
+ #line 2719 "Python/bytecodes.c"
+ res = Py_NewRef(descr);
+ #line 3854 "Python/generated_cases.c.h"
+ STACK_GROW((0 ? 1 : 0));
+ stack_pointer[-1] = res;
+ if (0) { stack_pointer[-(1 + (0 ? 1 : 0))] = res2; }
next_instr += 9;
DISPATCH();
}
@@ -3806,7 +3864,8 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2692 "Python/bytecodes.c"
+ #line 2723 "Python/bytecodes.c"
+ assert(oparg & 1);
PyTypeObject *self_cls = Py_TYPE(self);
DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR);
Py_ssize_t dictoffset = self_cls->tp_dictoffset;
@@ -3819,26 +3878,25 @@
assert(_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR));
res2 = Py_NewRef(descr);
res = self;
- assert(oparg & 1);
- #line 3824 "Python/generated_cases.c.h"
- STACK_GROW(((oparg & 1) ? 1 : 0));
+ #line 3882 "Python/generated_cases.c.h"
+ STACK_GROW((1 ? 1 : 0));
stack_pointer[-1] = res;
- if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
+ if (1) { stack_pointer[-(1 + (1 ? 1 : 0))] = res2; }
next_instr += 9;
DISPATCH();
}
TARGET(KW_NAMES) {
- #line 2708 "Python/bytecodes.c"
+ #line 2739 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg < PyTuple_GET_SIZE(FRAME_CO_CONSTS));
kwnames = GETITEM(FRAME_CO_CONSTS, oparg);
- #line 3837 "Python/generated_cases.c.h"
+ #line 3895 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_CALL) {
- #line 2714 "Python/bytecodes.c"
+ #line 2745 "Python/bytecodes.c"
int is_meth = PEEK(oparg+2) != NULL;
int total_args = oparg + is_meth;
PyObject *function = PEEK(total_args + 1);
@@ -3851,7 +3909,7 @@
_PyCallCache *cache = (_PyCallCache *)next_instr;
INCREMENT_ADAPTIVE_COUNTER(cache->counter);
GO_TO_INSTRUCTION(CALL);
- #line 3855 "Python/generated_cases.c.h"
+ #line 3913 "Python/generated_cases.c.h"
}
TARGET(CALL) {
@@ -3861,7 +3919,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2760 "Python/bytecodes.c"
+ #line 2791 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -3943,7 +4001,7 @@
Py_DECREF(args[i]);
}
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3947 "Python/generated_cases.c.h"
+ #line 4005 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3955,7 +4013,7 @@
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 2848 "Python/bytecodes.c"
+ #line 2879 "Python/bytecodes.c"
DEOPT_IF(method != NULL, CALL);
DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL);
STAT_INC(CALL, hit);
@@ -3965,7 +4023,7 @@
PEEK(oparg + 2) = Py_NewRef(meth); // method
Py_DECREF(callable);
GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS);
- #line 3969 "Python/generated_cases.c.h"
+ #line 4027 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_EXACT_ARGS) {
@@ -3974,7 +4032,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
- #line 2860 "Python/bytecodes.c"
+ #line 2891 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -4000,7 +4058,7 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 4004 "Python/generated_cases.c.h"
+ #line 4062 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_WITH_DEFAULTS) {
@@ -4008,7 +4066,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
uint32_t func_version = read_u32(&next_instr[1].cache);
- #line 2888 "Python/bytecodes.c"
+ #line 2919 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -4044,7 +4102,7 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 4048 "Python/generated_cases.c.h"
+ #line 4106 "Python/generated_cases.c.h"
}
TARGET(CALL_NO_KW_TYPE_1) {
@@ -4052,7 +4110,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2926 "Python/bytecodes.c"
+ #line 2957 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4062,7 +4120,7 @@
res = Py_NewRef(Py_TYPE(obj));
Py_DECREF(obj);
Py_DECREF(&PyType_Type); // I.e., callable
- #line 4066 "Python/generated_cases.c.h"
+ #line 4124 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4075,7 +4133,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2938 "Python/bytecodes.c"
+ #line 2969 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4086,7 +4144,7 @@
Py_DECREF(arg);
Py_DECREF(&PyUnicode_Type); // I.e., callable
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4090 "Python/generated_cases.c.h"
+ #line 4148 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4100,7 +4158,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2952 "Python/bytecodes.c"
+ #line 2983 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -4111,7 +4169,7 @@
Py_DECREF(arg);
Py_DECREF(&PyTuple_Type); // I.e., tuple
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4115 "Python/generated_cases.c.h"
+ #line 4173 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4124,7 +4182,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
- #line 2966 "Python/bytecodes.c"
+ #line 2997 "Python/bytecodes.c"
/* This instruction does the following:
* 1. Creates the object (by calling ``object.__new__``)
* 2. Pushes a shim frame to the frame stack (to cleanup after ``__init__``)
@@ -4175,12 +4233,12 @@
* as it will be checked after start_frame */
tstate->py_recursion_remaining--;
goto start_frame;
- #line 4179 "Python/generated_cases.c.h"
+ #line 4237 "Python/generated_cases.c.h"
}
TARGET(EXIT_INIT_CHECK) {
PyObject *should_be_none = stack_pointer[-1];
- #line 3019 "Python/bytecodes.c"
+ #line 3050 "Python/bytecodes.c"
assert(STACK_LEVEL() == 2);
if (should_be_none != Py_None) {
PyErr_Format(PyExc_TypeError,
@@ -4188,7 +4246,7 @@
Py_TYPE(should_be_none)->tp_name);
goto error;
}
- #line 4192 "Python/generated_cases.c.h"
+ #line 4250 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
@@ -4198,7 +4256,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3029 "Python/bytecodes.c"
+ #line 3060 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -4220,7 +4278,7 @@
}
Py_DECREF(tp);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4224 "Python/generated_cases.c.h"
+ #line 4282 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4234,7 +4292,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3054 "Python/bytecodes.c"
+ #line 3085 "Python/bytecodes.c"
/* Builtin METH_O functions */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -4262,7 +4320,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4266 "Python/generated_cases.c.h"
+ #line 4324 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4276,7 +4334,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3085 "Python/bytecodes.c"
+ #line 3116 "Python/bytecodes.c"
/* Builtin METH_FASTCALL functions, without keywords */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -4308,7 +4366,7 @@
'invalid'). In those cases an exception is set, so we must
handle it.
*/
- #line 4312 "Python/generated_cases.c.h"
+ #line 4370 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4322,7 +4380,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3120 "Python/bytecodes.c"
+ #line 3151 "Python/bytecodes.c"
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
int is_meth = method != NULL;
int total_args = oparg;
@@ -4354,7 +4412,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4358 "Python/generated_cases.c.h"
+ #line 4416 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4368,7 +4426,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3155 "Python/bytecodes.c"
+ #line 3186 "Python/bytecodes.c"
assert(kwnames == NULL);
/* len(o) */
int is_meth = method != NULL;
@@ -4393,7 +4451,7 @@
Py_DECREF(callable);
Py_DECREF(arg);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4397 "Python/generated_cases.c.h"
+ #line 4455 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4406,7 +4464,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3182 "Python/bytecodes.c"
+ #line 3213 "Python/bytecodes.c"
assert(kwnames == NULL);
/* isinstance(o, o2) */
int is_meth = method != NULL;
@@ -4433,7 +4491,7 @@
Py_DECREF(cls);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4437 "Python/generated_cases.c.h"
+ #line 4495 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4445,7 +4503,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *self = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 3212 "Python/bytecodes.c"
+ #line 3243 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
assert(method != NULL);
@@ -4463,14 +4521,14 @@
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
assert(next_instr[-1].op.code == POP_TOP);
DISPATCH();
- #line 4467 "Python/generated_cases.c.h"
+ #line 4525 "Python/generated_cases.c.h"
}
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3232 "Python/bytecodes.c"
+ #line 3263 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4501,7 +4559,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4505 "Python/generated_cases.c.h"
+ #line 4563 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4514,7 +4572,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3266 "Python/bytecodes.c"
+ #line 3297 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -4543,7 +4601,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4547 "Python/generated_cases.c.h"
+ #line 4605 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4556,7 +4614,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3298 "Python/bytecodes.c"
+ #line 3329 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 0 || oparg == 1);
int is_meth = method != NULL;
@@ -4585,7 +4643,7 @@
Py_DECREF(self);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4589 "Python/generated_cases.c.h"
+ #line 4647 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4598,7 +4656,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 3330 "Python/bytecodes.c"
+ #line 3361 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4626,7 +4684,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4630 "Python/generated_cases.c.h"
+ #line 4688 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4636,9 +4694,9 @@
}
TARGET(INSTRUMENTED_CALL_FUNCTION_EX) {
- #line 3361 "Python/bytecodes.c"
+ #line 3392 "Python/bytecodes.c"
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
- #line 4642 "Python/generated_cases.c.h"
+ #line 4700 "Python/generated_cases.c.h"
}
TARGET(CALL_FUNCTION_EX) {
@@ -4647,7 +4705,7 @@
PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))];
PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))];
PyObject *result;
- #line 3365 "Python/bytecodes.c"
+ #line 3396 "Python/bytecodes.c"
// DICT_MERGE is called before this opcode if there are kwargs.
// It converts all dict subtypes in kwargs into regular dicts.
assert(kwargs == NULL || PyDict_CheckExact(kwargs));
@@ -4709,14 +4767,14 @@
}
result = PyObject_Call(func, callargs, kwargs);
}
- #line 4713 "Python/generated_cases.c.h"
+ #line 4771 "Python/generated_cases.c.h"
Py_DECREF(func);
Py_DECREF(callargs);
Py_XDECREF(kwargs);
- #line 3427 "Python/bytecodes.c"
+ #line 3458 "Python/bytecodes.c"
assert(PEEK(3 + (oparg & 1)) == NULL);
if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; }
- #line 4720 "Python/generated_cases.c.h"
+ #line 4778 "Python/generated_cases.c.h"
STACK_SHRINK(((oparg & 1) ? 1 : 0));
STACK_SHRINK(2);
stack_pointer[-1] = result;
@@ -4727,7 +4785,7 @@
TARGET(MAKE_FUNCTION) {
PyObject *codeobj = stack_pointer[-1];
PyObject *func;
- #line 3433 "Python/bytecodes.c"
+ #line 3464 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@@ -4739,7 +4797,7 @@
func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
func = (PyObject *)func_obj;
- #line 4743 "Python/generated_cases.c.h"
+ #line 4801 "Python/generated_cases.c.h"
stack_pointer[-1] = func;
DISPATCH();
}
@@ -4747,7 +4805,7 @@
TARGET(SET_FUNCTION_ATTRIBUTE) {
PyObject *func = stack_pointer[-1];
PyObject *attr = stack_pointer[-2];
- #line 3447 "Python/bytecodes.c"
+ #line 3478 "Python/bytecodes.c"
assert(PyFunction_Check(func));
PyFunctionObject *func_obj = (PyFunctionObject *)func;
switch(oparg) {
@@ -4772,14 +4830,14 @@
default:
Py_UNREACHABLE();
}
- #line 4776 "Python/generated_cases.c.h"
+ #line 4834 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = func;
DISPATCH();
}
TARGET(RETURN_GENERATOR) {
- #line 3474 "Python/bytecodes.c"
+ #line 3505 "Python/bytecodes.c"
assert(PyFunction_Check(frame->f_funcobj));
PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
@@ -4800,7 +4858,7 @@
frame = cframe.current_frame = prev;
_PyFrame_StackPush(frame, (PyObject *)gen);
goto resume_frame;
- #line 4804 "Python/generated_cases.c.h"
+ #line 4862 "Python/generated_cases.c.h"
}
TARGET(BUILD_SLICE) {
@@ -4808,15 +4866,15 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
- #line 3497 "Python/bytecodes.c"
+ #line 3528 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
- #line 4814 "Python/generated_cases.c.h"
+ #line 4872 "Python/generated_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
- #line 3499 "Python/bytecodes.c"
+ #line 3530 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
- #line 4820 "Python/generated_cases.c.h"
+ #line 4878 "Python/generated_cases.c.h"
STACK_SHRINK(((oparg == 3) ? 1 : 0));
STACK_SHRINK(1);
stack_pointer[-1] = slice;
@@ -4826,14 +4884,14 @@
TARGET(CONVERT_VALUE) {
PyObject *value = stack_pointer[-1];
PyObject *result;
- #line 3503 "Python/bytecodes.c"
+ #line 3534 "Python/bytecodes.c"
convertion_func_ptr conv_fn;
assert(oparg >= FVC_STR && oparg <= FVC_ASCII);
conv_fn = CONVERSION_FUNCTIONS[oparg];
result = conv_fn(value);
Py_DECREF(value);
if (result == NULL) goto pop_1_error;
- #line 4837 "Python/generated_cases.c.h"
+ #line 4895 "Python/generated_cases.c.h"
stack_pointer[-1] = result;
DISPATCH();
}
@@ -4841,7 +4899,7 @@
TARGET(FORMAT_SIMPLE) {
PyObject *value = stack_pointer[-1];
PyObject *res;
- #line 3512 "Python/bytecodes.c"
+ #line 3543 "Python/bytecodes.c"
/* If value is a unicode object, then we know the result
* of format(value) is value itself. */
if (!PyUnicode_CheckExact(value)) {
@@ -4852,7 +4910,7 @@
else {
res = value;
}
- #line 4856 "Python/generated_cases.c.h"
+ #line 4914 "Python/generated_cases.c.h"
stack_pointer[-1] = res;
DISPATCH();
}
@@ -4861,12 +4919,12 @@
PyObject *fmt_spec = stack_pointer[-1];
PyObject *value = stack_pointer[-2];
PyObject *res;
- #line 3525 "Python/bytecodes.c"
+ #line 3556 "Python/bytecodes.c"
res = PyObject_Format(value, fmt_spec);
Py_DECREF(value);
Py_DECREF(fmt_spec);
if (res == NULL) goto pop_2_error;
- #line 4870 "Python/generated_cases.c.h"
+ #line 4928 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -4875,10 +4933,10 @@
TARGET(COPY) {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
- #line 3532 "Python/bytecodes.c"
+ #line 3563 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
- #line 4882 "Python/generated_cases.c.h"
+ #line 4940 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = top;
DISPATCH();
@@ -4890,7 +4948,7 @@
PyObject *rhs = stack_pointer[-1];
PyObject *lhs = stack_pointer[-2];
PyObject *res;
- #line 3537 "Python/bytecodes.c"
+ #line 3568 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -4905,12 +4963,12 @@
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
assert(binary_ops[oparg]);
res = binary_ops[oparg](lhs, rhs);
- #line 4909 "Python/generated_cases.c.h"
+ #line 4967 "Python/generated_cases.c.h"
Py_DECREF(lhs);
Py_DECREF(rhs);
- #line 3552 "Python/bytecodes.c"
+ #line 3583 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
- #line 4914 "Python/generated_cases.c.h"
+ #line 4972 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -4920,16 +4978,16 @@
TARGET(SWAP) {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
- #line 3557 "Python/bytecodes.c"
+ #line 3588 "Python/bytecodes.c"
assert(oparg >= 2);
- #line 4926 "Python/generated_cases.c.h"
+ #line 4984 "Python/generated_cases.c.h"
stack_pointer[-1] = bottom;
stack_pointer[-(2 + (oparg-2))] = top;
DISPATCH();
}
TARGET(INSTRUMENTED_INSTRUCTION) {
- #line 3561 "Python/bytecodes.c"
+ #line 3592 "Python/bytecodes.c"
int next_opcode = _Py_call_instrumentation_instruction(
tstate, frame, next_instr-1);
if (next_opcode < 0) goto error;
@@ -4941,48 +4999,48 @@
assert(next_opcode > 0 && next_opcode < 256);
opcode = next_opcode;
DISPATCH_GOTO();
- #line 4945 "Python/generated_cases.c.h"
+ #line 5003 "Python/generated_cases.c.h"
}
TARGET(INSTRUMENTED_JUMP_FORWARD) {
- #line 3575 "Python/bytecodes.c"
+ #line 3606 "Python/bytecodes.c"
INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP);
- #line 4951 "Python/generated_cases.c.h"
+ #line 5009 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
- #line 3579 "Python/bytecodes.c"
+ #line 3610 "Python/bytecodes.c"
CHECK_EVAL_BREAKER();
INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP);
- #line 4959 "Python/generated_cases.c.h"
+ #line 5017 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
- #line 3584 "Python/bytecodes.c"
+ #line 3615 "Python/bytecodes.c"
PyObject *cond = POP();
assert(PyBool_Check(cond));
_Py_CODEUNIT *here = next_instr - 1;
int offset = Py_IsTrue(cond) * oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4970 "Python/generated_cases.c.h"
+ #line 5028 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
- #line 3592 "Python/bytecodes.c"
+ #line 3623 "Python/bytecodes.c"
PyObject *cond = POP();
assert(PyBool_Check(cond));
_Py_CODEUNIT *here = next_instr - 1;
int offset = Py_IsFalse(cond) * oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4981 "Python/generated_cases.c.h"
+ #line 5039 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
- #line 3600 "Python/bytecodes.c"
+ #line 3631 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -4994,12 +5052,12 @@
offset = 0;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4998 "Python/generated_cases.c.h"
+ #line 5056 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
- #line 3614 "Python/bytecodes.c"
+ #line 3645 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -5011,30 +5069,30 @@
offset = oparg;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 5015 "Python/generated_cases.c.h"
+ #line 5073 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(EXTENDED_ARG) {
- #line 3628 "Python/bytecodes.c"
+ #line 3659 "Python/bytecodes.c"
assert(oparg);
opcode = next_instr->op.code;
oparg = oparg << 8 | next_instr->op.arg;
PRE_DISPATCH_GOTO();
DISPATCH_GOTO();
- #line 5026 "Python/generated_cases.c.h"
+ #line 5084 "Python/generated_cases.c.h"
}
TARGET(CACHE) {
- #line 3636 "Python/bytecodes.c"
+ #line 3667 "Python/bytecodes.c"
assert(0 && "Executing a cache.");
Py_UNREACHABLE();
- #line 5033 "Python/generated_cases.c.h"
+ #line 5091 "Python/generated_cases.c.h"
}
TARGET(RESERVED) {
- #line 3641 "Python/bytecodes.c"
+ #line 3672 "Python/bytecodes.c"
assert(0 && "Executing RESERVED instruction.");
Py_UNREACHABLE();
- #line 5040 "Python/generated_cases.c.h"
+ #line 5098 "Python/generated_cases.c.h"
}
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index 70e1ca4..92768e6 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -378,6 +378,10 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
return 1;
case LOAD_ATTR_METHOD_NO_DICT:
return 1;
+ case LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES:
+ return 1;
+ case LOAD_ATTR_NONDESCRIPTOR_NO_DICT:
+ return 1;
case LOAD_ATTR_METHOD_LAZY_DICT:
return 1;
case KW_NAMES:
@@ -815,11 +819,15 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case PUSH_EXC_INFO:
return 2;
case LOAD_ATTR_METHOD_WITH_VALUES:
- return ((oparg & 1) ? 1 : 0) + 1;
+ return (1 ? 1 : 0) + 1;
case LOAD_ATTR_METHOD_NO_DICT:
- return ((oparg & 1) ? 1 : 0) + 1;
+ return (1 ? 1 : 0) + 1;
+ case LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES:
+ return (0 ? 1 : 0) + 1;
+ case LOAD_ATTR_NONDESCRIPTOR_NO_DICT:
+ return (0 ? 1 : 0) + 1;
case LOAD_ATTR_METHOD_LAZY_DICT:
- return ((oparg & 1) ? 1 : 0) + 1;
+ return (1 ? 1 : 0) + 1;
case KW_NAMES:
return 0;
case INSTRUMENTED_CALL:
@@ -1120,6 +1128,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[512] = {
[PUSH_EXC_INFO] = { true, INSTR_FMT_IX, 0 },
[LOAD_ATTR_METHOD_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
[LOAD_ATTR_METHOD_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
+ [LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
+ [LOAD_ATTR_NONDESCRIPTOR_NO_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
[LOAD_ATTR_METHOD_LAZY_DICT] = { true, INSTR_FMT_IBC00000000, HAS_ARG_FLAG },
[KW_NAMES] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_CONST_FLAG },
[INSTRUMENTED_CALL] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h
index 1a1ad97..d84d253 100644
--- a/Python/opcode_targets.h
+++ b/Python/opcode_targets.h
@@ -80,14 +80,14 @@ static void *opcode_targets[256] = {
&&TARGET_LOAD_ATTR_METHOD_WITH_VALUES,
&&TARGET_LOAD_ATTR_METHOD_NO_DICT,
&&TARGET_LOAD_ATTR_METHOD_LAZY_DICT,
- &&TARGET_COMPARE_OP_FLOAT,
- &&TARGET_COMPARE_OP_INT,
+ &&TARGET_LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES,
+ &&TARGET_LOAD_ATTR_NONDESCRIPTOR_NO_DICT,
&&TARGET_RETURN_VALUE,
- &&TARGET_COMPARE_OP_STR,
+ &&TARGET_COMPARE_OP_FLOAT,
&&TARGET_SETUP_ANNOTATIONS,
- &&TARGET_FOR_ITER_LIST,
+ &&TARGET_COMPARE_OP_INT,
&&TARGET_LOAD_LOCALS,
- &&TARGET_FOR_ITER_TUPLE,
+ &&TARGET_COMPARE_OP_STR,
&&TARGET_POP_EXCEPT,
&&TARGET_STORE_NAME,
&&TARGET_DELETE_NAME,
@@ -110,9 +110,9 @@ static void *opcode_targets[256] = {
&&TARGET_IMPORT_NAME,
&&TARGET_IMPORT_FROM,
&&TARGET_JUMP_FORWARD,
+ &&TARGET_FOR_ITER_LIST,
+ &&TARGET_FOR_ITER_TUPLE,
&&TARGET_FOR_ITER_RANGE,
- &&TARGET_FOR_ITER_GEN,
- &&TARGET_CALL_BOUND_METHOD_EXACT_ARGS,
&&TARGET_POP_JUMP_IF_FALSE,
&&TARGET_POP_JUMP_IF_TRUE,
&&TARGET_LOAD_GLOBAL,
@@ -131,11 +131,11 @@ static void *opcode_targets[256] = {
&&TARGET_POP_JUMP_IF_NONE,
&&TARGET_RAISE_VARARGS,
&&TARGET_GET_AWAITABLE,
- &&TARGET_CALL_PY_EXACT_ARGS,
+ &&TARGET_FOR_ITER_GEN,
&&TARGET_BUILD_SLICE,
&&TARGET_JUMP_BACKWARD_NO_INTERRUPT,
&&TARGET_MAKE_CELL,
- &&TARGET_CALL_PY_WITH_DEFAULTS,
+ &&TARGET_CALL_BOUND_METHOD_EXACT_ARGS,
&&TARGET_LOAD_DEREF,
&&TARGET_STORE_DEREF,
&&TARGET_DELETE_DEREF,
@@ -147,26 +147,26 @@ static void *opcode_targets[256] = {
&&TARGET_LIST_APPEND,
&&TARGET_SET_ADD,
&&TARGET_MAP_ADD,
- &&TARGET_CALL_NO_KW_TYPE_1,
+ &&TARGET_CALL_PY_EXACT_ARGS,
&&TARGET_COPY_FREE_VARS,
&&TARGET_YIELD_VALUE,
&&TARGET_RESUME,
&&TARGET_MATCH_CLASS,
+ &&TARGET_CALL_PY_WITH_DEFAULTS,
+ &&TARGET_CALL_NO_KW_TYPE_1,
&&TARGET_CALL_NO_KW_STR_1,
- &&TARGET_CALL_NO_KW_TUPLE_1,
- &&TARGET_CALL_BUILTIN_CLASS,
&&TARGET_BUILD_CONST_KEY_MAP,
&&TARGET_BUILD_STRING,
&&TARGET_CONVERT_VALUE,
+ &&TARGET_CALL_NO_KW_TUPLE_1,
+ &&TARGET_CALL_BUILTIN_CLASS,
&&TARGET_CALL_NO_KW_BUILTIN_O,
- &&TARGET_CALL_NO_KW_BUILTIN_FAST,
- &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS,
&&TARGET_LIST_EXTEND,
&&TARGET_SET_UPDATE,
&&TARGET_DICT_MERGE,
&&TARGET_DICT_UPDATE,
- &&TARGET_CALL_NO_KW_LEN,
- &&TARGET_CALL_NO_KW_ISINSTANCE,
+ &&TARGET_CALL_NO_KW_BUILTIN_FAST,
+ &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS,
&&TARGET_LOAD_FAST_LOAD_FAST,
&&TARGET_STORE_FAST_LOAD_FAST,
&&TARGET_STORE_FAST_STORE_FAST,
@@ -177,6 +177,8 @@ static void *opcode_targets[256] = {
&&TARGET_LOAD_FROM_DICT_OR_GLOBALS,
&&TARGET_LOAD_FROM_DICT_OR_DEREF,
&&TARGET_SET_FUNCTION_ATTRIBUTE,
+ &&TARGET_CALL_NO_KW_LEN,
+ &&TARGET_CALL_NO_KW_ISINSTANCE,
&&TARGET_CALL_NO_KW_LIST_APPEND,
&&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_O,
&&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS,
@@ -227,8 +229,6 @@ static void *opcode_targets[256] = {
&&_unknown_opcode,
&&_unknown_opcode,
&&_unknown_opcode,
- &&_unknown_opcode,
- &&_unknown_opcode,
&&TARGET_ENTER_EXECUTOR,
&&_unknown_opcode,
&&_unknown_opcode,
diff --git a/Python/specialize.c b/Python/specialize.c
index a3fce2e..dcf4be7 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -711,8 +711,8 @@ specialize_dict_access(
return 1;
}
-static int specialize_attr_loadmethod(PyObject* owner, _Py_CODEUNIT* instr, PyObject* name,
- PyObject* descr, DescriptorClassification kind);
+static int specialize_attr_loadclassattr(PyObject* owner, _Py_CODEUNIT* instr, PyObject* name,
+ PyObject* descr, DescriptorClassification kind, bool is_method);
static int specialize_class_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject* name);
void
@@ -753,7 +753,7 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
{
int oparg = instr->op.arg;
if (oparg & 1) {
- if (specialize_attr_loadmethod(owner, instr, name, descr, kind)) {
+ if (specialize_attr_loadclassattr(owner, instr, name, descr, kind, true)) {
goto success;
}
}
@@ -872,10 +872,14 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
goto fail;
case NON_DESCRIPTOR:
- SPECIALIZATION_FAIL(LOAD_ATTR,
- (type->tp_flags & Py_TPFLAGS_MANAGED_DICT) ?
- SPEC_FAIL_ATTR_CLASS_ATTR_SIMPLE :
- SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
+ if ((instr->op.arg & 1) == 0) {
+ if (specialize_attr_loadclassattr(owner, instr, name, descr, kind, false)) {
+ goto success;
+ }
+ }
+ else {
+ SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_CLASS_ATTR_SIMPLE);
+ }
goto fail;
case ABSENT:
if (specialize_dict_access(owner, instr, type, kind, name, LOAD_ATTR,
@@ -1064,13 +1068,14 @@ specialize_class_load_attr(PyObject *owner, _Py_CODEUNIT *instr,
// can cause a significant drop in cache hits. A possible test is
// python.exe -m test_typing test_re test_dis test_zlib.
static int
-specialize_attr_loadmethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name,
-PyObject *descr, DescriptorClassification kind)
+specialize_attr_loadclassattr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name,
+PyObject *descr, DescriptorClassification kind, bool is_method)
{
_PyLoadMethodCache *cache = (_PyLoadMethodCache *)(instr + 1);
PyTypeObject *owner_cls = Py_TYPE(owner);
- assert(kind == METHOD && descr != NULL);
+ assert(descr != NULL);
+ assert((is_method && kind == METHOD) || (!is_method && kind == NON_DESCRIPTOR));
if (owner_cls->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
PyDictKeysObject *keys = ((PyHeapTypeObject *)owner_cls)->ht_cached_keys;
@@ -1090,7 +1095,7 @@ PyObject *descr, DescriptorClassification kind)
return 0;
}
write_u32(cache->keys_version, keys_version);
- instr->op.code = LOAD_ATTR_METHOD_WITH_VALUES;
+ instr->op.code = is_method ? LOAD_ATTR_METHOD_WITH_VALUES : LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES;
}
else {
Py_ssize_t dictoffset = owner_cls->tp_dictoffset;
@@ -1099,9 +1104,9 @@ PyObject *descr, DescriptorClassification kind)
return 0;
}
if (dictoffset == 0) {
- instr->op.code = LOAD_ATTR_METHOD_NO_DICT;
+ instr->op.code = is_method ? LOAD_ATTR_METHOD_NO_DICT : LOAD_ATTR_NONDESCRIPTOR_NO_DICT;
}
- else {
+ else if (is_method) {
PyObject *dict = *(PyObject **) ((char *)owner + dictoffset);
if (dict) {
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NOT_MANAGED_DICT);
@@ -1111,6 +1116,10 @@ PyObject *descr, DescriptorClassification kind)
assert(owner_cls->tp_dictoffset <= INT16_MAX);
instr->op.code = LOAD_ATTR_METHOD_LAZY_DICT;
}
+ else {
+ SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_CLASS_ATTR_SIMPLE);
+ return 0;
+ }
}
/* `descr` is borrowed. This is safe for methods (even inherited ones from
* super classes!) as long as tp_version_tag is validated for two main reasons: