mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
Revert "gh-100288: Specialise LOAD_ATTR_METHOD for managed dictionaries (GH-100289)" (#100468)
This reverts commit c3c7848a48
.
This commit is contained in:
parent
c3c7848a48
commit
36d358348d
8 changed files with 43 additions and 101 deletions
25
Python/generated_cases.c.h
generated
25
Python/generated_cases.c.h
generated
|
@ -2964,31 +2964,6 @@
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(LOAD_ATTR_METHOD_MANAGED_DICT) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
PyObject *self = TOP();
|
||||
PyTypeObject *self_cls = Py_TYPE(self);
|
||||
_PyLoadMethodCache *cache = (_PyLoadMethodCache *)next_instr;
|
||||
uint32_t type_version = read_u32(cache->type_version);
|
||||
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);
|
||||
PyObject *dict = _PyDictOrValues_GetDict(dorv);
|
||||
PyDictKeysObject *keys = (dict == NULL) ? NULL : ((PyDictObject *)dict)->ma_keys;
|
||||
// Note: cache->keys_version can be 0 when dict is NULL.
|
||||
DEOPT_IF(keys != NULL && keys->dk_version != read_u32(cache->keys_version), LOAD_ATTR);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
PyObject *res = read_obj(cache->descr);
|
||||
assert(res != NULL);
|
||||
assert(_PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR));
|
||||
SET_TOP(Py_NewRef(res));
|
||||
PUSH(self);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(LOAD_ATTR_METHOD_WITH_DICT) {
|
||||
/* Can be either a managed dict, or a tp_dictoffset offset.*/
|
||||
assert(cframe.use_tracing == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue