GH-134584: Remove redundant refcount from _STORE_ATTR_SLOT (#142729)

This commit is contained in:
Savannah Ostrowski 2025-12-15 15:18:44 -08:00 committed by GitHub
parent f277781bba
commit bef63d2fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 70 additions and 17 deletions

View file

@ -10678,6 +10678,7 @@
static_assert(INLINE_CACHE_ENTRIES_STORE_ATTR == 4, "incorrect cache size");
_PyStackRef owner;
_PyStackRef value;
_PyStackRef o;
/* Skip 1 cache entry */
// _GUARD_TYPE_VERSION
{
@ -10706,13 +10707,23 @@
PyObject *old_value = *(PyObject **)addr;
FT_ATOMIC_STORE_PTR_RELEASE(*(PyObject **)addr, PyStackRef_AsPyObjectSteal(value));
UNLOCK_OBJECT(owner_o);
stack_pointer += -2;
o = owner;
stack_pointer[-2] = o;
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(owner);
Py_XDECREF(old_value);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _POP_TOP
{
value = o;
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_XCLOSE(value);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
DISPATCH();
}