diff options
| author | Ken Jin <kenjin@python.org> | 2025-12-15 19:38:58 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-15 19:38:58 (GMT) |
| commit | 0ac4e6c6cde309b0ca4c4539f48a3773ff426591 (patch) | |
| tree | eb00ee96170f9cc8fb5782f1aeb9ad91578b5cb3 /Python/optimizer_bytecodes.c | |
| parent | b3b644b6b8322dc53c956d1785a56efce43fcd76 (diff) | |
| download | cpython-0ac4e6c6cde309b0ca4c4539f48a3773ff426591.zip cpython-0ac4e6c6cde309b0ca4c4539f48a3773ff426591.tar.gz cpython-0ac4e6c6cde309b0ca4c4539f48a3773ff426591.tar.bz2 | |
gh-134584: Remove custom float decref ops (GH-142576)
Diffstat (limited to 'Python/optimizer_bytecodes.c')
| -rw-r--r-- | Python/optimizer_bytecodes.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 5023f84..deb28f0 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -261,31 +261,25 @@ dummy_func(void) { res = sym_new_compact_int(ctx); } - op(_BINARY_OP_ADD_FLOAT, (left, right -- res)) { + op(_BINARY_OP_ADD_FLOAT, (left, right -- res, l, r)) { REPLACE_OPCODE_IF_EVALUATES_PURE(left, right); res = sym_new_type(ctx, &PyFloat_Type); - // TODO (gh-134584): Refactor this to use another uop - if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) { - REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0); - } + l = left; + r = right; } - op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res)) { + op(_BINARY_OP_SUBTRACT_FLOAT, (left, right -- res, l, r)) { REPLACE_OPCODE_IF_EVALUATES_PURE(left, right); res = sym_new_type(ctx, &PyFloat_Type); - // TODO (gh-134584): Refactor this to use another uop - if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) { - REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0); - } + l = left; + r = right; } - op(_BINARY_OP_MULTIPLY_FLOAT, (left, right -- res)) { + op(_BINARY_OP_MULTIPLY_FLOAT, (left, right -- res, l, r)) { REPLACE_OPCODE_IF_EVALUATES_PURE(left, right); res = sym_new_type(ctx, &PyFloat_Type); - // TODO (gh-134584): Refactor this to use another uop - if (PyJitRef_IsBorrowed(left) && PyJitRef_IsBorrowed(right)) { - REPLACE_OP(this_instr, op_without_decref_inputs[opcode], oparg, 0); - } + l = left; + r = right; } op(_BINARY_OP_ADD_UNICODE, (left, right -- res)) { @@ -546,6 +540,12 @@ dummy_func(void) { } } + op(_POP_TOP_FLOAT, (value --)) { + if (PyJitRef_IsBorrowed(value)) { + REPLACE_OP(this_instr, _POP_TOP_NOP, 0, 0); + } + } + op(_COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) { assert(oparg > 0); top = bottom; |
