Issue #139 (bdwgc).
* alloc.c (GC_try_to_collect_inner, world_stopped_total_time,
world_stopped_total_divisor, MAX_TOTAL_TIME_DIVISOR, GC_stopped_mark):
Replace "ifndef SMALL_CONFIG" with "ifndef NO_CLOCK".
* reclaim.c (GC_reclaim_all): Likewise.
* alloc.c (GC_finish_collection): Replace "ifndef SMALL_CONFIG" with
"ifndef NO_CLOCK" except for GC_print_finalization_stats invocation.
* doc/README.macros (NO_CLOCK): Document.
* include/private/gc_priv.h (CLOCK_TYPE, GET_TIME, MS_TIME_DIFF): Do
not define if NO_CLOCK.
* include/private/gc_priv.h (GC_print_stats): Define as a macro (to 0)
only if both NO_CLOCK and SMALL_CONFIG are defined.
* misc.c (GC_print_stats): Do not define if both NO_CLOCK and
SMALL_CONFIG are defined.
* misc.c (GC_init): Do not set GC_print_stats only if both NO_CLOCK
and SMALL_CONFIG are defined.
* tests/test.c (run_one_test): Do not define start_time, reverse_time,
time_diff local variables (and do not use GET_TIME, MS_TIME_DIFF) if
NO_CLOCK is defined.
/* Return TRUE if we successfully completed the collection. */
GC_INNER GC_bool GC_try_to_collect_inner(GC_stop_func stop_func)
{
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
# endif
}
}
GC_notify_full_gc();
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats) {
GET_TIME(start_time);
GC_log_printf("Initiating full world-stop collection!\n");
return(FALSE);
}
GC_finish_collection();
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats) {
CLOCK_TYPE current_time;
return(result);
}
-#ifndef SMALL_CONFIG
+#ifndef NO_CLOCK
/* Variables for world-stop average delay time statistic computation. */
/* "divisor" is incremented every world-stop and halved when reached */
/* its maximum (or upon "total_time" overflow). */
/* newer ones). */
# define MAX_TOTAL_TIME_DIVISOR 1000
# endif
-#endif
+#endif /* !NO_CLOCK */
#ifdef USE_MUNMAP
# define IF_USE_MUNMAP(x) x
STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
{
unsigned i;
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
# endif
GC_cond_register_dynamic_libraries();
# endif
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_PRINT_STATS_FLAG)
GET_TIME(start_time);
# endif
GC_on_collection_event(GC_EVENT_POST_START_WORLD);
# endif
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_PRINT_STATS_FLAG) {
unsigned long time_diff;
unsigned total_time, divisor;
/* held, but the world is otherwise running. */
STATIC void GC_finish_collection(void)
{
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
CLOCK_TYPE finalize_time = 0;
# endif
GC_check_tls();
# endif
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats)
GET_TIME(start_time);
# endif
GC_clean_changing_list();
# endif
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats)
GET_TIME(finalize_time);
# endif
if (GC_on_collection_event)
GC_on_collection_event(GC_EVENT_RECLAIM_END);
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats) {
CLOCK_TYPE done_time;
GET_TIME(done_time);
-# ifndef GC_NO_FINALIZATION
+# if !defined(SMALL_CONFIG) && !defined(GC_NO_FINALIZATION)
/* A convenient place to output finalization statistics. */
GC_print_finalization_stats();
# endif
MS_TIME_DIFF(finalize_time,start_time),
MS_TIME_DIFF(done_time,finalize_time));
}
+# elif !defined(SMALL_CONFIG) && !defined(GC_NO_FINALIZATION)
+ if (GC_print_stats)
+ GC_print_finalization_stats();
# endif
}
statistic-printing code. Turns off some optimization algorithms (like data
prefetching in the mark routine).
+NO_CLOCK Do not use system clock. Disables some statistic printing.
+
GC_DISABLE_INCREMENTAL Turn off the incremental collection support.
NO_INCREMENTAL Causes the gctest program to not invoke the incremental
/* */
/*********************************/
+#ifndef NO_CLOCK
#ifdef BSD_TIME
# undef CLOCK_TYPE
# undef GET_TIME
/* Avoid using double type since some targets (like ARM) might */
/* require -lm option for double-to-long conversion. */
#endif /* !BSD_TIME && !MSWIN32 */
+#endif /* !NO_CLOCK */
/* We use bzero and bcopy internally. They may not be available. */
# if defined(SPARC) && defined(SUNOS4)
/* without acquiring the lock. */
#define VERBOSE 2
-#ifndef SMALL_CONFIG
+#if !defined(NO_CLOCK) || !defined(SMALL_CONFIG)
/* GC_print_stats should be visible to extra/MacOS.c. */
extern int GC_print_stats; /* Nonzero generates basic GC log. */
/* VERBOSE generates add'l messages. */
GC_bool GC_quiet = 0; /* used also in pcr_interface.c */
-#ifndef SMALL_CONFIG
+#if !defined(NO_CLOCK) || !defined(SMALL_CONFIG)
int GC_print_stats = 0;
#endif
# ifdef GC_READ_ENV_FILE
GC_envfile_init();
# endif
-# ifndef SMALL_CONFIG
+# if !defined(NO_CLOCK) || !defined(SMALL_CONFIG)
# ifdef GC_PRINT_VERBOSE_STATS
/* This is useful for debugging and profiling on platforms with */
/* missing getenv() (like WinCE). */
GC_print_stats = 1;
}
# endif
-# if (defined(UNIX_LIKE) && !defined(GC_ANDROID_LOG)) \
- || defined(CYGWIN32) || defined(SYMBIAN)
+# endif
+# if ((defined(UNIX_LIKE) && !defined(GC_ANDROID_LOG)) \
+ || defined(CYGWIN32) || defined(SYMBIAN)) && !defined(SMALL_CONFIG)
{
char * file_name = TRUSTED_STRING(GETENV("GC_LOG_FILE"));
# ifdef GC_LOG_TO_FILE_ALWAYS
}
}
}
-# endif
-# endif /* !SMALL_CONFIG */
+# endif
# if !defined(NO_DEBUGGING) && !defined(GC_DUMP_REGULARLY)
if (0 != GETENV("GC_DUMP_REGULARLY")) {
GC_dump_regularly = TRUE;
struct obj_kind * ok;
struct hblk ** rlp;
struct hblk ** rlh;
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
if (GC_print_stats == VERBOSE)
}
}
}
-# ifndef SMALL_CONFIG
+# ifndef NO_CLOCK
if (GC_print_stats == VERBOSE) {
CLOCK_TYPE done_time;
char **z;
char *y = (char *)(GC_word)fail_proc1;
# endif
- CLOCK_TYPE start_time;
- CLOCK_TYPE reverse_time;
- unsigned long time_diff;
+# ifndef NO_CLOCK
+ CLOCK_TYPE start_time;
+ CLOCK_TYPE reverse_time;
+ unsigned long time_diff;
+# endif
# ifndef NO_TEST_HANDLE_FORK
pid_t pid;
int wstatus;
}
# endif
/* Repeated list reversal test. */
+# ifndef NO_CLOCK
GET_TIME(start_time);
+# endif
reverse_test();
+# ifndef NO_CLOCK
if (print_stats) {
GET_TIME(reverse_time);
time_diff = MS_TIME_DIFF(reverse_time, start_time);
GC_log_printf("-------------Finished reverse_test at time %u (%p)\n",
(unsigned) time_diff, (void *)&start_time);
}
+# endif
# ifndef DBG_HDRS_ALL
typed_test();
- if (print_stats) {
- CLOCK_TYPE typed_time;
+# ifndef NO_CLOCK
+ if (print_stats) {
+ CLOCK_TYPE typed_time;
- GET_TIME(typed_time);
- time_diff = MS_TIME_DIFF(typed_time, start_time);
- GC_log_printf("-------------Finished typed_test at time %u (%p)\n",
- (unsigned) time_diff, (void *)&start_time);
- }
+ GET_TIME(typed_time);
+ time_diff = MS_TIME_DIFF(typed_time, start_time);
+ GC_log_printf("-------------Finished typed_test at time %u (%p)\n",
+ (unsigned) time_diff, (void *)&start_time);
+ }
+# endif
# endif /* DBG_HDRS_ALL */
tree_test();
- if (print_stats) {
- CLOCK_TYPE tree_time;
+# ifndef NO_CLOCK
+ if (print_stats) {
+ CLOCK_TYPE tree_time;
- GET_TIME(tree_time);
- time_diff = MS_TIME_DIFF(tree_time, start_time);
- GC_log_printf("-------------Finished tree_test at time %u (%p)\n",
- (unsigned) time_diff, (void *)&start_time);
- }
+ GET_TIME(tree_time);
+ time_diff = MS_TIME_DIFF(tree_time, start_time);
+ GC_log_printf("-------------Finished tree_test at time %u (%p)\n",
+ (unsigned) time_diff, (void *)&start_time);
+ }
+# endif
/* Run reverse_test a second time, so we hopefully notice corruption. */
- reverse_test();
+ reverse_test();
+# ifndef NO_CLOCK
if (print_stats) {
GET_TIME(reverse_time);
time_diff = MS_TIME_DIFF(reverse_time, start_time);
"-------------Finished second reverse_test at time %u (%p)\n",
(unsigned)time_diff, (void *)&start_time);
}
+# endif
/* GC_allocate_ml and GC_need_to_lock are no longer exported, and */
/* AO_fetch_and_add1() may be unavailable to update a counter. */
(void)GC_call_with_alloc_lock(inc_int_counter, &n_tests);
- if (print_stats)
- GC_log_printf("Finished %p\n", (void *)&start_time);
+# ifndef NO_CLOCK
+ if (print_stats)
+ GC_log_printf("Finished %p\n", (void *)&start_time);
+# endif
}
void GC_CALLBACK reachable_objs_counter(void *obj, size_t size,