]> granicus.if.org Git - gc/commitdiff
Fix 'unexpected mark stack overflow' abort in push_all_stack
authorIvan Maidanski <ivmai@mail.ru>
Mon, 21 Jan 2019 22:01:45 +0000 (01:01 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 29 Jan 2019 08:48:33 +0000 (11:48 +0300)
(a cherry-pick of commit 420a4768 from 'release-7_6')

Issue #260 (bdwgc).

* mark.c [!(THREADS && MPROTECT_VDB)]
(GC_push_all_stack): Call GC_push_all_eager() instead of GC_push_all()
if GC_mark_stack_top is rather close to GC_mark_stack_limit.

mark.c

diff --git a/mark.c b/mark.c
index 969a02b37bce1422d95645dc6dbe77a31b0a46a6..28098829c4933c7be94ab52ee4df33da0911fd8d 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1552,7 +1552,9 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top)
 # if defined(THREADS) && defined(MPROTECT_VDB)
     GC_push_all_eager(bottom, top);
 # else
-    if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) {
+    if (!NEED_FIXUP_POINTER && GC_all_interior_pointers
+          && (word)GC_mark_stack_top
+             < (word)(GC_mark_stack_limit - INITIAL_MARK_STACK_SIZE/8)) {
       GC_push_all(bottom, top);
     } else {
       GC_push_all_eager(bottom, top);