aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-28 10:25:02 +0100
committerBjörn Gustavsson <[email protected]>2019-03-01 14:06:13 +0100
commit2f432a4399544baa346ffa9b0dd18a7ab717dd53 (patch)
treee24d30ea239bd15524fe51ed24356d789b66103b /erts/emulator/beam
parentd841a0919f73adca02a1776e65fca4fd8318050d (diff)
downloadotp-2f432a4399544baa346ffa9b0dd18a7ab717dd53.tar.gz
otp-2f432a4399544baa346ffa9b0dd18a7ab717dd53.tar.bz2
otp-2f432a4399544baa346ffa9b0dd18a7ab717dd53.zip
Combine is_nonempty_list with get_hd/get_tl
The is_nonempty_list test is very frequently followed by get_tl, and frequently followed by get_hd.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/instrs.tab12
-rw-r--r--erts/emulator/beam/ops.tab10
2 files changed, 22 insertions, 0 deletions
diff --git a/erts/emulator/beam/instrs.tab b/erts/emulator/beam/instrs.tab
index 14ca07f97e..fc88cab22f 100644
--- a/erts/emulator/beam/instrs.tab
+++ b/erts/emulator/beam/instrs.tab
@@ -678,6 +678,18 @@ is_nonempty_list_get_list(Fail, Src, Hd, Tl) {
$get_list($Src, $Hd, $Tl);
}
+is_nonempty_list_get_hd(Fail, Src, Hd) {
+ //| -no_prefetch
+ $is_nonempty_list($Fail, $Src);
+ $get_hd($Src, $Hd);
+}
+
+is_nonempty_list_get_tl(Fail, Src, Tl) {
+ //| -no_prefetch
+ $is_nonempty_list($Fail, $Src);
+ $get_tl($Src, $Tl);
+}
+
jump(Fail) {
$JUMP($Fail);
}
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 47a8e566b2..3cfc685336 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -679,8 +679,18 @@ is_nonempty_list Fail=f S=x | allocate Need Rs => is_nonempty_list_allocate Fail
is_nonempty_list Fail=f S=x | get_list S D1=x D2=x => \
is_nonempty_list_get_list Fail S D1 D2
+is_nonempty_list Fail=f S=x | get_hd S Dst=x => \
+ is_nonempty_list_get_hd Fail S Dst
+
+is_nonempty_list Fail=f S=x | get_tl S Dst=x => \
+ is_nonempty_list_get_tl Fail S Dst
+
is_nonempty_list_allocate f? rx t t
+
is_nonempty_list_get_list f? rx x x
+is_nonempty_list_get_hd f? x x
+is_nonempty_list_get_tl f? x x
+
is_nonempty_list f? xy
is_atom f? x