aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-02-20 12:05:00 +0100
committerBjörn Gustavsson <[email protected]>2011-08-16 08:58:51 +0200
commit3347602be3c8a8bad3652c10e1e2db01315269e3 (patch)
treef586a485986891dc01ac4dc6cb093c7d93d2907c
parentbc8be0481586782f8dcf3781b74aff78079caa11 (diff)
downloadotp-3347602be3c8a8bad3652c10e1e2db01315269e3.tar.gz
otp-3347602be3c8a8bad3652c10e1e2db01315269e3.tar.bz2
otp-3347602be3c8a8bad3652c10e1e2db01315269e3.zip
ops.tab: Remove line instructions before tail-recursive calls
-rw-r--r--erts/emulator/beam/ops.tab18
1 files changed, 15 insertions, 3 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 503a0aecb5..538f0b94af 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -102,14 +102,26 @@ return
move S r | line Loc | call_ext Ar Func => \
line Loc | move S r | call_ext Ar Func
-move S r | line Loc | call_ext_last Ar Func D => \
+move S r | line Loc | call_ext_last Ar Func=u$is_bif D => \
line Loc | move S r | call_ext_last Ar Func D
-move S r | line Loc | call_ext_only Ar Func => \
+move S r | line Loc | call_ext_only Ar Func=u$is_bif => \
line Loc | move S r | call_ext_only Ar Func
-
move S r | line Loc | call Ar Func => \
line Loc | move S r | call Ar Func
+#
+# A tail-recursive call to an external function (non-BIF) will
+# never be saved on the stack, so there is no reason to keep
+# the line instruction. (The compiler did not remove the line
+# instruction because it cannot tell the difference between
+# BIFs and ordinary Erlang functions.)
+#
+
+line Loc | call_ext_last Ar Func=u$is_not_bif D => \
+ call_ext_last Ar Func D
+line Loc | call_ext_only Ar Func=u$is_not_bif => \
+ call_ext_only Ar Func
+
line Loc | func_info M F A => func_info M F A | line Loc
line I