gh-134584: Eliminate redundant refcounting from _LOAD_ATTR_SLOT (GH-143320)

Signed-off-by: Manjusaka <me@manjusaka.me>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
Nadeshiko Manju 2026-01-02 01:27:02 +08:00 committed by GitHub
parent 1fb8e0eb51
commit d00d39f58e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 442 additions and 331 deletions

View file

@ -2485,7 +2485,7 @@ dummy_func(
unused/5 +
_PUSH_NULL_CONDITIONAL;
op(_LOAD_ATTR_SLOT, (index/1, owner -- attr)) {
op(_LOAD_ATTR_SLOT, (index/1, owner -- attr, o)) {
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
PyObject **addr = (PyObject **)((char *)owner_o + index);
@ -2498,13 +2498,15 @@ dummy_func(
attr = PyStackRef_FromPyObjectNew(attr_o);
#endif
STAT_INC(LOAD_ATTR, hit);
DECREF_INPUTS();
o = owner;
DEAD(owner);
}
macro(LOAD_ATTR_SLOT) =
unused/1 +
_GUARD_TYPE_VERSION +
_LOAD_ATTR_SLOT + // NOTE: This action may also deopt
POP_TOP +
unused/5 +
_PUSH_NULL_CONDITIONAL;