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: v8.0.0~96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4685f4de;p=gc Fix mark stack overflow checking in push_selected * 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 b9f43dd0..d5fae4e6 100644 --- a/mark.c +++ b/mark.c @@ -1383,6 +1383,11 @@ GC_API void GC_CALL GC_push_all(void *bottom, void *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, h); } @@ -1403,9 +1408,6 @@ GC_API void GC_CALL GC_push_all(void *bottom, void *top) if ((ptr_t)h != top && (*dirty_fn)(h)) { GC_push_all(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(void *bottom, void *top, int all)