aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/utils/beam_makeops
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-08-09 16:49:39 +0200
committerBjörn Gustavsson <[email protected]>2011-10-11 11:36:37 +0200
commit2a30746d09f467c13e9361774867462ae4f2bd32 (patch)
tree1823e57adc1d31516cf366f3726ec6a736f6d8ea /erts/emulator/utils/beam_makeops
parente87760199eb9d3c02480e92a0bcf76864c750972 (diff)
downloadotp-2a30746d09f467c13e9361774867462ae4f2bd32.tar.gz
otp-2a30746d09f467c13e9361774867462ae4f2bd32.tar.bz2
otp-2a30746d09f467c13e9361774867462ae4f2bd32.zip
Introduce 'try_me_else_fail'
Diffstat (limited to 'erts/emulator/utils/beam_makeops')
-rwxr-xr-xerts/emulator/utils/beam_makeops21
1 files changed, 20 insertions, 1 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index 9c7e5e94a5..367f089401 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -187,6 +187,12 @@ sub define_type_bit {
}
#
+# Pre-define the 'fail' instruction. It is used internally
+# by the 'try_me_else_fail' instruction.
+#
+$match_engine_ops{'TOP_fail'} = 1;
+
+#
# Sanity checks.
#
@@ -1316,7 +1322,20 @@ sub tr_gen {
print "Uint op_transform[] = {\n";
foreach $key (keys %gen_transform) {
$gen_transform_offset{$key} = $offset;
- foreach $instr (@{$gen_transform{$key}}) {
+ my @instr = @{$gen_transform{$key}};
+
+ #
+ # If the last instruction is 'fail', remove it and
+ # convert the previous 'try_me_else' to 'try_me_else_fail'.
+ #
+ if (is_instr($instr[$#instr], 'fail')) {
+ pop(@instr);
+ my $i = $#instr;
+ $i-- while !is_instr($instr[$i], 'try_me_else');
+ $instr[$i] = make_op('', 'try_me_else_fail');
+ }
+
+ foreach $instr (@instr) {
my($size, $instr_ref, $comment) = @$instr;
my($op, @args) = @$instr_ref;
print " ";