mirror of
https://github.com/python/cpython.git
synced 2025-12-31 12:33:28 +00:00
gh-134584: Eliminate redundant refcounting from _CALL_LIST_APPEND (GH-142711)
Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
parent
8bb5b6e8ce
commit
872ab51f32
10 changed files with 910 additions and 720 deletions
|
|
@ -4350,7 +4350,9 @@ dummy_func(
|
|||
_GUARD_CALLABLE_LIST_APPEND +
|
||||
_GUARD_NOS_NOT_NULL +
|
||||
_GUARD_NOS_LIST +
|
||||
_CALL_LIST_APPEND;
|
||||
_CALL_LIST_APPEND +
|
||||
POP_TOP +
|
||||
POP_TOP;
|
||||
|
||||
op(_GUARD_CALLABLE_LIST_APPEND, (callable, unused, unused -- callable, unused, unused)){
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
|
|
@ -4359,7 +4361,7 @@ dummy_func(
|
|||
}
|
||||
|
||||
// This is secretly a super-instruction
|
||||
op(_CALL_LIST_APPEND, (callable, self, arg -- )) {
|
||||
op(_CALL_LIST_APPEND, (callable, self, arg -- c, s)) {
|
||||
assert(oparg == 1);
|
||||
PyObject *self_o = PyStackRef_AsPyObjectBorrow(self);
|
||||
|
||||
|
|
@ -4367,9 +4369,12 @@ dummy_func(
|
|||
STAT_INC(CALL, hit);
|
||||
int err = _PyList_AppendTakeRef((PyListObject *)self_o, PyStackRef_AsPyObjectSteal(arg));
|
||||
UNLOCK_OBJECT(self_o);
|
||||
PyStackRef_CLOSE(self);
|
||||
PyStackRef_CLOSE(callable);
|
||||
ERROR_IF(err);
|
||||
if (err) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
c = callable;
|
||||
s = self;
|
||||
INPUTS_DEAD();
|
||||
#if TIER_ONE
|
||||
// Skip the following POP_TOP. This is done here in tier one, and
|
||||
// during trace projection in tier two:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue