From 3f8f70e8594ee956dba7edb3602dc9e26e144a69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 5 Aug 2011 15:15:43 +0200
Subject: Merge 'next_instr' and 'is_op' into 'next_instr'

'next_instr' is always followed by 'is_op'.
---
 erts/emulator/beam/beam_load.c   |  8 +++-----
 erts/emulator/utils/beam_makeops | 11 ++++-------
 2 files changed, 7 insertions(+), 12 deletions(-)

(limited to 'erts/emulator')

diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 551bc399e7..e858305e9c 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -4250,7 +4250,9 @@ transform_engine(LoaderState* st)
 	op = *pc++;
 
 	switch (op) {
-	case TOP_is_op:
+	case TOP_next_instr:
+	    instr = instr->next;
+	    ap = 0;
 	    if (instr == NULL) {
 		/*
 		 * We'll need at least one more instruction to decide whether
@@ -4437,10 +4439,6 @@ transform_engine(LoaderState* st)
 	case TOP_next_arg:
 	    ap++;
 	    break;
-	case TOP_next_instr:
-	    instr = instr->next;
-	    ap = 0;
-	    break;
 	case TOP_commit:
 	    instr = instr->next; /* The next_instr was optimized away. */
 
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index d71531a1f1..5e86356e10 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -1416,10 +1416,8 @@ sub tr_gen_from {
 	    my $var;
 	    my(@args);
 
-	    my $next_instr = pop(@code); # Get rid of 'next_instr'
 	    push(@fix_pred_funcs, scalar(@code));
 	    push(@code, [$name, @ops]);
-	    push(@code, $next_instr);
 	    next;
 	}
 
@@ -1431,7 +1429,7 @@ sub tr_gen_from {
 	    unless defined $gen_opnum{$name,$arity};
 	$opnum = $gen_opnum{$name,$arity};
 
-	push(@code, &make_op("$name/$arity", 'is_op', $opnum));
+	push(@code, make_op("$name/$arity", 'next_instr', $opnum));
 	$min_window++;
 	foreach $op (@ops) {
 	    my($var, $type, $type_val, $cond, $val) = @$op;
@@ -1506,16 +1504,15 @@ sub tr_gen_from {
 		push(@code, &make_op($ignored_var, 'next_arg'));
 	    }
 	}
-	# Remove redundant 'next_arg' instructions before 'next_instr'.
+
+	# Remove redundant 'next_arg' instructions before the end
+	# of the instruction.
 	pop(@code) while is_instr($code[$#code], 'next_arg');
-	push(@code, &make_op('', 'next_instr'));
     }
 
     #
     # Insert the commit operation.
     #
-    pop(@code);		# Get rid of 'next_instr'
-
     push(@code, make_op($may_fail ? '' : 'always reached', 'commit'));
 
     #
-- 
cgit v1.2.3