mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
GH-104909: Split LOAD_ATTR_INSTANCE_VALUE
into micro-ops (GH-106678)
This commit is contained in:
parent
32718f908c
commit
487861c6ae
6 changed files with 87 additions and 46 deletions
59
Python/generated_cases.c.h
generated
59
Python/generated_cases.c.h
generated
|
@ -2240,28 +2240,45 @@
|
|||
}
|
||||
|
||||
TARGET(LOAD_ATTR_INSTANCE_VALUE) {
|
||||
PyObject *owner = stack_pointer[-1];
|
||||
PyObject *res2 = NULL;
|
||||
PyObject *res;
|
||||
uint32_t type_version = read_u32(&next_instr[1].cache);
|
||||
uint16_t index = read_u16(&next_instr[3].cache);
|
||||
PyTypeObject *tp = Py_TYPE(owner);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR);
|
||||
assert(tp->tp_dictoffset < 0);
|
||||
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
|
||||
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
|
||||
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
|
||||
res = _PyDictOrValues_GetValues(dorv)->values[index];
|
||||
DEOPT_IF(res == NULL, LOAD_ATTR);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
Py_INCREF(res);
|
||||
res2 = NULL;
|
||||
Py_DECREF(owner);
|
||||
STACK_GROW(((oparg & 1) ? 1 : 0));
|
||||
stack_pointer[-1] = res;
|
||||
if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; }
|
||||
PyObject *_tmp_1;
|
||||
PyObject *_tmp_2 = stack_pointer[-1];
|
||||
{
|
||||
}
|
||||
{
|
||||
PyObject *owner = _tmp_2;
|
||||
uint32_t type_version = read_u32(&next_instr[1].cache);
|
||||
PyTypeObject *tp = Py_TYPE(owner);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR);
|
||||
_tmp_2 = owner;
|
||||
}
|
||||
{
|
||||
PyObject *owner = _tmp_2;
|
||||
assert(Py_TYPE(owner)->tp_dictoffset < 0);
|
||||
assert(Py_TYPE(owner)->tp_flags & Py_TPFLAGS_MANAGED_DICT);
|
||||
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
|
||||
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
|
||||
_tmp_2 = owner;
|
||||
}
|
||||
{
|
||||
PyObject *owner = _tmp_2;
|
||||
PyObject *res2 = NULL;
|
||||
PyObject *res;
|
||||
uint16_t index = read_u16(&next_instr[3].cache);
|
||||
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
|
||||
res = _PyDictOrValues_GetValues(dorv)->values[index];
|
||||
DEOPT_IF(res == NULL, LOAD_ATTR);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
Py_INCREF(res);
|
||||
res2 = NULL;
|
||||
Py_DECREF(owner);
|
||||
if (oparg & 1) { _tmp_2 = res2; }
|
||||
_tmp_1 = res;
|
||||
}
|
||||
next_instr += 9;
|
||||
STACK_GROW(((oparg & 1) ? 1 : 0));
|
||||
stack_pointer[-1] = _tmp_1;
|
||||
if (oparg & 1) { stack_pointer[-2] = _tmp_2; }
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue