aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/optimizer_bytecodes.c9
-rw-r--r--Python/optimizer_cases.c.h9
2 files changed, 17 insertions, 1 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index fbf4dfd3db6..a9d5e92ca02 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -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);
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index b42f47c75ea..4780e492f61 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -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;
}