aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-12-10 07:57:01 +0100
committerBjörn Gustavsson <[email protected]>2011-01-17 15:23:47 +0100
commit51ddd2047c70bce67c8644d85f5d5de72842c320 (patch)
tree70480b071d450b925d6dd87bfa9af3b62bc88c4c
parent40dd4f87b3567d087bbcb071404b871af3601241 (diff)
downloadotp-51ddd2047c70bce67c8644d85f5d5de72842c320.tar.gz
otp-51ddd2047c70bce67c8644d85f5d5de72842c320.tar.bz2
otp-51ddd2047c70bce67c8644d85f5d5de72842c320.zip
Combine a move + jump sequence into the move_jump instruction
That will save one word and small amount of time for each occurrence.
-rw-r--r--erts/emulator/beam/beam_emu.c5
-rw-r--r--erts/emulator/beam/ops.tab8
2 files changed, 13 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index b90613079a..edb4d61ed2 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -688,6 +688,11 @@ extern int count_instructions;
SET_I((BeamInstr *) CallDest); \
Dispatch();
+#define MoveJump(Src) \
+ r(0) = (Src); \
+ SET_I((BeamInstr *) Arg(0)); \
+ Goto(*I);
+
#define GetList(Src, H, T) do { \
Eterm* tmp_ptr = list_val(Src); \
H = CAR(tmp_ptr); \
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 9b3d1da018..ac63b352ef 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -279,6 +279,14 @@ system_limit j
move R R =>
+move C=cxy r | jump Lbl => move_jump Lbl C
+
+%macro: move_jump MoveJump -nonext
+move_jump f n
+move_jump f c
+move_jump f x
+move_jump f y
+
move X1=x Y1=y | move X2=x Y2=y => move2 X1 Y1 X2 Y2
move Y1=y X1=x | move Y2=y X2=x => move2 Y1 X1 Y2 X2
move X1=x X2=x | move X3=x X4=x => move2 X1 X2 X3 X4