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
# 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));
}
#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. */
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];
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 */
/* 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
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 */