This commit is contained in:
sobolevn 2026-05-03 21:19:11 +01:00 committed by GitHub
commit 3638f52bde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 1 deletions

View file

@ -2976,6 +2976,11 @@ dummy_func(
}
op(_LOAD_ATTR_CLASS, (descr/4, owner -- attr)) {
PyTypeObject *descr_type = Py_TYPE(descr);
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
EXIT_IF((descr_type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0
&& descr_type != (PyTypeObject *)owner_o);
STAT_INC(LOAD_ATTR, hit);
assert(descr != NULL);
attr = PyStackRef_FromPyObjectNew(descr);

View file

@ -11967,6 +11967,15 @@
_PyStackRef _stack_item_0 = _tos_cache0;
owner = _stack_item_0;
PyObject *descr = (PyObject *)CURRENT_OPERAND0_64();
PyTypeObject *descr_type = Py_TYPE(descr);
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
if ((descr_type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0
&& descr_type != (PyTypeObject *)owner_o) {
UOP_STAT_INC(uopcode, miss);
_tos_cache0 = owner;
SET_CURRENT_CACHED_VALUES(1);
JUMP_TO_JUMP_TARGET();
}
STAT_INC(LOAD_ATTR, hit);
assert(descr != NULL);
attr = PyStackRef_FromPyObjectNew(descr);

View file

@ -8359,6 +8359,14 @@
// _LOAD_ATTR_CLASS
{
PyObject *descr = read_obj(&this_instr[6].cache);
PyTypeObject *descr_type = Py_TYPE(descr);
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
if ((descr_type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0
&& descr_type != (PyTypeObject *)owner_o) {
UPDATE_MISS_STATS(LOAD_ATTR);
assert(_PyOpcode_Deopt[opcode] == (LOAD_ATTR));
JUMP_TO_PREDICTED(LOAD_ATTR);
}
STAT_INC(LOAD_ATTR, hit);
assert(descr != NULL);
attr = PyStackRef_FromPyObjectNew(descr);
@ -8427,6 +8435,14 @@
// _LOAD_ATTR_CLASS
{
PyObject *descr = read_obj(&this_instr[6].cache);
PyTypeObject *descr_type = Py_TYPE(descr);
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
if ((descr_type->tp_flags & Py_TPFLAGS_IMMUTABLETYPE) == 0
&& descr_type != (PyTypeObject *)owner_o) {
UPDATE_MISS_STATS(LOAD_ATTR);
assert(_PyOpcode_Deopt[opcode] == (LOAD_ATTR));
JUMP_TO_PREDICTED(LOAD_ATTR);
}
STAT_INC(LOAD_ATTR, hit);
assert(descr != NULL);
attr = PyStackRef_FromPyObjectNew(descr);