2009-09-16 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Wed, 16 Sep 2009 09:08:33 +0000 (09:08 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:46 +0000 (21:06 +0400)
(ivmai127.diff - superseding diff49)

* alloc.c (GC_finish_collection): Call GC_print_finalization_stats
if GC_print_stats (after getting "done_time").
* finalize.c (GC_old_dl_entries): New static variable (only if not
SMALL_CONFIG).
* finalize.c (GC_finalize): Save current GC_dl_entries value (only
if not SMALL_CONFIG).
* finalize.c (GC_print_finalization_stats): Define if and only if
not SMALL_CONFIG; use GC_old_dl_entries value; use GC_log_printf()
instead of GC_printf(); use "%lu" (instead of "%u") print format
specifier; use unsigned long type for "ready" counter (for LP64
targets).
* misc.c (GC_dump): No longer call GC_print_finalization_stats()
here (since it is called from GC_finish_collection()).
* misc.c (STACKBASE): Remove unused macro undef (for NOSYS and
ECOS).

ChangeLog
alloc.c
finalize.c
misc.c

index 1cbd312..6c7e6e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,23 @@
 2009-09-16  Ivan Maidanski <ivmai@mail.ru>
+       (ivmai127.diff - superseding diff49)
+
+       * alloc.c (GC_finish_collection): Call GC_print_finalization_stats
+       if GC_print_stats (after getting "done_time").
+       * finalize.c (GC_old_dl_entries): New static variable (only if not
+       SMALL_CONFIG).
+       * finalize.c (GC_finalize): Save current GC_dl_entries value (only
+       if not SMALL_CONFIG).
+       * finalize.c (GC_print_finalization_stats): Define if and only if
+       not SMALL_CONFIG; use GC_old_dl_entries value; use GC_log_printf()
+       instead of GC_printf(); use "%lu" (instead of "%u") print format
+       specifier; use unsigned long type for "ready" counter (for LP64
+       targets).
+       * misc.c (GC_dump): No longer call GC_print_finalization_stats()
+       here (since it is called from GC_finish_collection()).
+       * misc.c (STACKBASE): Remove unused macro undef (for NOSYS and
+       ECOS).
+
+2009-09-16  Ivan Maidanski <ivmai@mail.ru>
        (ivmai134.diff)
 
        * alloc.c (GC_expand_hp): Replace GC_init_inner() call with
diff --git a/alloc.c b/alloc.c
index 00f2ce0..eadd8b5 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -832,6 +832,10 @@ STATIC void GC_finish_collection(void)
 #   ifndef SMALL_CONFIG
       if (GC_print_stats) {
        GET_TIME(done_time);
+
+       /* A convenient place to output finalization statistics. */
+       GC_print_finalization_stats();
+
        GC_log_printf("Finalize + initiate sweep took %lu + %lu msecs\n",
                      MS_TIME_DIFF(finalize_time,start_time),
                      MS_TIME_DIFF(done_time,finalize_time));
index 032ec04..287030a 100644 (file)
@@ -459,6 +459,10 @@ void GC_dump_finalization(void)
 }
 #endif
 
+#ifndef SMALL_CONFIG
+  STATIC word GC_old_dl_entries; /* for stats printing */
+#endif
+
 extern unsigned GC_fail_count;
                        /* How many consecutive GC/expansion failures?  */
                        /* Reset by GC_allochblk(); defined in alloc.c. */
@@ -505,6 +509,11 @@ void GC_finalize(void)
     size_t dl_size = (log_dl_table_size == -1 ) ? 0 : (1 << log_dl_table_size);
     size_t fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size);
     
+#   ifndef SMALL_CONFIG
+      /* Save current GC_dl_entries value for stats printing */
+      GC_old_dl_entries = GC_dl_entries;
+#   endif
+
   /* Make disappearing links disappear */
     for (i = 0; i < dl_size; i++) {
       curr_dl = dl_head[i];
@@ -897,17 +906,20 @@ GC_API void * GC_CALL GC_call_with_alloc_lock(GC_fn_type fn,
     return(result);
 }
 
-#if !defined(NO_DEBUGGING)
+#ifndef SMALL_CONFIG
 
 void GC_print_finalization_stats(void)
 {
     struct finalizable_object *fo = GC_finalize_now;
-    unsigned ready = 0;
+    unsigned long ready = 0;
 
-    GC_printf("%u finalization table entries; %u disappearing links\n",
-              (unsigned)GC_fo_entries, (unsigned)GC_dl_entries);
+    GC_log_printf(
+       "%lu finalization table entries; %lu disappearing links alive\n",
+       (unsigned long)GC_fo_entries, (unsigned long)GC_dl_entries);
     for (; 0 != fo; fo = fo_next(fo)) ++ready;
-    GC_printf("%u objects are eligible for immediate finalization\n", ready);
+    GC_log_printf("%lu objects are eligible for immediate finalization; "
+                 "%ld links cleared\n",
+                 ready, (long)GC_old_dl_entries - (long)GC_dl_entries);
 }
 
-#endif /* NO_DEBUGGING */
+#endif /* SMALL_CONFIG */
diff --git a/misc.c b/misc.c
index 0949cc2..a781169 100644 (file)
--- a/misc.c
+++ b/misc.c
 /* For other platforms with threads, the lock and possibly             */
 /* GC_lock_holder variables are defined in the thread support code.    */
 
-#if defined(NOSYS) || defined(ECOS)
-#undef STACKBASE
-#endif
-
 /* Dont unnecessarily call GC_register_main_static_data() in case      */
 /* dyn_load.c isn't linked in.                                         */
 #ifdef DYNAMIC_LOADING
@@ -1328,8 +1324,6 @@ GC_API void GC_CALL GC_dump(void)
     GC_print_hblkfreelist();
     GC_printf("\n***Blocks in use:\n");
     GC_print_block_list();
-    GC_printf("\n***Finalization statistics:\n");
-    GC_print_finalization_stats();
 }
 
 #endif /* NO_DEBUGGING */