mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-131798: Optimize _UNARY_INVERT
(GH-135222)
This commit is contained in:
parent
c19e36cc4e
commit
b150b6aca7
4 changed files with 33 additions and 1 deletions
|
@ -467,6 +467,15 @@ dummy_func(void) {
|
|||
res = sym_new_truthiness(ctx, value, false);
|
||||
}
|
||||
|
||||
op(_UNARY_INVERT, (value -- res)) {
|
||||
if (sym_matches_type(value, &PyLong_Type)) {
|
||||
res = sym_new_type(ctx, &PyLong_Type);
|
||||
}
|
||||
else {
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
op(_COMPARE_OP, (left, right -- res)) {
|
||||
if (oparg & 16) {
|
||||
res = sym_new_type(ctx, &PyBool_Type);
|
||||
|
|
9
Python/optimizer_cases.c.h
generated
9
Python/optimizer_cases.c.h
generated
|
@ -285,8 +285,15 @@
|
|||
}
|
||||
|
||||
case _UNARY_INVERT: {
|
||||
JitOptSymbol *value;
|
||||
JitOptSymbol *res;
|
||||
res = sym_new_not_null(ctx);
|
||||
value = stack_pointer[-1];
|
||||
if (sym_matches_type(value, &PyLong_Type)) {
|
||||
res = sym_new_type(ctx, &PyLong_Type);
|
||||
}
|
||||
else {
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
stack_pointer[-1] = res;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue