aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-05 12:56:57 +0200
committerBjörn Gustavsson <[email protected]>2016-04-07 15:28:29 +0200
commit937f527054f13dd524588c064cd5d76e3cfd23eb (patch)
tree8fe284d496399fb4b0a3e07286b101517dbf4f6a /erts/emulator/beam/beam_load.c
parente93a66110aa27a5b8228fb46a3459a6de0e626d0 (diff)
downloadotp-937f527054f13dd524588c064cd5d76e3cfd23eb.tar.gz
otp-937f527054f13dd524588c064cd5d76e3cfd23eb.tar.bz2
otp-937f527054f13dd524588c064cd5d76e3cfd23eb.zip
Avoid rebuilding unchanged instructions
In transformations such as: move S X0=x==0 | line Loc | call_ext Ar Func => \ line Loc | move S X0 | call_ext Ar Func we can avoid rebuilding the last instruction in the sequence by introducing a 'keep' instruction. Currently, there are only 13 transformations that are hit by this optimization, but most of them are frequently used.
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index ad174664ae..bdb451a6fe 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -5028,7 +5028,16 @@ transform_engine(LoaderState* st)
instr = 0;
#endif
break;
-
+#if defined(TOP_keep)
+ case TOP_keep:
+ /* Keep the current instruction unchanged. */
+ keep = instr;
+ st->genop = instr;
+#ifdef DEBUG
+ instr = 0;
+#endif
+ break;
+#endif
#if defined(TOP_call_end)
case TOP_call_end:
{