aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-06-23 17:31:49 +0200
committerBjörn Gustavsson <[email protected]>2015-07-03 14:34:58 +0200
commit3dc2bee53b4d36f41821a6ab512cf01c958c11f9 (patch)
treead25673c3d7ab6532805713a1a2ac946d9d7f8ce /erts/emulator/beam/beam_emu.c
parent1f73d45327bb13a615f2f0a8d9d4888ddacb95a5 (diff)
downloadotp-3dc2bee53b4d36f41821a6ab512cf01c958c11f9.tar.gz
otp-3dc2bee53b4d36f41821a6ab512cf01c958c11f9.tar.bz2
otp-3dc2bee53b4d36f41821a6ab512cf01c958c11f9.zip
Introduce specialized versions of move2
Currently, move2/2 does the two moves sequentially to ensure that the instruction will always work correctly. We can do better than that. If the two move instructions have any registers in common, we can introduce simpler and slightly more efficient instructions to handle those cases: move_shift/3 move_dup/3 For the remaining cases when the the move instructions have no common registers, the move2/4 instruction can perform the moves in parallel which is probably slightly more efficient. For clarity's sake, we will remain the instruction to move2_par/4.
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index bac7057abe..2c10e7ae7c 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -551,7 +551,23 @@ void** beam_ops;
Store(term, Dst); \
} while (0)
-#define Move2(S1, D1, S2, D2) D1 = (S1); D2 = (S2)
+#define Move2Par(S1, D1, S2, D2) \
+ do { \
+ Eterm V1, V2; \
+ V1 = (S1); V2 = (S2); D1 = V1; D2 = V2; \
+ } while (0)
+
+#define MoveShift(Src, SD, D) \
+ do { \
+ Eterm V; \
+ V = Src; D = SD; SD = V; \
+ } while (0)
+
+#define MoveDup(Src, D1, D2) \
+ do { \
+ D1 = D2 = (Src); \
+ } while (0)
+
#define Move3(S1, D1, S2, D2, S3, D3) D1 = (S1); D2 = (S2); D3 = (S3)
#define MoveReturn(Src) \