mirror of https://github.com/python/cpython
GH-111772: Specialize slot loads and stores for `_Py_T_OBJECT` (GH-111773)
This commit is contained in:
parent
d78c872e0d
commit
a7b0f63cdb
|
@ -0,0 +1 @@
|
|||
Specialize slot loads and stores for _Py_T_OBJECT as well as Py_T_OBJECT_EX
|
|
@ -742,7 +742,7 @@ analyze_descriptor(PyTypeObject *type, PyObject *name, PyObject **descr, int sto
|
|||
if (desc_cls == &PyMemberDescr_Type) {
|
||||
PyMemberDescrObject *member = (PyMemberDescrObject *)descriptor;
|
||||
struct PyMemberDef *dmem = member->d_member;
|
||||
if (dmem->type == Py_T_OBJECT_EX) {
|
||||
if (dmem->type == Py_T_OBJECT_EX || dmem->type == _Py_T_OBJECT) {
|
||||
return OBJECT_SLOT;
|
||||
}
|
||||
return OTHER_SLOT;
|
||||
|
@ -942,7 +942,7 @@ _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
|
|||
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_RANGE);
|
||||
goto fail;
|
||||
}
|
||||
assert(dmem->type == Py_T_OBJECT_EX);
|
||||
assert(dmem->type == Py_T_OBJECT_EX || dmem->type == _Py_T_OBJECT);
|
||||
assert(offset > 0);
|
||||
cache->index = (uint16_t)offset;
|
||||
write_u32(cache->version, type->tp_version_tag);
|
||||
|
@ -1082,7 +1082,7 @@ _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr, PyObject *name)
|
|||
SPECIALIZATION_FAIL(STORE_ATTR, SPEC_FAIL_OUT_OF_RANGE);
|
||||
goto fail;
|
||||
}
|
||||
assert(dmem->type == Py_T_OBJECT_EX);
|
||||
assert(dmem->type == Py_T_OBJECT_EX || dmem->type == _Py_T_OBJECT);
|
||||
assert(offset > 0);
|
||||
cache->index = (uint16_t)offset;
|
||||
write_u32(cache->version, type->tp_version_tag);
|
||||
|
|
Loading…
Reference in New Issue