mirror of
https://github.com/python/cpython.git
synced 2026-01-08 00:12:42 +00:00
gh-134584: Eliminate redundant refcounting from _STORE_ATTR_WITH_HINT (GH-142767)
Signed-off-by: Manjusaka <me@manjusaka.me>
This commit is contained in:
parent
8c87bcd7f2
commit
4345253981
10 changed files with 69 additions and 17 deletions
|
|
@ -2603,7 +2603,7 @@ dummy_func(
|
|||
_STORE_ATTR_INSTANCE_VALUE +
|
||||
POP_TOP;
|
||||
|
||||
op(_STORE_ATTR_WITH_HINT, (hint/1, value, owner --)) {
|
||||
op(_STORE_ATTR_WITH_HINT, (hint/1, value, owner -- o)) {
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
assert(Py_TYPE(owner_o)->tp_flags & Py_TPFLAGS_MANAGED_DICT);
|
||||
PyDictObject *dict = _PyObject_GetManagedDict(owner_o);
|
||||
|
|
@ -2633,14 +2633,16 @@ dummy_func(
|
|||
// old_value should be DECREFed after GC track checking is done, if not, it could raise a segmentation fault,
|
||||
// when dict only holds the strong reference to value in ep->me_value.
|
||||
STAT_INC(STORE_ATTR, hit);
|
||||
PyStackRef_CLOSE(owner);
|
||||
o = owner;
|
||||
DEAD(owner);
|
||||
Py_XDECREF(old_value);
|
||||
}
|
||||
|
||||
macro(STORE_ATTR_WITH_HINT) =
|
||||
unused/1 +
|
||||
_GUARD_TYPE_VERSION +
|
||||
_STORE_ATTR_WITH_HINT;
|
||||
_STORE_ATTR_WITH_HINT +
|
||||
POP_TOP;
|
||||
|
||||
op(_STORE_ATTR_SLOT, (index/1, value, owner -- o)) {
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue