aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-07-04 08:58:33 +0200
committerBjörn Gustavsson <[email protected]>2015-07-06 13:38:18 +0200
commite820b8534fd440aaf4991f3c57b8990ce836c8b0 (patch)
treee3d620c0082786e870bbb7144aaa56f2561ce38d /erts/emulator/beam/beam_emu.c
parent7bfff20c48cdcabf1eae4b193a374a72977b9d3e (diff)
downloadotp-e820b8534fd440aaf4991f3c57b8990ce836c8b0.tar.gz
otp-e820b8534fd440aaf4991f3c57b8990ce836c8b0.tar.bz2
otp-e820b8534fd440aaf4991f3c57b8990ce836c8b0.zip
Speed up list matching
The combination is_non_empty_list followed by get_list is extremly common (but not in estone_SUITE, which is why it has not been noticed before). Therefore it is worthwile to introduce a combined instruction.
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 1ab8c71685..989066a1ca 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -737,6 +737,17 @@ void** beam_ops;
if (is_not_list(x(0))) { Fail; } \
TestHeap(Need, Alive)
+#define IsNonemptyListGetList(Src, H, T, Fail) \
+ if (is_not_list(Src)) { \
+ Fail; \
+ } else { \
+ Eterm* tmp_ptr = list_val(Src); \
+ Eterm hd, tl; \
+ hd = CAR(tmp_ptr); \
+ tl = CDR(tmp_ptr); \
+ H = hd; T = tl; \
+ }
+
#define IsTuple(X, Action) if (is_not_tuple(X)) Action
#define IsArity(Pointer, Arity, Fail) \