From e9a32561ae7a176b519ff3bd80fea428b2081ed2 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 14 Dec 2016 01:00:29 +0300 Subject: [PATCH] Do not print n_rescuing_pages value if incremental collections disabled * mark.c (GC_n_rescuing_pages): Do not define if GC_DISABLE_INCREMENTAL and not STUBBORN_ALLOC; refine comment. * mark.c (GC_initiate_gc, GC_push_marked): Do not update GC_n_rescuing_pages if GC_DISABLE_INCREMENTAL and not STUBBORN_ALLOC. * mark.c [ENABLE_DISCLAIM] (GC_push_unconditionally): Likewise. * mark.c (GC_mark_some_inner): Do call GC_COND_LOG_PRINTF for GC_n_rescuing_pages if GC_DISABLE_INCREMENTAL and not STUBBORN_ALLOC. --- mark.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mark.c b/mark.c index 1fd7a66..bdcec3b 100644 --- a/mark.c +++ b/mark.c @@ -95,9 +95,12 @@ GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE; /* let it grow dynamically. */ # endif -STATIC word GC_n_rescuing_pages = 0; +#if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC) + STATIC word GC_n_rescuing_pages = 0; /* Number of dirty pages we marked from */ /* excludes ptrfree pages, etc. */ + /* Used for logging only. */ +#endif GC_INNER size_t GC_mark_stack_size = 0; @@ -246,7 +249,9 @@ GC_INNER void GC_initiate_gc(void) # ifdef CHECKSUMS if (GC_dirty_maintained) GC_check_dirty(); # endif - GC_n_rescuing_pages = 0; +# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC) + GC_n_rescuing_pages = 0; +# endif if (GC_mark_state == MS_NONE) { GC_mark_state = MS_PUSH_RESCUERS; } else if (GC_mark_state != MS_INVALID) { @@ -323,8 +328,11 @@ static void alloc_mark_stack(size_t); } else { scan_ptr = GC_push_next_marked_dirty(scan_ptr); if (scan_ptr == 0) { +# if !defined(GC_DISABLE_INCREMENTAL) \ + || defined(STUBBORN_ALLOC) GC_COND_LOG_PRINTF("Marked from %lu dirty pages\n", (unsigned long)GC_n_rescuing_pages); +# endif GC_push_roots(FALSE, cold_gc_frame); GC_objects_are_marked = TRUE; if (GC_mark_state != MS_INVALID) { @@ -1800,7 +1808,9 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr) /* Some quick shortcuts: */ if ((/* 0 | */ GC_DS_LENGTH) == descr) return; if (GC_block_empty(hhdr)/* nothing marked */) return; - GC_n_rescuing_pages++; +# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC) + GC_n_rescuing_pages++; +# endif GC_objects_are_marked = TRUE; if (sz > MAXOBJBYTES) { lim = h -> hb_body; @@ -1859,7 +1869,9 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr) if ((/* 0 | */ GC_DS_LENGTH) == descr) return; - GC_n_rescuing_pages++; +# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC) + GC_n_rescuing_pages++; +# endif GC_objects_are_marked = TRUE; if (sz > MAXOBJBYTES) lim = h -> hb_body; -- 2.7.4