summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay McCarthy <jay@racket-lang.org>2010-05-18 08:48:07 -0500
committerIvan Maidanski <ivmai@mail.ru>2013-11-03 14:05:49 +0400
commit699974978285def08dda9d57c96649ba5af414f2 (patch)
tree52b16094d52b650ac2e4991387f8f34cfc694853
parentf06ce31964e03d023a5d0b460a8e22279be673a8 (diff)
downloadbdwgc-699974978285def08dda9d57c96649ba5af414f2.tar.gz
Adding clock zero and using to avoid uninit errors
-rw-r--r--alloc.c10
-rw-r--r--include/private/gc_priv.h4
-rw-r--r--reclaim.c2
3 files changed, 11 insertions, 5 deletions
diff --git a/alloc.c b/alloc.c
index 5c7d00ac..3d0169b0 100644
--- 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) \
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 47275f81..95ddb6c2 100644
--- a/include/private/gc_priv.h
+++ b/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 <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))
diff --git a/reclaim.c b/reclaim.c
index 43fdf70e..e8adc322 100644
--- 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)