summaryrefslogtreecommitdiff
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-06-07 10:28:53 +0100
committerGitHub <noreply@github.com>2022-06-07 10:28:53 +0100
commitf012df706cf3a9e63625b8166fe3f419855e9a94 (patch)
tree79e77365bf7a0deda813c0036ee0ed3bde2390c5 /Python/specialize.c
parent75ceae05c11461beda65e6170b67b0b42fd55cd0 (diff)
downloadcpython-git-f012df706cf3a9e63625b8166fe3f419855e9a94.tar.gz
Shrink the LOAD_METHOD cache by one codeunit. (#93537)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 4d30a2aea5..1df281a19a 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -986,7 +986,7 @@ _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
}
}
}
- if (dictkind == MANAGED_VALUES || dictkind == MANAGED_DICT || dictkind == OFFSET_DICT) {
+ if (dictkind == MANAGED_VALUES || dictkind == OFFSET_DICT) {
Py_ssize_t index = _PyDictKeys_StringLookup(keys, name);
if (index != DKIX_EMPTY) {
SPECIALIZATION_FAIL(LOAD_METHOD, SPEC_FAIL_LOAD_METHOD_IS_ATTR);
@@ -1007,17 +1007,14 @@ _Py_Specialize_LoadMethod(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
_Py_SET_OPCODE(*instr, LOAD_METHOD_WITH_VALUES);
break;
case MANAGED_DICT:
- *(int16_t *)&cache->dict_offset = (int16_t)MANAGED_DICT_OFFSET;
- _Py_SET_OPCODE(*instr, LOAD_METHOD_WITH_DICT);
- break;
+ SPECIALIZATION_FAIL(LOAD_METHOD, SPEC_FAIL_LOAD_METHOD_HAS_MANAGED_DICT);
+ goto fail;
case OFFSET_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
- cache->dict_offset = (uint16_t)owner_cls->tp_dictoffset;
_Py_SET_OPCODE(*instr, LOAD_METHOD_WITH_DICT);
break;
case LAZY_DICT:
assert(owner_cls->tp_dictoffset > 0 && owner_cls->tp_dictoffset <= INT16_MAX);
- cache->dict_offset = (uint16_t)owner_cls->tp_dictoffset;
_Py_SET_OPCODE(*instr, LOAD_METHOD_LAZY_DICT);
break;
}