From 43d1494aef45c359d68d8048474a4a0b8c23e70f Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 18 May 2010 08:48:07 -0500 Subject: [PATCH] Adding clock zero and using to avoid uninit errors --- src/racket/gc/alloc.c | 10 ++++++---- src/racket/gc/include/private/gc_priv.h | 4 ++++ src/racket/gc/reclaim.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/racket/gc/alloc.c b/src/racket/gc/alloc.c index 5c7d00ac2f..3d0169b038 100644 --- a/src/racket/gc/alloc.c +++ b/src/racket/gc/alloc.c @@ -334,7 +334,8 @@ GC_collect_end_callback_Proc GC_set_collect_end_callback(GC_collect_end_callback */ GC_bool GC_try_to_collect_inner(GC_stop_func stop_func) { - CLOCK_TYPE start_time, current_time; + CLOCK_TYPE start_time = CLOCK_ZERO; + CLOCK_TYPE current_time; if (GC_dont_gc) return FALSE; /* PLTSCHEME */ if (GC_collect_start_callback) @@ -481,7 +482,8 @@ GC_bool GC_stopped_mark(GC_stop_func stop_func) { unsigned i; int dummy; - CLOCK_TYPE start_time, current_time; + CLOCK_TYPE start_time = CLOCK_ZERO; + CLOCK_TYPE current_time; if (GC_print_stats) GET_TIME(start_time); @@ -634,8 +636,8 @@ extern void GC_check_tls(void); /* but the world is otherwise running. */ void GC_finish_collection() { - CLOCK_TYPE start_time; - CLOCK_TYPE finalize_time; + CLOCK_TYPE start_time = CLOCK_ZERO; + CLOCK_TYPE finalize_time = CLOCK_ZERO; CLOCK_TYPE done_time; # if defined(GC_ASSERTIONS) && defined(THREADS) \ diff --git a/src/racket/gc/include/private/gc_priv.h b/src/racket/gc/include/private/gc_priv.h index 47275f815d..95ddb6c2e1 100644 --- a/src/racket/gc/include/private/gc_priv.h +++ b/src/racket/gc/include/private/gc_priv.h @@ -230,9 +230,11 @@ void GC_print_callers(struct callinfo info[NFRAMES]); #ifdef BSD_TIME # undef CLOCK_TYPE +# undef CLOCK_ZERO # undef GET_TIME # undef MS_TIME_DIFF # define CLOCK_TYPE struct timeval +# define CLOCK_ZERO {0, 0} # define GET_TIME(x) { struct rusage rusage; \ getrusage (RUSAGE_SELF, &rusage); \ x = rusage.ru_utime; } @@ -243,6 +245,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]); # include # include # define CLOCK_TYPE DWORD +# define CLOCK_ZERO 0 # define GET_TIME(x) x = GetTickCount() # define MS_TIME_DIFF(a,b) ((long)((a)-(b))) # else /* !MSWIN32, !MSWINCE, !BSD_TIME */ @@ -268,6 +271,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]); */ # endif # define CLOCK_TYPE clock_t +# define CLOCK_ZERO 0 # define GET_TIME(x) x = clock() # define MS_TIME_DIFF(a,b) ((unsigned long) \ (1000.0*(double)((a)-(b))/(double)CLOCKS_PER_SEC)) diff --git a/src/racket/gc/reclaim.c b/src/racket/gc/reclaim.c index 43fdf70e4c..e8adc32291 100644 --- a/src/racket/gc/reclaim.c +++ b/src/racket/gc/reclaim.c @@ -574,7 +574,7 @@ GC_bool GC_reclaim_all(GC_stop_func stop_func, GC_bool ignore_old) struct obj_kind * ok; struct hblk ** rlp; struct hblk ** rlh; - CLOCK_TYPE start_time; + CLOCK_TYPE start_time = CLOCK_ZERO; CLOCK_TYPE done_time; if (GC_print_stats == VERBOSE)