aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-11-11 12:18:50 +0100
committerBjörn Gustavsson <[email protected]>2011-01-17 15:23:40 +0100
commitd734f64cc5b4e8b906f0d4f1b28f67c492a05bae (patch)
tree1f2b9a36ac1936c6d2a2a27ce78bf4f5fb9c2b15 /erts/emulator
parent21cd0c4f8654286ce8b14157529fcfc916fc209e (diff)
downloadotp-d734f64cc5b4e8b906f0d4f1b28f67c492a05bae.tar.gz
otp-d734f64cc5b4e8b906f0d4f1b28f67c492a05bae.tar.bz2
otp-d734f64cc5b4e8b906f0d4f1b28f67c492a05bae.zip
Eliminate redundant jump instructions
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/beam_load.c8
-rw-r--r--erts/emulator/beam/ops.tab5
2 files changed, 13 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index cf87e111db..65cd6f91bb 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -2260,6 +2260,14 @@ mixed_types(LoaderState* stp, GenOpArg Size, GenOpArg* Rest)
return 0;
}
+static int
+same_label(LoaderState* stp, GenOpArg Target, GenOpArg Label)
+{
+ return Target.type = TAG_f && Label.type == TAG_u &&
+ Target.val == Label.val;
+}
+
+
/*
* Generate an instruction for element/2.
*/
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 2d89926bc5..81be97fd1e 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -163,6 +163,11 @@ i_select_tuple_arity s f I
i_jump_on_val_zero s f I
i_jump_on_val s f I I
+jump Target | label Lbl | same_label(Target, Lbl) => label Lbl
+
+is_ne_exact L1 S1 S2 | jump Fail | label L2 | same_label(L1, L2) => \
+ is_eq_exact Fail S1 S2 | label L2
+
%macro: get_list GetList -pack
get_list x x x
get_list x x y