From: Ivan Maidanski Date: Fri, 22 Jun 2018 22:17:46 +0000 (+0300) Subject: Fix mark stack overflow checking in push_selected X-Git-Tag: v7.6.8~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=087b9f62e0fd5386bd3b25ec3ec9eb2316c02b4a;p=gc Fix mark stack overflow checking in push_selected (a cherry-pick of commit 4685f4de from 'master') * mark.c (GC_push_selected): In case of a danger of mark stack overflow after the first GC_push_all() call then call GC_push_all(bottom, top) and return; remove redundant checking of GC_mark_stack_top at the end of the function (overflow is already checked in GC_push_all). --- diff --git a/mark.c b/mark.c index 26ac9f59..d2ae46cf 100644 --- a/mark.c +++ b/mark.c @@ -1370,6 +1370,11 @@ GC_API void GC_CALL GC_push_all(char *bottom, char *top) return; } if ((*dirty_fn)(h-1)) { + if ((word)(GC_mark_stack_top - GC_mark_stack) + > 3 * GC_mark_stack_size / 4) { + GC_push_all(bottom, top); + return; + } GC_push_all(bottom, (ptr_t)h); } @@ -1390,9 +1395,6 @@ GC_API void GC_CALL GC_push_all(char *bottom, char *top) if ((ptr_t)h != top && (*dirty_fn)(h)) { GC_push_all((ptr_t)h, top); } - if ((word)GC_mark_stack_top >= (word)GC_mark_stack_limit) { - ABORT("Unexpected mark stack overflow"); - } } GC_API void GC_CALL GC_push_conditional(char *bottom, char *top, int all)