Skip to content

Commit e1ccc3a

Browse files
committed
Remove the unrelated changes
1 parent 8e1bcaa commit e1ccc3a

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,37 +2893,10 @@ def testfunc(n):
28932893
self.assertEqual(res, 3.5)
28942894
self.assertIsNotNone(ex)
28952895
uops = get_opnames(ex)
2896-
for uop in uops:
2897-
print(uop)
28982896
self.assertIn("_BINARY_OP_EXTEND", uops)
28992897
self.assertIn("_POP_TOP_NOP", uops)
29002898
self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
29012899

2902-
def test_binary_op_refcount_elimination(self):
2903-
class CustomAdder:
2904-
def __init__(self, val):
2905-
self.val = val
2906-
def __add__(self, other):
2907-
return CustomAdder(self.val + other.val)
2908-
2909-
def testfunc(n):
2910-
a = CustomAdder(1)
2911-
b = CustomAdder(2)
2912-
res = None
2913-
for _ in range(n):
2914-
res = a + b
2915-
return res.val if res else 0
2916-
2917-
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
2918-
self.assertEqual(res, 3)
2919-
self.assertIsNotNone(ex)
2920-
uops = get_opnames(ex)
2921-
for uop in uops:
2922-
print(uop)
2923-
self.assertIn("_BINARY_OP", uops)
2924-
self.assertIn("_POP_TOP_NOP", uops)
2925-
self.assertLessEqual(count_ops(ex, "_POP_TOP"), 2)
2926-
29272900
def test_remove_guard_for_slice_list(self):
29282901
def f(n):
29292902
for i in range(n):

Python/bytecodes.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5119,7 +5119,7 @@ dummy_func(
51195119
assert(oparg <= NB_OPARG_LAST);
51205120
}
51215121

5122-
op(_BINARY_OP, (lhs, rhs -- res, l, r)) {
5122+
op(_BINARY_OP, (lhs, rhs -- res)) {
51235123
PyObject *lhs_o = PyStackRef_AsPyObjectBorrow(lhs);
51245124
PyObject *rhs_o = PyStackRef_AsPyObjectBorrow(rhs);
51255125

@@ -5129,13 +5129,10 @@ dummy_func(
51295129
ERROR_NO_POP();
51305130
}
51315131
res = PyStackRef_FromPyObjectSteal(res_o);
5132-
l = lhs;
5133-
r = rhs;
5134-
DEAD(lhs);
5135-
DEAD(rhs);
5132+
DECREF_INPUTS();
51365133
}
51375134

5138-
macro(BINARY_OP) = _SPECIALIZE_BINARY_OP + unused/4 + _BINARY_OP + POP_TOP + POP_TOP;
5135+
macro(BINARY_OP) = _SPECIALIZE_BINARY_OP + unused/4 + _BINARY_OP;
51395136

51405137
pure replicate(2:4) inst(SWAP, (bottom, unused[oparg-2], top --
51415138
bottom, unused[oparg-2], top)) {

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,8 @@ dummy_func(void) {
210210
sym_set_type(left, &PyFloat_Type);
211211
}
212212

213-
op(_BINARY_OP, (lhs, rhs -- res, l, r)) {
213+
op(_BINARY_OP, (lhs, rhs -- res)) {
214214
REPLACE_OPCODE_IF_EVALUATES_PURE(lhs, rhs, res);
215-
l = lhs;
216-
r = rhs;
217215
bool lhs_int = sym_matches_type(lhs, &PyLong_Type);
218216
bool rhs_int = sym_matches_type(rhs, &PyLong_Type);
219217
bool lhs_float = sym_matches_type(lhs, &PyFloat_Type);

0 commit comments

Comments
 (0)