gh-134584: Remove custom float decref ops (GH-142576)

This commit is contained in:
Ken Jin 2025-12-16 03:38:58 +08:00 committed by GitHub
parent b3b644b6b8
commit 0ac4e6c6cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 2606 additions and 3131 deletions

View file

@ -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;