aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-10-24 17:08:03 +0200
committerLukas Larsson <[email protected]>2018-12-03 14:34:56 +0100
commit790aa06d380b5842fe2fdd984bdde4f160b3adaa (patch)
tree6dd68f54a1d4ee8c6c39ee1a60a59ef50338e5ea /erts/emulator
parent3e6890af1d8d5ec9e7ae51bf3ed439906d43905b (diff)
downloadotp-790aa06d380b5842fe2fdd984bdde4f160b3adaa.tar.gz
otp-790aa06d380b5842fe2fdd984bdde4f160b3adaa.tar.bz2
otp-790aa06d380b5842fe2fdd984bdde4f160b3adaa.zip
erts: Fix lists_member_2 reduction count
OTP-15474
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_bif_lists.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_bif_lists.c b/erts/emulator/beam/erl_bif_lists.c
index 395be67a90..2a2b94c831 100644
--- a/erts/emulator/beam/erl_bif_lists.c
+++ b/erts/emulator/beam/erl_bif_lists.c
@@ -249,7 +249,8 @@ BIF_RETTYPE lists_member_2(BIF_ALIST_2)
Eterm list;
Eterm item;
int non_immed_key;
- int max_iter = 10 * CONTEXT_REDS;
+ int reds_left = ERTS_BIF_REDS_LEFT(BIF_P);
+ int max_iter = 16 * reds_left;
if (is_nil(BIF_ARG_2)) {
BIF_RET(am_false);
@@ -267,14 +268,15 @@ BIF_RETTYPE lists_member_2(BIF_ALIST_2)
}
item = CAR(list_val(list));
if ((item == term) || (non_immed_key && eq(item, term))) {
- BIF_RET2(am_true, CONTEXT_REDS - max_iter/10);
+ BIF_RET2(am_true, reds_left - max_iter/16);
}
list = CDR(list_val(list));
}
if (is_not_nil(list)) {
+ BUMP_REDS(BIF_P, reds_left - max_iter/16);
BIF_ERROR(BIF_P, BADARG);
}
- BIF_RET2(am_false, CONTEXT_REDS - max_iter/10);
+ BIF_RET2(am_false, reds_left - max_iter/16);
}
static BIF_RETTYPE lists_reverse_alloc(Process *c_p,