From 72afdc7d797d58f34c808235555d3e32b14cbad4 Mon Sep 17 00:00:00 2001 From: ivmai Date: Thu, 1 Oct 2009 21:13:37 +0000 Subject: [PATCH] 2009-10-01 Ivan Maidanski (really mostly Andreas Tobler) * allchblk.c (GC_fail_count, GC_large_alloc_warn_interval): Add "extern" keyword to a global variable declaration (some compilers require it). * alloc.c (GC_bytes_found, GC_unmap_threshold, GC_force_unmap_on_gcollect): Ditto. * dyn_load.c (GC_no_win32_dlls, GC_wnt): Ditto. * finalize.c (GC_fail_count): Ditto. * include/private/gc_hdrs.h (GC_hdr_cache_hits, GC_hdr_cache_misses): Ditto. * mallocx.c (GC_bytes_found): Ditto. * mark_rts.c (GC_save_regs_ret_val, GC_world_stopped): Ditto. * misc.c (GC_unmap_threshold): Ditto. * os_dep.c (GC_unmap_threshold, GC_old_allocator): Ditto. * pthread_support.c (GC_markers): Ditto. * thread_local_alloc.c (GC_gcjobjfreelist, GC_gcj_malloc_initialized, GC_gcj_kind): Ditto. * win32_threads.c (GC_fault_handler_lock, GC_write_cs, GC_dont_query_stack_min, GC_markers, GC_wnt): Ditto. --- ChangeLog | 21 +++++++++++++++++++++ allchblk.c | 4 ++-- alloc.c | 7 ++++--- dyn_load.c | 6 +++--- finalize.c | 2 +- include/private/gc_hdrs.h | 4 ++-- mallocx.c | 3 ++- mark_rts.c | 4 ++-- misc.c | 2 +- os_dep.c | 5 +++-- pthread_support.c | 2 +- thread_local_alloc.c | 6 +++--- win32_threads.c | 13 +++++++------ 13 files changed, 52 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7c077f..48ced25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2009-10-01 Ivan Maidanski (really mostly Andreas Tobler) + + * allchblk.c (GC_fail_count, GC_large_alloc_warn_interval): Add + "extern" keyword to a global variable declaration (some compilers + require it). + * alloc.c (GC_bytes_found, GC_unmap_threshold, + GC_force_unmap_on_gcollect): Ditto. + * dyn_load.c (GC_no_win32_dlls, GC_wnt): Ditto. + * finalize.c (GC_fail_count): Ditto. + * include/private/gc_hdrs.h (GC_hdr_cache_hits, + GC_hdr_cache_misses): Ditto. + * mallocx.c (GC_bytes_found): Ditto. + * mark_rts.c (GC_save_regs_ret_val, GC_world_stopped): Ditto. + * misc.c (GC_unmap_threshold): Ditto. + * os_dep.c (GC_unmap_threshold, GC_old_allocator): Ditto. + * pthread_support.c (GC_markers): Ditto. + * thread_local_alloc.c (GC_gcjobjfreelist, + GC_gcj_malloc_initialized, GC_gcj_kind): Ditto. + * win32_threads.c (GC_fault_handler_lock, GC_write_cs, + GC_dont_query_stack_min, GC_markers, GC_wnt): Ditto. + 2009-10-01 Ivan Maidanski * Makefile.in: Regenerate (by autoreconf -vif, deleting libtool.m4 diff --git a/allchblk.c b/allchblk.c index 6446ade..70ce161 100644 --- a/allchblk.c +++ b/allchblk.c @@ -628,9 +628,9 @@ GC_allochblk(size_t sz, int kind, unsigned flags/* IGNORE_OFF_PAGE or 0 */) return 0; } -unsigned GC_fail_count; /* defined in alloc.c */ +extern unsigned GC_fail_count; /* defined in alloc.c */ -long GC_large_alloc_warn_interval; /* defined in misc.c */ +extern long GC_large_alloc_warn_interval; /* defined in misc.c */ STATIC long GC_large_alloc_warn_suppressed = 0; /* Number of warnings suppressed so far. */ diff --git a/alloc.c b/alloc.c index 350b043..418afb1 100644 --- a/alloc.c +++ b/alloc.c @@ -105,7 +105,8 @@ GC_API unsigned GC_CALL GC_get_version(void) /* some more variables */ -signed_word GC_bytes_found; /* Number of reclaimed bytes */ +extern signed_word GC_bytes_found; + /* Number of reclaimed bytes */ /* after garbage collection; */ /* defined in reclaim.c. */ @@ -904,8 +905,8 @@ STATIC void GC_finish_collection(void) } #ifdef USE_MUNMAP - int GC_unmap_threshold; /* defined in allchblk.c */ - GC_bool GC_force_unmap_on_gcollect; /* defined in misc.c */ + extern int GC_unmap_threshold; /* defined in allchblk.c */ + extern GC_bool GC_force_unmap_on_gcollect; /* defined in misc.c */ #endif /* Externally callable routine to invoke full, stop-world collection */ diff --git a/dyn_load.c b/dyn_load.c index 8539172..b4f733e 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -835,7 +835,7 @@ void GC_register_dynamic_libraries(void) return FALSE; } # else /* win32 */ - GC_bool GC_no_win32_dlls; + extern GC_bool GC_no_win32_dlls; /* defined in os_dep.c */ GC_bool GC_register_main_static_data(void) { @@ -867,8 +867,8 @@ void GC_register_dynamic_libraries(void) /* To workaround that, use -DGC_REGISTER_MEM_PRIVATE. */ # define GC_wnt TRUE # else - GC_bool GC_wnt; /* Is Windows NT derivative. */ - /* Defined and set in os_dep.c. */ + extern GC_bool GC_wnt; /* Is Windows NT derivative. */ + /* Defined and set in os_dep.c. */ # endif void GC_register_dynamic_libraries(void) diff --git a/finalize.c b/finalize.c index bda054e..fbd1826 100644 --- a/finalize.c +++ b/finalize.c @@ -493,7 +493,7 @@ void GC_dump_finalization(void) STATIC word GC_old_dl_entries = 0; /* for stats printing */ #endif -unsigned GC_fail_count; +extern unsigned GC_fail_count; /* How many consecutive GC/expansion failures? */ /* Reset by GC_allochblk(); defined in alloc.c. */ diff --git a/include/private/gc_hdrs.h b/include/private/gc_hdrs.h index 4ed3c26..1e5845d 100644 --- a/include/private/gc_hdrs.h +++ b/include/private/gc_hdrs.h @@ -57,8 +57,8 @@ typedef struct hblkhdr hdr; /* #define COUNT_HDR_CACHE_HITS */ # ifdef COUNT_HDR_CACHE_HITS - word GC_hdr_cache_hits; - word GC_hdr_cache_misses; + extern word GC_hdr_cache_hits; + extern word GC_hdr_cache_misses; # define HC_HIT() ++GC_hdr_cache_hits # define HC_MISS() ++GC_hdr_cache_misses # else diff --git a/mallocx.c b/mallocx.c index f46395c..5d04081 100644 --- a/mallocx.c +++ b/mallocx.c @@ -234,7 +234,8 @@ GC_API void GC_CALL GC_incr_bytes_freed(size_t n) #if defined(THREADS) -signed_word GC_bytes_found; /* protected by GC lock; defined in reclaim.c */ +extern signed_word GC_bytes_found; + /* protected by GC lock; defined in reclaim.c. */ #ifdef PARALLEL_MARK volatile signed_word GC_bytes_allocd_tmp = 0; diff --git a/mark_rts.c b/mark_rts.c index b0944d6..0dd25ad 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -607,7 +607,7 @@ STATIC void GC_push_all_stack_part_eager_frames(ptr_t lo, ptr_t hi, } # ifdef IA64 - ptr_t GC_save_regs_ret_val; /* defined in mach_dep.c. */ + extern ptr_t GC_save_regs_ret_val; /* defined in mach_dep.c. */ /* Previously set to backing store pointer. */ # endif @@ -716,7 +716,7 @@ STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame) } #ifdef THREAD_LOCAL_ALLOC - GC_bool GC_world_stopped; /* defined in alloc.c */ + extern GC_bool GC_world_stopped; /* defined in alloc.c */ #endif /* diff --git a/misc.c b/misc.c index 54709b0..440c49b 100644 --- a/misc.c +++ b/misc.c @@ -513,7 +513,7 @@ static void maybe_install_looping_handler(void) #endif #ifdef USE_MUNMAP - int GC_unmap_threshold; /* defined in allchblk.c */ + extern int GC_unmap_threshold; /* defined in allchblk.c */ #endif #ifdef LINT diff --git a/os_dep.c b/os_dep.c index 6fda51e..db049ed 100644 --- a/os_dep.c +++ b/os_dep.c @@ -1415,7 +1415,7 @@ void GC_register_data_segments(void) /* This is a Windows NT derivative, i.e. NT, W2K, XP or later. */ # ifdef USE_MUNMAP - int GC_unmap_threshold; /* defined in allchblk.c */ + extern int GC_unmap_threshold; /* defined in allchblk.c */ # endif void GC_init_win32(void) @@ -2249,7 +2249,8 @@ PCR_ERes GC_push_old_obj(void *p, size_t size, PCR_Any data) return(PCR_ERes_okay); } -struct PCR_MM_ProcsRep * GC_old_allocator; /* defined in pcr_interface.c */ +extern struct PCR_MM_ProcsRep * GC_old_allocator; + /* defined in pcr_interface.c. */ void GC_default_push_other_roots(void) { diff --git a/pthread_support.c b/pthread_support.c index bf3269a..02e4202 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -309,7 +309,7 @@ STATIC void * GC_mark_thread(void * id) } } -long GC_markers; /* Number of mark threads we would like to */ +extern long GC_markers; /* Number of mark threads we would like to */ /* have. Includes the initiating thread. */ /* Defined in mark.c. */ diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 03a82d8..3a145cd 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -111,7 +111,7 @@ void GC_init_thread_local(GC_tlfs p) } #ifdef GC_GCJ_SUPPORT - ptr_t * GC_gcjobjfreelist; /* defined in gcj_mlc.c. */ + extern ptr_t * GC_gcjobjfreelist; /* defined in gcj_mlc.c. */ #endif /* We hold the allocator lock. */ @@ -208,10 +208,10 @@ GC_API void * GC_CALL GC_malloc_atomic(size_t bytes) #include "include/gc_gcj.h" #ifdef GC_ASSERTIONS - GC_bool GC_gcj_malloc_initialized; /* defined in gcj_mlc.c. */ + extern GC_bool GC_gcj_malloc_initialized; /* defined in gcj_mlc.c. */ #endif -int GC_gcj_kind; /* defined in gcj_mlc.c. */ +extern int GC_gcj_kind; /* defined in gcj_mlc.c. */ /* Gcj-style allocation without locks is extremely tricky. The */ /* fundamental issue is that we may end up marking a free list, which */ diff --git a/win32_threads.c b/win32_threads.c index b12742d..6b447ab 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -921,7 +921,7 @@ void GC_push_thread_structures(void) #if defined(MPROTECT_VDB) # include "atomic_ops.h" - volatile AO_TS_t GC_fault_handler_lock; /* from os_dep.c */ + extern volatile AO_TS_t GC_fault_handler_lock; /* defined in os_dep.c */ #endif /* Suspend the given thread, if it's still active. */ @@ -974,7 +974,7 @@ STATIC void GC_suspend(GC_thread t) } #ifndef CYGWIN32 - CRITICAL_SECTION GC_write_cs; /* defined in misc.c */ + extern CRITICAL_SECTION GC_write_cs; /* defined in misc.c */ #endif void GC_stop_world(void) @@ -1075,7 +1075,8 @@ void GC_start_world(void) } #ifdef MSWINCE - GC_bool GC_dont_query_stack_min; /* defined and set in os_dep.c */ + extern GC_bool GC_dont_query_stack_min; + /* Defined and set in os_dep.c. */ /* The VirtualQuery calls below won't work properly on some old WinCE */ /* versions, but since each stack is restricted to an aligned 64 KiB */ @@ -1324,7 +1325,8 @@ void GC_push_all_stacks(void) # define MAX_MARKERS 16 # endif - long GC_markers; /* Number of mark threads we would like to */ + extern long GC_markers; + /* Number of mark threads we would like to */ /* have. Includes the initiating thread. */ /* Defined in mark.c. */ @@ -1937,8 +1939,7 @@ void GC_get_next_stack(char *start, char *limit, # endif /* !DONT_USE_SIGNALANDWAIT */ # ifndef MSWINCE - /* Defined in os_dep.c */ - GC_bool GC_wnt; + extern GC_bool GC_wnt; /* defined in os_dep.c */ # endif # endif /* ! GC_PTHREADS_PARAMARK */ -- 2.7.4