]> granicus.if.org Git - gc/commitdiff
Prepend '#' symbol to GC number in logged messages
authorIvan Maidanski <ivmai@mail.ru>
Mon, 10 Dec 2012 16:14:43 +0000 (20:14 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 10 Dec 2012 16:14:43 +0000 (20:14 +0400)
* alloc.c (GC_maybe_gc, GC_stopped_mark): Put '#' sign in printed
messages preceding GC_gc_no value (to identify it as a collection
number).
* include/private/gc_pmark.h (PUSH_CONTENTS_HDR): Likewise.
* malloc.c (GC_free): Likewise.
* mark.c (GC_mark_from): Likewise.
* thread_local_alloc.c (GC_malloc): Likewise.

alloc.c
include/private/gc_pmark.h
malloc.c
mark.c
thread_local_alloc.c

diff --git a/alloc.c b/alloc.c
index 925c53bbefc16b4442f8579f46f17d812e7242a6..97f88916d93e918c80791a90eef4fd0029722510 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -367,7 +367,7 @@ STATIC void GC_maybe_gc(void)
 #         endif
           if (GC_need_full_gc || n_partial_gcs >= GC_full_freq) {
             GC_COND_LOG_PRINTF(
-                "***>Full mark for collection %lu after %lu allocd bytes\n",
+                "***>Full mark for collection #%lu after %lu allocd bytes\n",
                 (unsigned long)GC_gc_no + 1, (unsigned long)GC_bytes_allocd);
             GC_promote_black_lists();
             (void)GC_reclaim_all((GC_stop_func)0, TRUE);
@@ -609,7 +609,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
 #   endif
         /* Output blank line for convenience here */
     GC_COND_LOG_PRINTF(
-              "\n--> Marking for collection %lu after %lu allocated bytes\n",
+              "\n--> Marking for collection #%lu after %lu allocated bytes\n",
               (unsigned long)GC_gc_no + 1, (unsigned long) GC_bytes_allocd);
 #   ifdef MAKE_BACK_GRAPH
       if (GC_print_back_height) {
@@ -638,7 +638,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
         }
 
     GC_gc_no++;
-    GC_COND_LOG_PRINTF("GC %lu reclaimed %ld bytes --> heapsize: %lu"
+    GC_COND_LOG_PRINTF("GC #%lu reclaimed %ld bytes --> heapsize: %lu"
                        " bytes" IF_USE_MUNMAP(" (%lu unmapped)") "\n",
                        (unsigned long)GC_gc_no, (long)GC_bytes_found,
                        (unsigned long)GC_heapsize /*, */
index def4a91799d00fbad891b868ab0f5c6248b13f32..e1a21781c407de89341d3c0eeaf1b3bb0af2516d 100644 (file)
@@ -287,13 +287,13 @@ exit_label: ; \
     } \
     GC_ASSERT(hhdr == GC_find_header(base)); \
     GC_ASSERT(gran_displ % BYTES_TO_GRANULES(hhdr -> hb_sz) == 0); \
-    TRACE(source, GC_log_printf("GC:%u: passed validity tests\n", \
+    TRACE(source, GC_log_printf("GC #%u: passed validity tests\n", \
                                 (unsigned)GC_gc_no)); \
     SET_MARK_BIT_EXIT_IF_SET(hhdr, gran_displ, exit_label); \
-    TRACE(source, GC_log_printf("GC:%u: previously unmarked\n", \
+    TRACE(source, GC_log_printf("GC #%u: previously unmarked\n", \
                                 (unsigned)GC_gc_no)); \
     TRACE_TARGET(base, \
-        GC_log_printf("GC:%u: marking %p from %p instead\n", \
+        GC_log_printf("GC #%u: marking %p from %p instead\n", \
                       (unsigned)GC_gc_no, base, source)); \
     INCR_MARKS(hhdr); \
     GC_STORE_BACK_PTR((ptr_t)source, base); \
@@ -344,13 +344,13 @@ exit_label: ; \
     /* May get here for pointer to start of block not at        */ \
     /* beginning of object.  If so, it's valid, and we're fine. */ \
     GC_ASSERT(high_prod >= 0 && high_prod <= HBLK_OBJS(hhdr -> hb_sz)); \
-    TRACE(source, GC_log_printf("GC:%u: passed validity tests\n", \
+    TRACE(source, GC_log_printf("GC #%u: passed validity tests\n", \
                                 (unsigned)GC_gc_no)); \
     SET_MARK_BIT_EXIT_IF_SET(hhdr, high_prod, exit_label); \
-    TRACE(source, GC_log_printf("GC:%u: previously unmarked\n", \
+    TRACE(source, GC_log_printf("GC #%u: previously unmarked\n", \
                                 (unsigned)GC_gc_no)); \
     TRACE_TARGET(base, \
-        GC_log_printf("GC:%u: marking %p from %p instead\n", \
+        GC_log_printf("GC #%u: marking %p from %p instead\n", \
                       (unsigned)GC_gc_no, base, source)); \
     INCR_MARKS(hhdr); \
     GC_STORE_BACK_PTR((ptr_t)source, base); \
index c10f60aeedcb2b05be824c2a964587f82a9bcf7f..969dbc3ad041a1beff938ad9207c0c413cda98c2 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -494,7 +494,8 @@ GC_API void GC_CALL GC_free(void * p)
     if (p == 0) return;
         /* Required by ANSI.  It's not my fault ...     */
 #   ifdef LOG_ALLOCS
-      GC_log_printf("GC_free(%p), GC: %lu\n", p, (unsigned long)GC_gc_no);
+      GC_log_printf("GC_free(%p) after GC #%lu\n",
+                    p, (unsigned long)GC_gc_no);
 #   endif
     h = HBLKPTR(p);
     hhdr = HDR(h);
diff --git a/mark.c b/mark.c
index e941abf8feb442af9f604f224ef94f760d0a44e5..94f5dd0884d60af260e59543dfc109e95d33aeef 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -651,7 +651,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
 #         ifdef ENABLE_TRACE
             if ((word)GC_trace_addr >= (word)current_p
                 && (word)GC_trace_addr < (word)(current_p + descr)) {
-              GC_log_printf("GC:%u Large section; start %p len %lu\n",
+              GC_log_printf("GC #%u: large section; start %p, len %lu\n",
                         (unsigned)GC_gc_no, current_p, (unsigned long)descr);
             }
 #         endif /* ENABLE_TRACE */
@@ -668,7 +668,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
 #             ifdef ENABLE_TRACE
                 if ((word)GC_trace_addr >= (word)current_p
                     && (word)GC_trace_addr < (word)(current_p + descr)) {
-                  GC_log_printf("GC:%u Splitting (parallel) %p at %p\n",
+                  GC_log_printf("GC #%u: splitting (parallel) %p at %p\n",
                         (unsigned)GC_gc_no, current_p, current_p + new_size);
                 }
 #             endif /* ENABLE_TRACE */
@@ -684,7 +684,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
 #         ifdef ENABLE_TRACE
             if ((word)GC_trace_addr >= (word)current_p
                 && (word)GC_trace_addr < (word)(current_p + descr)) {
-              GC_log_printf("GC:%u Splitting %p at %p\n",
+              GC_log_printf("GC #%u: splitting %p at %p\n",
                             (unsigned)GC_gc_no, current_p, limit);
             }
 #         endif /* ENABLE_TRACE */
@@ -698,8 +698,9 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
             if ((word)GC_trace_addr >= (word)current_p
                 && (word)GC_trace_addr < (word)(current_p
                                                 + WORDS_TO_BYTES(WORDSZ-2))) {
-              GC_log_printf("GC:%u Tracing from %p bitmap descr %lu\n",
-                        (unsigned)GC_gc_no, current_p, (unsigned long)descr);
+              GC_log_printf("GC #%u: tracing from %p bitmap descr %lu\n",
+                            (unsigned)GC_gc_no, current_p,
+                            (unsigned long)descr);
             }
 #         endif /* ENABLE_TRACE */
           descr &= ~GC_DS_TAGS;
@@ -712,8 +713,9 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
                 PREFETCH((ptr_t)current);
 #               ifdef ENABLE_TRACE
                   if (GC_trace_addr == current_p) {
-                    GC_log_printf("GC:%u Considering(3) %p -> %p\n",
-                               (unsigned)GC_gc_no, current_p, (ptr_t)current);
+                    GC_log_printf("GC #%u: considering(3) %p -> %p\n",
+                                  (unsigned)GC_gc_no, current_p,
+                                  (ptr_t)current);
                   }
 #               endif /* ENABLE_TRACE */
                 PUSH_CONTENTS((ptr_t)current, mark_stack_top,
@@ -730,8 +732,9 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
             if ((word)GC_trace_addr >= (word)current_p
                 && GC_base(current_p) != 0
                 && GC_base(current_p) == GC_base(GC_trace_addr)) {
-              GC_log_printf("GC:%u Tracing from %p proc descr %lu\n",
-                        (unsigned)GC_gc_no, current_p, (unsigned long)descr);
+              GC_log_printf("GC #%u: tracing from %p, proc descr %lu\n",
+                            (unsigned)GC_gc_no, current_p,
+                            (unsigned long)descr);
             }
 #         endif /* ENABLE_TRACE */
           credit -= GC_PROC_BYTES;
@@ -782,7 +785,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
 #   ifdef ENABLE_TRACE
         if ((word)GC_trace_addr >= (word)current_p
             && (word)GC_trace_addr < (word)limit) {
-          GC_log_printf("GC:%u Tracing from %p, length is %lu\n",
+          GC_log_printf("GC #%u: Tracing from %p, length is %lu\n",
                         (unsigned)GC_gc_no, current_p, (unsigned long)descr);
         }
 #   endif /* ENABLE_TRACE */
@@ -839,7 +842,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
           PREFETCH((ptr_t)current);
 #         ifdef ENABLE_TRACE
             if (GC_trace_addr == current_p) {
-              GC_log_printf("GC:%u Considering(1) %p -> %p\n",
+              GC_log_printf("GC #%u: considering(1) %p -> %p\n",
                             (unsigned)GC_gc_no, current_p, (ptr_t)current);
             }
 #         endif /* ENABLE_TRACE */
@@ -855,7 +858,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
         /* validity test.                                               */
 #       ifdef ENABLE_TRACE
             if (GC_trace_addr == current_p) {
-              GC_log_printf("GC:%u Considering(2) %p -> %p\n",
+              GC_log_printf("GC #%u: considering(2) %p -> %p\n",
                             (unsigned)GC_gc_no, current_p, (ptr_t)deferred);
             }
 #       endif /* ENABLE_TRACE */
index e4fdc854dde70bcd888bb72d16e45e953217bb41..a35b0c3f5ae2552252b1c4c84cc17117d88f3242 100644 (file)
@@ -175,7 +175,7 @@ GC_API void * GC_CALL GC_malloc(size_t bytes)
     GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
                          NORMAL, GC_core_malloc(bytes), obj_link(result)=0);
 #   ifdef LOG_ALLOCS
-      GC_log_printf("GC_malloc(%lu) = %p, GC: %lu\n",
+      GC_log_printf("GC_malloc(%lu) returned %p, recent GC #%lu\n",
                     (unsigned long)bytes, result, (unsigned long)GC_gc_no);
 #   endif
     return result;