gh-134584: JIT: Remove redundant refcounting for UNARY_{INVERT|NEGATIVE} (GH-143704)

This commit is contained in:
Ken Jin 2026-01-12 04:42:55 +08:00 committed by GitHub
parent 9d13ca97c1
commit 548526bbbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 976 additions and 899 deletions

View file

@ -449,7 +449,8 @@ dummy_func(void) {
res = sym_new_truthiness(ctx, value, false);
}
op(_UNARY_NEGATIVE, (value -- res)) {
op(_UNARY_NEGATIVE, (value -- res, v)) {
v = value;
REPLACE_OPCODE_IF_EVALUATES_PURE(value, res);
if (sym_is_compact_int(value)) {
res = sym_new_compact_int(ctx);
@ -465,7 +466,8 @@ dummy_func(void) {
}
}
op(_UNARY_INVERT, (value -- res)) {
op(_UNARY_INVERT, (value -- res, v)) {
v = value;
// Required to avoid a warning due to the deprecation of bitwise inversion of bools
if (!sym_matches_type(value, &PyBool_Type)) {
REPLACE_OPCODE_IF_EVALUATES_PURE(value, res);