gh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011)

This commit is contained in:
AN Long 2026-01-24 18:35:32 +09:00 committed by GitHub
parent 29f1e778fa
commit 4e10fa993a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 105 additions and 48 deletions

View file

@ -5119,7 +5119,7 @@ dummy_func(
assert(oparg <= NB_OPARG_LAST);
}
op(_BINARY_OP, (lhs, rhs -- res)) {
op(_BINARY_OP, (lhs, rhs -- res, l, r)) {
PyObject *lhs_o = PyStackRef_AsPyObjectBorrow(lhs);
PyObject *rhs_o = PyStackRef_AsPyObjectBorrow(rhs);
@ -5129,10 +5129,13 @@ dummy_func(
ERROR_NO_POP();
}
res = PyStackRef_FromPyObjectSteal(res_o);
DECREF_INPUTS();
l = lhs;
r = rhs;
DEAD(lhs);
DEAD(rhs);
}
macro(BINARY_OP) = _SPECIALIZE_BINARY_OP + unused/4 + _BINARY_OP;
macro(BINARY_OP) = _SPECIALIZE_BINARY_OP + unused/4 + _BINARY_OP + POP_TOP + POP_TOP;
pure replicate(2:4) inst(SWAP, (bottom, unused[oparg-2], top --
bottom, unused[oparg-2], top)) {