Do not print n_rescuing_pages value if incremental collections disabled
authorIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2016 22:00:29 +0000 (01:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 13 Dec 2016 22:02:44 +0000 (01:02 +0300)
* 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

diff --git a/mark.c b/mark.c
index 1fd7a66..bdcec3b 100644 (file)
--- 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;