aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/ops.tab
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-07 10:06:44 +0200
committerBjörn Gustavsson <[email protected]>2016-04-08 10:28:42 +0200
commit3c0f98c1b0e74eb58a4e4e82a3ec89dc7ecdb579 (patch)
treec7b5544b9a7e506bc641302d265f6e44a468a660 /erts/emulator/beam/ops.tab
parent0e1e90907ae76aae80f15316c2e43200a70d639b (diff)
downloadotp-3c0f98c1b0e74eb58a4e4e82a3ec89dc7ecdb579.tar.gz
otp-3c0f98c1b0e74eb58a4e4e82a3ec89dc7ecdb579.tar.bz2
otp-3c0f98c1b0e74eb58a4e4e82a3ec89dc7ecdb579.zip
Simplify the raise instruction to reduce code size
The raise/2 instruction is almost always used like this: raise x(2) x(1) Therefore, we can translate it to an internal i_raise/0 instruction that uses x(2) x(1) as its implicit operands. We will also remove the backward compatibility with R10-0. It is unlikely that anyone still is using BEAM files compiled with the R10-0 compiler, especially since most of those modules cannot be loaded. The loader will refuse to load any module that uses the old non-GCIng arithmetic instructions or the non-GCing versions of length/1 or size/1. Doing these changes will reduce both the size of the loaded BEAM code and size of the code in process_main().
Diffstat (limited to 'erts/emulator/beam/ops.tab')
-rw-r--r--erts/emulator/beam/ops.tab9
1 files changed, 8 insertions, 1 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 15f27835a8..96a3a72bb5 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -251,7 +251,14 @@ case_end x
badmatch x
if_end
-raise s s
+
+# Operands for raise/2 are almost always in x(2) and x(1).
+# Optimize for that case.
+raise x==2 x==1 => i_raise
+raise Trace=y Value=y => move Trace x=2 | move Value x=1 | i_raise
+raise Trace Value => move Trace x=3 | move Value x=1 | move x=3 x=2 | i_raise
+
+i_raise
# Internal now, but could be useful to make known to the compiler.
badarg j