aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_bytecodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/optimizer_bytecodes.c')
-rw-r--r--Python/optimizer_bytecodes.c61
1 files changed, 25 insertions, 36 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index 163a8bfd267..a948cccbf85 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -104,22 +104,18 @@ dummy_func(void) {
res = sym_new_null(ctx);
}
- op(_GUARD_BOTH_INT, (left, right -- left, right)) {
- if (sym_matches_type(left, &PyLong_Type)) {
- if (sym_matches_type(right, &PyLong_Type)) {
- REPLACE_OP(this_instr, _NOP, 0, 0);
- }
- else {
- REPLACE_OP(this_instr, _GUARD_TOS_INT, 0, 0);
- }
+ op(_GUARD_TOS_INT, (tos -- tos)) {
+ if (sym_matches_type(tos, &PyLong_Type)) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
}
- else {
- if (sym_matches_type(right, &PyLong_Type)) {
- REPLACE_OP(this_instr, _GUARD_NOS_INT, 0, 0);
- }
+ sym_set_type(tos, &PyLong_Type);
+ }
+
+ op(_GUARD_NOS_INT, (nos, unused -- nos, unused)) {
+ if (sym_matches_type(nos, &PyLong_Type)) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
}
- sym_set_type(left, &PyLong_Type);
- sym_set_type(right, &PyLong_Type);
+ sym_set_type(nos, &PyLong_Type);
}
op(_GUARD_TYPE_VERSION, (type_version/2, owner -- owner)) {
@@ -145,32 +141,18 @@ dummy_func(void) {
}
}
- op(_GUARD_BOTH_FLOAT, (left, right -- left, right)) {
- if (sym_matches_type(left, &PyFloat_Type)) {
- if (sym_matches_type(right, &PyFloat_Type)) {
- REPLACE_OP(this_instr, _NOP, 0, 0);
- }
- else {
- REPLACE_OP(this_instr, _GUARD_TOS_FLOAT, 0, 0);
- }
- }
- else {
- if (sym_matches_type(right, &PyFloat_Type)) {
- REPLACE_OP(this_instr, _GUARD_NOS_FLOAT, 0, 0);
- }
+ op(_GUARD_TOS_FLOAT, (tos -- tos)) {
+ if (sym_matches_type(tos, &PyFloat_Type)) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
}
-
- sym_set_type(left, &PyFloat_Type);
- sym_set_type(right, &PyFloat_Type);
+ sym_set_type(tos, &PyFloat_Type);
}
- op(_GUARD_BOTH_UNICODE, (left, right -- left, right)) {
- if (sym_matches_type(left, &PyUnicode_Type) &&
- sym_matches_type(right, &PyUnicode_Type)) {
- REPLACE_OP(this_instr, _NOP, 0 ,0);
+ op(_GUARD_NOS_FLOAT, (nos, unused -- nos, unused)) {
+ if (sym_matches_type(nos, &PyFloat_Type)) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
}
- sym_set_type(left, &PyUnicode_Type);
- sym_set_type(right, &PyUnicode_Type);
+ sym_set_type(nos, &PyFloat_Type);
}
op(_BINARY_OP, (left, right -- res)) {
@@ -418,6 +400,13 @@ dummy_func(void) {
}
}
+ op(_GUARD_NOS_UNICODE, (nos, unused -- nos, unused)) {
+ if (sym_matches_type(nos, &PyUnicode_Type)) {
+ REPLACE_OP(this_instr, _NOP, 0, 0);
+ }
+ sym_set_type(nos, &PyUnicode_Type);
+ }
+
op(_GUARD_TOS_UNICODE, (value -- value)) {
if (sym_matches_type(value, &PyUnicode_Type)) {
REPLACE_OP(this_instr, _NOP, 0, 0);