File 2103-Eliminate-process-yield-after-each-call-to-length-1.patch of Package erlang

From c6d5af1054f8d555a69111f29b59d5485ef8e48f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 10 May 2019 14:33:00 +0200
Subject: [PATCH] Eliminate process yield after each call to length/1

After calculating the length of a list, length/1 would accidentally
bump all remaining reductions, forcing the process to yield. Correct
the calculation.
---
 erts/emulator/beam/erl_bif_guard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index c921b66a7e..09757e473b 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -306,7 +306,7 @@ Eterm erts_trapping_length_1(Process* p, Eterm* args)
      * We reached the end of the list successfully. Bump reductions
      * and return result.
      */
-    BUMP_REDS(p, saved_max_iter / 16);
+    BUMP_REDS(p, (saved_max_iter - max_iter) / 16);
     return make_small(i);
 }
 
-- 
2.16.4

openSUSE Build Service is sponsored by