]> granicus.if.org Git - gc/commitdiff
Adding clock zero and using to avoid uninit errors
authorJay McCarthy <jay@racket-lang.org>
Tue, 18 May 2010 13:48:07 +0000 (08:48 -0500)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 3 Nov 2013 10:05:49 +0000 (14:05 +0400)
alloc.c
include/private/gc_priv.h
reclaim.c

diff --git a/alloc.c b/alloc.c
index 5c7d00ac2fe68071dd01281260cdb0653acb132b..3d0169b038518c406ffbd87d9b6d0049a45b1894 100644 (file)
--- a/alloc.c
+++ b/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) \
index 47275f815d559511779d05ca4c1069232a49e50b..95ddb6c2e127d5f32814b29123088631a093f8d1 100644 (file)
@@ -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 <windows.h>
 #   include <winbase.h>
 #   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))
index 43fdf70e4c98e8d2e3d5aafd24a09d261df25c95..e8adc3229124f933c706e7b320fa6c01a55ff690 100644 (file)
--- a/reclaim.c
+++ b/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)