From 404b6f264994f0b136a4eba3cb5d5060605a226e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 8 May 2018 10:33:48 +0300 Subject: Do not merge dynamic root with the existing static one in add_roots_inner * mark_rts.c [!MSWIN32 && !MSWINCE && !CYGWIN32] (GC_add_roots_inner): If the root already exists and it is static then set the found root to static (if not yet); if dynamic root with the same r_start but different r_tmp is found then add a new root starting from r_end of the found root (instead of extending the found root). --- mark_rts.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'mark_rts.c') diff --git a/mark_rts.c b/mark_rts.c index a179effb..2997024d 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -236,12 +236,18 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp) struct roots * old = (struct roots *)GC_roots_present(b); if (old != 0) { - if ((word)e <= (word)old->r_end) + if ((word)e <= (word)old->r_end) { + old -> r_tmp &= tmp; return; /* already there */ - /* else extend */ - GC_root_size += e - old -> r_end; - old -> r_end = e; - return; + } + if (old -> r_tmp == tmp || !tmp) { + /* Extend the existing root. */ + GC_root_size += e - old -> r_end; + old -> r_end = e; + old -> r_tmp = tmp; + return; + } + b = old -> r_end; } } # endif -- cgit v1.2.1