2009-09-27 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sun, 27 Sep 2009 15:06:46 +0000 (15:06 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:48 +0000 (21:06 +0400)
* allchblk.c (GC_hblkfreelist): Define as STATIC.
* blacklst.c (GC_total_stack_black_listed): Ditto.
* include/private/gc_priv.h (GC_hblkfreelist, GC_stopped_mark,
GC_total_stack_black_listed, GC_push_stubborn_structures): Remove
declaration.
* mark_rts.c (GC_stopped_mark): Add declaration (only if
THREAD_LOCAL_ALLOC).
* allchblk.c (GC_fail_count): Move the declaration out of
GC_allochblk_nth(); remove "extern".
* alloc.c (IF_THREADS): Remove unused macro.
* alloc.c (GC_world_stopped): Define only if THREAD_LOCAL_ALLOC.
* alloc.c (GC_stopped_mark): Set GC_world_stopped value only if
THREAD_LOCAL_ALLOC.
* alloc.c (GC_bytes_found, GC_collection_in_progress,
GC_check_tls, GC_unmap_threshold, GC_force_unmap_on_gcollect):
Remove K&R-style "extern" for the declaration.
* dbg_mlc.c (GC_free_inner): Ditto.
* dyn_load.c (GC_repeat_read, GC_roots_present, GC_is_heap_base,
GC_get_next_stack, 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.
* include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder,
GC_lock, GC_collecting, GC_mark_lock_holder, GC_need_to_lock):
Ditto.
* include/private/gc_pmark.h (GC_mark_procs, GC_n_mark_procs,
GC_mark_stack_size, GC_mark_stack_limit, GC_mark_stack_top,
GC_mark_stack, GC_mark_stack_too_small, GC_mark_state): Ditto.
* include/private/gc_priv.h (GC_current_warn_proc, GC_obj_kinds,
GC_n_kinds, GC_fo_entries, GC_n_heap_sects, GC_n_memory,
GC_page_size, GC_sysinfo, GC_black_list_spacing,
GC_objects_are_marked, GC_incremental, GC_dirty_maintained,
GC_root_size, GC_debugging_started, GC_large_alloc_warn_interval,
GC_large_alloc_warn_suppressed, GC_blocked_sp,
GC_activation_frame, GC_push_other_roots,
GC_push_finalizer_structures, GC_push_thread_structures,
GC_push_typed_structures, GC_start_call_back, GC_is_initialized,
GC_check_heap, GC_print_all_smashed, GC_print_all_errors,
GC_print_heap_obj, GC_have_errors, GC_print_stats,
GC_dump_regularly, GC_backtraces, GC_print_back_height,
GC_debug_generic_malloc_inner,
GC_debug_generic_malloc_inner_ignore_off_page,
GC_fl_builder_count, GC_mark_no, GC_help_marker,
GC_setup_temporary_fault_handler, GC_reset_fault_handler): Ditto.
* include/private/gcconfig.h (GC_SysVGetDataStart,
GC_FreeBSDGetDataStart, GC_register_stackbottom,
GC_MacTemporaryNewPtr, GC_amiga_get_mem): Ditto.
* include/private/pthread_support.h (GC_threads,
GC_thr_initialized, GC_in_thread_creation): Ditto.
* malloc.c (GC_text_mapping): Ditto.
* mallocx.c (GC_bytes_found): Ditto.
* mark.c (GC_check_dirty, GC_started_thread_while_stopped): Ditto.
* mark_rts.c (GC_save_regs_ret_val): Ditto.
* misc.c (GC_clear_stack_inner, GC_init_parallel, GC_init_win32,
GC_setpagesize, GC_init_linux_data_start,
GC_set_and_save_fault_handler, GC_unmap_threshold): Ditto.
* os_dep.c (GC_unmap_threshold, GC_push_all_stacks,
GC_darwin_register_mach_handler_thread): Ditto.
* pthread_support.c (GC_markers, GC_collection_in_progress):
Ditto.
* tests/test.c (GC_amiga_free_all_mem): Ditto.
* thread_local_alloc.c (GC_gcjobjfreelist,
GC_gcj_malloc_initialized, GC_gcj_kind): Ditto.
* win32_threads.c (GC_write_fault_handler, GC_gww_dirty_init,
GC_fault_handler_lock, GC_write_cs, GC_markers): Ditto.
* misc.c (GC_read, GC_register_finalizer_no_order, GC_init_dyld):
Move the declaration out of GC_init(); remove "extern".
* os_dep.c (GC_abort): Add the comment; add workaround to suppress
compiler "unreachable code" warnings for ABORT callers (where
ABORT is followed by a dummy return statement).
* os_dep.c (GC_old_allocator): Move the declaration out of
GC_default_push_other_roots(); remove "extern".
* darwin_stop_world.c (GC_mprotect_stop, GC_mprotect_resume):
Move the declaration out of GC_stop_world() and GC_start_world()
(only if MPROTECT_VDB); remove "extern".

24 files changed:
ChangeLog
allchblk.c
alloc.c
blacklst.c
darwin_stop_world.c
dbg_mlc.c
dyn_load.c
finalize.c
include/private/gc_hdrs.h
include/private/gc_locks.h
include/private/gc_pmark.h
include/private/gc_priv.h
include/private/gcconfig.h
include/private/pthread_support.h
malloc.c
mallocx.c
mark.c
mark_rts.c
misc.c
os_dep.c
pthread_support.c
tests/test.c
thread_local_alloc.c
win32_threads.c

index a0459c80e1095e94d5785a930a90d0031c5e8737..cd5d501836e23f37a3177a018f91485234d97e59 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,81 @@
+2009-09-27  Ivan Maidanski <ivmai@mail.ru>
+
+       * allchblk.c (GC_hblkfreelist): Define as STATIC.
+       * blacklst.c (GC_total_stack_black_listed): Ditto.
+       * include/private/gc_priv.h (GC_hblkfreelist, GC_stopped_mark,
+       GC_total_stack_black_listed, GC_push_stubborn_structures): Remove
+       declaration.
+       * mark_rts.c (GC_stopped_mark): Add declaration (only if
+       THREAD_LOCAL_ALLOC).
+       * allchblk.c (GC_fail_count): Move the declaration out of
+       GC_allochblk_nth(); remove "extern".
+       * alloc.c (IF_THREADS): Remove unused macro.
+       * alloc.c (GC_world_stopped): Define only if THREAD_LOCAL_ALLOC.
+       * alloc.c (GC_stopped_mark): Set GC_world_stopped value only if
+       THREAD_LOCAL_ALLOC.
+       * alloc.c (GC_bytes_found, GC_collection_in_progress,
+       GC_check_tls, GC_unmap_threshold, GC_force_unmap_on_gcollect):
+       Remove K&R-style "extern" for the declaration.
+       * dbg_mlc.c (GC_free_inner): Ditto.
+       * dyn_load.c (GC_repeat_read, GC_roots_present, GC_is_heap_base,
+       GC_get_next_stack, 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.
+       * include/private/gc_locks.h (GC_allocate_ml, GC_lock_holder,
+       GC_lock, GC_collecting, GC_mark_lock_holder, GC_need_to_lock):
+       Ditto.
+       * include/private/gc_pmark.h (GC_mark_procs, GC_n_mark_procs,
+       GC_mark_stack_size, GC_mark_stack_limit, GC_mark_stack_top,
+       GC_mark_stack, GC_mark_stack_too_small, GC_mark_state): Ditto.
+       * include/private/gc_priv.h (GC_current_warn_proc, GC_obj_kinds,
+       GC_n_kinds, GC_fo_entries, GC_n_heap_sects, GC_n_memory,
+       GC_page_size, GC_sysinfo, GC_black_list_spacing,
+       GC_objects_are_marked, GC_incremental, GC_dirty_maintained,
+       GC_root_size, GC_debugging_started, GC_large_alloc_warn_interval,
+       GC_large_alloc_warn_suppressed, GC_blocked_sp,
+       GC_activation_frame, GC_push_other_roots,
+       GC_push_finalizer_structures, GC_push_thread_structures,
+       GC_push_typed_structures, GC_start_call_back, GC_is_initialized,
+       GC_check_heap, GC_print_all_smashed, GC_print_all_errors,
+       GC_print_heap_obj, GC_have_errors, GC_print_stats,
+       GC_dump_regularly, GC_backtraces, GC_print_back_height,
+       GC_debug_generic_malloc_inner,
+       GC_debug_generic_malloc_inner_ignore_off_page,
+       GC_fl_builder_count, GC_mark_no, GC_help_marker,
+       GC_setup_temporary_fault_handler, GC_reset_fault_handler): Ditto.
+       * include/private/gcconfig.h (GC_SysVGetDataStart,
+       GC_FreeBSDGetDataStart, GC_register_stackbottom,
+       GC_MacTemporaryNewPtr, GC_amiga_get_mem): Ditto.
+       * include/private/pthread_support.h (GC_threads,
+       GC_thr_initialized, GC_in_thread_creation): Ditto.
+       * malloc.c (GC_text_mapping): Ditto.
+       * mallocx.c (GC_bytes_found): Ditto.
+       * mark.c (GC_check_dirty, GC_started_thread_while_stopped): Ditto.
+       * mark_rts.c (GC_save_regs_ret_val): Ditto.
+       * misc.c (GC_clear_stack_inner, GC_init_parallel, GC_init_win32,
+       GC_setpagesize, GC_init_linux_data_start,
+       GC_set_and_save_fault_handler, GC_unmap_threshold): Ditto.
+       * os_dep.c (GC_unmap_threshold, GC_push_all_stacks,
+       GC_darwin_register_mach_handler_thread): Ditto.
+       * pthread_support.c (GC_markers, GC_collection_in_progress):
+       Ditto.
+       * tests/test.c (GC_amiga_free_all_mem): Ditto.
+       * thread_local_alloc.c (GC_gcjobjfreelist,
+       GC_gcj_malloc_initialized, GC_gcj_kind): Ditto.
+       * win32_threads.c (GC_write_fault_handler, GC_gww_dirty_init,
+       GC_fault_handler_lock, GC_write_cs, GC_markers): Ditto.
+       * misc.c (GC_read, GC_register_finalizer_no_order, GC_init_dyld):
+       Move the declaration out of GC_init(); remove "extern".
+       * os_dep.c (GC_abort): Add the comment; add workaround to suppress
+       compiler "unreachable code" warnings for ABORT callers (where
+       ABORT is followed by a dummy return statement).
+       * os_dep.c (GC_old_allocator): Move the declaration out of
+       GC_default_push_other_roots(); remove "extern".
+       * darwin_stop_world.c (GC_mprotect_stop, GC_mprotect_resume):
+       Move the declaration out of GC_stop_world() and GC_start_world()
+       (only if MPROTECT_VDB); remove "extern".
+
 2009-09-27  Ivan Maidanski <ivmai@mail.ru>
 
        * win32_threads.c (GC_get_stack_min, GC_push_stack_for,
index 0e37306df6a9bf23263a943529cbc2e908c32f68..656ac33a0bc15fc6207b3be77341ec22a42dcbbc 100644 (file)
@@ -44,7 +44,11 @@ GC_bool GC_use_entire_heap = 0;
 # define N_HBLK_FLS (HUGE_THRESHOLD - UNIQUE_THRESHOLD)/FL_COMPRESSION \
                                  + UNIQUE_THRESHOLD
 
-struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 };
+STATIC struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 };
+                                /* List of completely empty heap blocks */
+                                /* Linked through hb_next field of      */
+                                /* header structure associated with     */
+                                /* block.                               */
 
 #ifndef USE_MUNMAP
 
@@ -623,6 +627,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 */
+
 /*
  * The same, but with search restricted to nth free list.
  * Flags is IGNORE_OFF_PAGE or zero.
@@ -796,11 +803,7 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, GC_bool may_split)
 
     /* We just successfully allocated a block.  Restart count of        */
     /* consecutive failures.                                            */
-    {
-        extern unsigned GC_fail_count;
-
-        GC_fail_count = 0;
-    }
+    GC_fail_count = 0;
 
     GC_large_free_bytes -= size_needed;
 
diff --git a/alloc.c b/alloc.c
index d2a79b5efc4be9ed3e6e989d1724e66a9fb1f33f..0cb411c3a9eaa86250d981c53a647afd444c9988 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -76,11 +76,8 @@ int GC_full_freq = GC_FULL_FREQ;
 STATIC GC_bool GC_need_full_gc = FALSE;
                            /* Need full GC do to heap growth.   */
 
-#ifdef THREADS
+#ifdef THREAD_LOCAL_ALLOC
   GC_bool GC_world_stopped = FALSE;
-# define IF_THREADS(x) x
-#else
-# define IF_THREADS(x)
 #endif
 
 STATIC word GC_used_heap_size_after_full = 0;
@@ -105,8 +102,8 @@ unsigned GC_version = ((GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | GC_T
 
 /* some more variables */
 
-extern signed_word GC_bytes_found; /* Number of reclaimed bytes         */
-                                  /* after garbage collection           */
+signed_word GC_bytes_found;     /* Number of reclaimed bytes    */
+                                /* after garbage collection     */
 
 #ifdef GC_DONT_EXPAND
   GC_bool GC_dont_expand = TRUE;
@@ -120,7 +117,7 @@ extern signed_word GC_bytes_found; /* Number of reclaimed bytes         */
 
 word GC_free_space_divisor = GC_FREE_SPACE_DIVISOR;
 
-extern GC_bool GC_collection_in_progress(void);
+GC_bool GC_collection_in_progress(void);
                 /* Collection is in progress, or was abandoned. */
 
 int GC_CALLBACK GC_never_stop_func (void) { return(0); }
@@ -565,7 +562,9 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
 #   endif
 
     STOP_WORLD();
-    IF_THREADS(GC_world_stopped = TRUE);
+#   ifdef THREAD_LOCAL_ALLOC
+      GC_world_stopped = TRUE;
+#   endif
     if (GC_print_stats) {
         /* Output blank line for convenience here */
         GC_log_printf(
@@ -590,7 +589,9 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
                                 "%u iterations\n", i);
                     }
                     GC_deficit = i; /* Give the mutator a chance. */
-                    IF_THREADS(GC_world_stopped = FALSE);
+#                   ifdef THREAD_LOCAL_ALLOC
+                      GC_world_stopped = FALSE;
+#                   endif
                     START_WORLD();
                     return(FALSE);
             }
@@ -610,7 +611,9 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
             (*GC_check_heap)();
         }
 
-    IF_THREADS(GC_world_stopped = FALSE);
+#   ifdef THREAD_LOCAL_ALLOC
+      GC_world_stopped = FALSE;
+#   endif
     START_WORLD();
 #   ifndef SMALL_CONFIG
       if (GC_print_stats) {
@@ -739,7 +742,7 @@ STATIC void GC_clear_fl_marks(ptr_t q)
 }
 
 #if defined(GC_ASSERTIONS) && defined(THREADS) && defined(THREAD_LOCAL_ALLOC)
-extern void GC_check_tls(void);
+void GC_check_tls(void);
 #endif
 
 #ifdef MAKE_BACK_GRAPH
@@ -898,8 +901,8 @@ STATIC void GC_finish_collection(void)
 }
 
 #ifdef USE_MUNMAP
-    extern int GC_unmap_threshold;      /* defined in allchblk.c        */
-    extern GC_bool GC_force_unmap_on_gcollect;  /* defined in misc.c    */
+    int GC_unmap_threshold;     /* defined in allchblk.c        */
+    GC_bool GC_force_unmap_on_gcollect; /* defined in misc.c    */
 #endif
 
 /* Externally callable routine to invoke full, stop-world collection */
index db34ee1d5e990e4333ea8186fdee98f40b724904..5bd479d39fd132c474fa50324ae2b5157fb12b94 100644 (file)
@@ -46,7 +46,8 @@ STATIC word * GC_incomplete_normal_bl;
 STATIC word * GC_old_stack_bl;
 STATIC word * GC_incomplete_stack_bl;
 
-word GC_total_stack_black_listed;
+STATIC word GC_total_stack_black_listed;
+                        /* Number of bytes on stack blacklist.  */
 
 word GC_black_list_spacing = MINHINCR*HBLKSIZE;  /* Initial rough guess */
 
index 7c8c3ca10b5dc7e13fc2099711076e09f6d9e8ca..90c7bda8ec3b17a9943032783f4a555290684eb2 100644 (file)
@@ -511,6 +511,10 @@ STATIC int GC_suspend_thread_list(thread_act_array_t act_list, int count,
   return changed;
 }
 
+#ifdef MPROTECT_VDB
+  void GC_mprotect_stop(void);
+  void GC_mprotect_resume(void);
+#endif
 
 /* Caller holds allocation lock.        */
 void GC_stop_world(void)
@@ -584,7 +588,6 @@ void GC_stop_world(void)
 
 #   ifdef MPROTECT_VDB
       if(GC_incremental) {
-        extern void GC_mprotect_stop();
         GC_mprotect_stop();
       }
 #   endif
@@ -620,7 +623,6 @@ void GC_start_world(void)
 
 #   ifdef MPROTECT_VDB
       if(GC_incremental) {
-        extern void GC_mprotect_resume();
         GC_mprotect_resume();
       }
 #   endif
index 9357712d66703c591acf89ebcb6563073f3c417a..0558913ca2f49ef095bd0adaa80b4b7dfa731414 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -769,7 +769,7 @@ GC_API void GC_CALL GC_debug_free(void * p)
 
 #ifdef THREADS
 
-extern void GC_free_inner(void * p);
+void GC_free_inner(void * p);
 
 /* Used internally; we assume it's called correctly.    */
 void GC_debug_free_inner(void * p)
index 84633c28a92efd05b13e0c64959bc731ba6c61fb..1679ebc20b446ce461584bee7bcb885372838b93 100644 (file)
@@ -231,7 +231,7 @@ void GC_register_dynamic_libraries(void)
 
 #define MAPS_BUF_SIZE (32*1024)
 
-extern ssize_t GC_repeat_read(int fd, char *buf, size_t count);
+ssize_t GC_repeat_read(int fd, char *buf, size_t count);
         /* Repeatedly read until buffer is filled, or EOF is encountered */
         /* Defined in os_dep.c.                                          */
 
@@ -663,7 +663,7 @@ void GC_register_dynamic_libraries(void)
 # define IRIX6
 #endif
 
-extern void * GC_roots_present(ptr_t);
+void * GC_roots_present(ptr_t);
         /* The type is a lie, since the real type doesn't make sense here, */
         /* and we only test for NULL.                                      */
 
@@ -792,11 +792,10 @@ void GC_register_dynamic_libraries(void)
   /* We traverse the entire address space and register all segments     */
   /* that could possibly have been written to.                          */
 
-  extern GC_bool GC_is_heap_base (ptr_t p);
+  GC_bool GC_is_heap_base(ptr_t p);
 
 # ifdef GC_WIN32_THREADS
-    extern void GC_get_next_stack(char *start, char * limit, char **lo,
-                                  char **hi);
+    void GC_get_next_stack(char *start, char * limit, char **lo, char **hi);
 
     STATIC void GC_cond_add_roots(char *base, char * limit)
     {
@@ -830,18 +829,18 @@ void GC_register_dynamic_libraries(void)
 # endif
 
 # ifdef MSWINCE
-  /* Do we need to separately register the main static data segment? */
-  GC_bool GC_register_main_static_data(void)
-  {
-    return FALSE;
-  }
+    /* Do we need to separately register the main static data segment? */
+    GC_bool GC_register_main_static_data(void)
+    {
+      return FALSE;
+    }
 # else /* win32 */
-  extern GC_bool GC_no_win32_dlls;
+    GC_bool GC_no_win32_dlls;
 
-  GC_bool GC_register_main_static_data(void)
-  {
-    return GC_no_win32_dlls;
-  }
+    GC_bool GC_register_main_static_data(void)
+    {
+      return GC_no_win32_dlls;
+    }
 # endif /* win32 */
 
 # define HAVE_REGISTER_MAIN_STATIC_DATA
@@ -868,8 +867,8 @@ void GC_register_dynamic_libraries(void)
     /* To workaround that, use -DGC_REGISTER_MEM_PRIVATE.               */
 #   define GC_wnt TRUE
 # else
-    extern GC_bool GC_wnt;      /* Is Windows NT derivative.    */
-                                /* Defined and set in os_dep.c. */
+    GC_bool GC_wnt;     /* Is Windows NT derivative.    */
+                        /* Defined and set in os_dep.c. */
 # endif
 
   void GC_register_dynamic_libraries(void)
index c72fcea523c4cc9eef9dab17f7852bbb0e33b648..71687dde37925d79ade722a8ac4586fc075febb9 100644 (file)
@@ -495,7 +495,7 @@ void GC_dump_finalization(void)
   STATIC word GC_old_dl_entries; /* for stats printing */
 #endif
 
-extern unsigned GC_fail_count;
+unsigned GC_fail_count;
                         /* How many consecutive GC/expansion failures?  */
                         /* Reset by GC_allochblk(); defined in alloc.c. */
 
index 40dbe5b89a477869a042f17720dfbea5c1c25fff..4ed3c26bdd3226976e936bdbdc638478cc265815 100644 (file)
@@ -57,8 +57,8 @@ typedef struct hblkhdr hdr;
 /* #define COUNT_HDR_CACHE_HITS  */
 
 # ifdef COUNT_HDR_CACHE_HITS
-    extern word GC_hdr_cache_hits;
-    extern word GC_hdr_cache_misses;
+    word GC_hdr_cache_hits;
+    word GC_hdr_cache_misses;
 #   define HC_HIT() ++GC_hdr_cache_hits
 #   define HC_MISS() ++GC_hdr_cache_misses
 # else
@@ -132,7 +132,7 @@ typedef struct bi {
 # endif
 } bottom_index;
 
-/* extern bottom_index GC_all_nils; - really part of GC_arrays */
+/* bottom_index GC_all_nils; - really part of GC_arrays */
 
 /* extern bottom_index * GC_top_index []; - really part of GC_arrays */
                                 /* Each entry points to a bottom_index. */
index f7038f8f62038bde8f6a4efa3ea7776d753d0c17..d3bd193bd1f3db69be212c77fe31a5446a5a231f 100644 (file)
@@ -36,7 +36,7 @@
 #  ifdef PCR
 #    include <base/PCR_Base.h>
 #    include <th/PCR_Th.h>
-     extern PCR_Th_ML GC_allocate_ml;
+     PCR_Th_ML GC_allocate_ml;
 #    define DCL_LOCK_STATE \
          PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask
 #    define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml)
@@ -54,8 +54,8 @@
 #  if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS)
 #    include <windows.h>
 #    define NO_THREAD (DWORD)(-1)
-     extern DWORD GC_lock_holder;
-     extern CRITICAL_SECTION GC_allocate_ml;
+     DWORD GC_lock_holder;
+     CRITICAL_SECTION GC_allocate_ml;
 #    ifdef GC_ASSERTIONS
 #        define UNCOND_LOCK() \
                 { EnterCriticalSection(&GC_allocate_ml); \
       /* and sleeping for fixed periods are likely to result in         */
       /* significant wasted time.  We thus rely mostly on queued locks. */
 #     define USE_SPIN_LOCK
-      extern volatile AO_TS_t GC_allocate_lock;
-      extern void GC_lock(void);
+      volatile AO_TS_t GC_allocate_lock;
+      void GC_lock(void);
         /* Allocation lock holder.  Only set if acquired by client through */
         /* GC_call_with_alloc_lock.                                        */
 #     ifdef GC_ASSERTIONS
 #    endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCK */
 #    ifdef USE_PTHREAD_LOCKS
 #      include <pthread.h>
-       extern pthread_mutex_t GC_allocate_ml;
+       pthread_mutex_t GC_allocate_ml;
 #      ifdef GC_ASSERTIONS
 #        define UNCOND_LOCK() \
                 { GC_lock(); \
                 (!GC_need_to_lock \
                  || GC_lock_holder != NUMERIC_THREAD_ID(pthread_self()))
 #    endif
-     extern volatile GC_bool GC_collecting;
+     volatile GC_bool GC_collecting;
 #    define ENTER_GC() GC_collecting = 1;
 #    define EXIT_GC() GC_collecting = 0;
-     extern void GC_lock(void);
-     extern unsigned long GC_lock_holder;
+     void GC_lock(void);
+     unsigned long GC_lock_holder;
 #    ifdef GC_ASSERTIONS
-      extern unsigned long GC_mark_lock_holder;
+       unsigned long GC_mark_lock_holder;
 #    endif
 #  endif /* GC_PTHREADS with linux_threads.c implementation */
 
 # endif /* !THREADS */
 
 #if defined(UNCOND_LOCK) && !defined(LOCK)
-     extern GC_bool GC_need_to_lock;
+     GC_bool GC_need_to_lock;
                 /* At least two thread running; need to lock.   */
 #    define LOCK() if (GC_need_to_lock) { UNCOND_LOCK(); }
 #    define UNLOCK() if (GC_need_to_lock) { UNCOND_UNLOCK(); }
index dd371b1bcb56fd612a2965421e229f80f60995b3..4f4f4ce47d9de34a62b38f3d98b0386520972803 100644 (file)
@@ -46,7 +46,7 @@
 /* The real declarations of the following is in gc_priv.h, so that      */
 /* we can avoid scanning the following table.                           */
 /*
-extern mark_proc GC_mark_procs[MAX_MARK_PROCS];
+mark_proc GC_mark_procs[MAX_MARK_PROCS];
 */
 
 #ifndef MARK_DESCR_OFFSET
@@ -66,7 +66,7 @@ extern mark_proc GC_mark_procs[MAX_MARK_PROCS];
         (((word)1 << (WORDSZ - GC_DS_TAG_BITS - GC_LOG_MAX_MARK_PROCS)) - 1)
 
 
-extern unsigned GC_n_mark_procs;
+unsigned GC_n_mark_procs;
 
 /* Number of mark stack entries to discard on overflow. */
 #define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8)
@@ -77,17 +77,17 @@ typedef struct GC_ms_entry {
                         /* as described in gc_mark.h.                   */
 } mse;
 
-extern size_t GC_mark_stack_size;
+size_t GC_mark_stack_size;
 
-extern mse * GC_mark_stack_limit;
+mse * GC_mark_stack_limit;
 
 #ifdef PARALLEL_MARK
-  extern mse * volatile GC_mark_stack_top;
+  mse * volatile GC_mark_stack_top;
 #else
-  extern mse * GC_mark_stack_top;
+  mse * GC_mark_stack_top;
 #endif
 
-extern mse * GC_mark_stack;
+mse * GC_mark_stack;
 
 #ifdef PARALLEL_MARK
     /*
@@ -451,7 +451,7 @@ mse * GC_mark_from(mse * top, mse * bottom, mse *limit);
     } \
 }
 
-extern GC_bool GC_mark_stack_too_small;
+GC_bool GC_mark_stack_too_small;
                                 /* We need a larger mark stack.  May be */
                                 /* set by client supplied mark routines.*/
 
@@ -495,6 +495,6 @@ typedef int mark_state_t;       /* Current state of marking, as follows:*/
 
 # define MS_INVALID 5           /* I may not hold.                      */
 
-extern mark_state_t GC_mark_state;
+mark_state_t GC_mark_state;
 
 #endif  /* GC_PMARK_H */
index cda6fe8c939f087a889991d07fc4a8f1bbb09f10..8b64f7f6b31a9a7c1bba9408adbac48f5044b93c 100644 (file)
@@ -376,7 +376,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
 
 /* Print warning message, e.g. almost out of memory.    */
 # define WARN(msg,arg) (*GC_current_warn_proc)("GC Warning: " msg, (GC_word)(arg))
-extern GC_warn_proc GC_current_warn_proc;
+GC_warn_proc GC_current_warn_proc;
 
 /* Print format type macro for signed_word.  Currently used for WARN()  */
 /* only.  This could be of use on Win64 but commented out since Win64   */
@@ -1180,7 +1180,7 @@ GC_API_PRIV GC_FAR struct _GC_arrays GC_arrays;
 /* Object kinds: */
 # define MAXOBJKINDS 16
 
-extern struct obj_kind {
+struct obj_kind {
    void **ok_freelist;  /* Array of free listheaders for this kind of object */
                         /* Point either to GC_arrays or to storage allocated */
                         /* with GC_scratch_alloc.                            */
@@ -1232,46 +1232,37 @@ extern struct obj_kind {
 #   define IS_UNCOLLECTABLE(k) ((k) == UNCOLLECTABLE)
 # endif
 
-extern unsigned GC_n_kinds;
+unsigned GC_n_kinds;
 
-extern word GC_fo_entries;
+word GC_fo_entries;
 
-extern word GC_n_heap_sects;    /* Number of separately added heap      */
+word GC_n_heap_sects;           /* Number of separately added heap      */
                                 /* sections.                            */
 
 #ifdef USE_PROC_FOR_LIBRARIES
-  extern word GC_n_memory;      /* Number of GET_MEM allocated memory   */
+  word GC_n_memory;             /* Number of GET_MEM allocated memory   */
                                 /* sections.                            */
 #endif
 
-extern word GC_page_size;
+word GC_page_size;
 
-# if defined(MSWIN32) || defined(MSWINCE)
+#if defined(MSWIN32) || defined(MSWINCE)
   struct _SYSTEM_INFO;
-  extern struct _SYSTEM_INFO GC_sysinfo;
-# endif
-
-extern word GC_total_stack_black_listed;
-                        /* Number of bytes on stack blacklist.  */
+  struct _SYSTEM_INFO GC_sysinfo;
+#endif
 
-extern word GC_black_list_spacing;
+word GC_black_list_spacing;
                         /* Average number of bytes between blacklisted  */
                         /* blocks. Approximate.                         */
                         /* Counts only blocks that are                  */
                         /* "stack-blacklisted", i.e. that are           */
                         /* problematic in the interior of an object.    */
 
-extern struct hblk * GC_hblkfreelist[];
-                                /* List of completely empty heap blocks */
-                                /* Linked through hb_next field of      */
-                                /* header structure associated with     */
-                                /* block.                               */
-
-extern GC_bool GC_objects_are_marked;   /* There are marked objects in  */
+GC_bool GC_objects_are_marked;          /* There are marked objects in  */
                                         /* the heap.                    */
 
 #ifndef SMALL_CONFIG
-  extern GC_bool GC_incremental;
+  GC_bool GC_incremental;
                         /* Using incremental/generational collection. */
 # define TRUE_INCREMENTAL \
         (GC_incremental && GC_time_limit != GC_TIME_UNLIMITED)
@@ -1282,19 +1273,19 @@ extern GC_bool GC_objects_are_marked;   /* There are marked objects in  */
 # define TRUE_INCREMENTAL FALSE
 #endif
 
-extern GC_bool GC_dirty_maintained;
+GC_bool GC_dirty_maintained;
                                 /* Dirty bits are being maintained,     */
                                 /* either for incremental collection,   */
                                 /* or to limit the root set.            */
 
-extern word GC_root_size;       /* Total size of registered root sections */
+word GC_root_size;      /* Total size of registered root sections.      */
 
-extern GC_bool GC_debugging_started;    /* GC_debug_malloc has been called. */
+GC_bool GC_debugging_started;   /* GC_debug_malloc has been called.     */
 
-extern long GC_large_alloc_warn_interval;
+long GC_large_alloc_warn_interval;
         /* Interval between unsuppressed warnings.      */
 
-extern long GC_large_alloc_warn_suppressed;
+long GC_large_alloc_warn_suppressed;
         /* Number of warnings suppressed so far.        */
 
 /* This is used by GC_do_blocking[_inner]().            */
@@ -1316,13 +1307,11 @@ struct GC_activation_frame_s {
 #ifdef THREADS
 /* Process all activation "frames" - scan entire stack except for       */
 /* frames belonging to the user functions invoked by GC_do_blocking().  */
-void GC_push_all_stack_frames(ptr_t lo, ptr_t hi,
+  void GC_push_all_stack_frames(ptr_t lo, ptr_t hi,
                         struct GC_activation_frame_s *activation_frame);
-
-  extern GC_bool GC_world_stopped;
 #else
-  extern ptr_t GC_blocked_sp;
-  extern struct GC_activation_frame_s *GC_activation_frame;
+  ptr_t GC_blocked_sp;
+  struct GC_activation_frame_s *GC_activation_frame;
                         /* Points to the "frame" data held in stack by  */
                         /* the innermost GC_call_with_gc_active().      */
                         /* NULL if no such "frame" active.              */
@@ -1456,7 +1445,7 @@ void GC_push_all_eager (ptr_t b, ptr_t t);
 
 void GC_push_roots(GC_bool all, ptr_t cold_gc_frame);
                         /* Push all or dirty roots.     */
-extern void (*GC_push_other_roots)(void);
+void (*GC_push_other_roots)(void);
                         /* Push system or application specific roots    */
                         /* onto the mark stack.  In some environments   */
                         /* (e.g. threads environments) this is          */
@@ -1464,15 +1453,14 @@ extern void (*GC_push_other_roots)(void);
                         /* supplied replacement should also call the    */
                         /* original function.                           */
 
-        extern void GC_push_finalizer_structures(void);
-        extern void GC_push_stubborn_structures (void);
-#       ifdef THREADS
-          extern void GC_push_thread_structures (void);
-#       endif
-        extern void (*GC_push_typed_structures) (void);
+void GC_push_finalizer_structures(void);
+#ifdef THREADS
+  void GC_push_thread_structures(void);
+#endif
+void (*GC_push_typed_structures)(void);
                         /* A pointer such that we can avoid linking in  */
                         /* the typed allocation support if unused.      */
-extern void (*GC_start_call_back) (void);
+void (*GC_start_call_back)(void);
                         /* Called at start of full collections.         */
                         /* Not called if 0.  Called with allocation     */
                         /* lock held.                                   */
@@ -1708,7 +1696,7 @@ GC_bool GC_collect_or_expand(word needed_blocks, GC_bool ignore_off_page);
                                 /* until the blocks are available or    */
                                 /* until it fails by returning FALSE.   */
 
-extern GC_bool GC_is_initialized;       /* GC_init() has been run.      */
+GC_bool GC_is_initialized;      /* GC_init() has been run.              */
 
 #if defined(MSWIN32) || defined(MSWINCE)
   void GC_deinit(void);
@@ -1827,17 +1815,17 @@ void GC_print_obj(ptr_t p);
                         /* P points to somewhere inside an object with  */
                         /* debugging info.  Print a human readable      */
                         /* description of the object to stderr.         */
-extern void (*GC_check_heap)(void);
+void (*GC_check_heap)(void);
                         /* Check that all objects in the heap with      */
                         /* debugging info are intact.                   */
                         /* Add any that are not to GC_smashed list.     */
-extern void (*GC_print_all_smashed) (void);
+void (*GC_print_all_smashed)(void);
                         /* Print GC_smashed if it's not empty.          */
                         /* Clear GC_smashed list.                       */
-extern void GC_print_all_errors (void);
+void GC_print_all_errors(void);
                         /* Print smashed and leaked objects, if any.    */
                         /* Clear the lists of such objects.             */
-extern void (*GC_print_heap_obj) (ptr_t p);
+void (*GC_print_heap_obj)(ptr_t p);
                         /* If possible print s followed by a more       */
                         /* detailed description of the object           */
                         /* referred to by p.                            */
@@ -1846,33 +1834,33 @@ extern void (*GC_print_heap_obj) (ptr_t p);
                         /* Print an address map of the process.         */
 #endif
 
-extern GC_bool GC_have_errors;  /* We saw a smashed or leaked object.   */
+GC_bool GC_have_errors;         /* We saw a smashed or leaked object.   */
                                 /* Call error printing routine          */
                                 /* occasionally.                        */
 
 #ifndef SMALL_CONFIG
-  extern int GC_print_stats;    /* Nonzero generates basic GC log.      */
+  int GC_print_stats;           /* Nonzero generates basic GC log.      */
                                 /* VERBOSE generates add'l messages.    */
 #else
 # define GC_print_stats 0
-        /* Will this keep the message character strings from the executable? */
-        /* It should ...                                                     */
+   /* Will this keep the message character strings from the executable? */
+   /* It should ...                                                     */
 #endif
 #define VERBOSE 2
 
 #ifndef NO_DEBUGGING
-  extern GC_bool GC_dump_regularly;  /* Generate regular debugging dumps. */
+  GC_bool GC_dump_regularly;    /* Generate regular debugging dumps.    */
 # define COND_DUMP if (GC_dump_regularly) GC_dump();
 #else
 # define COND_DUMP
 #endif
 
 #ifdef KEEP_BACK_PTRS
-  extern long GC_backtraces;
+  long GC_backtraces;
   void GC_generate_random_backtrace_no_gc(void);
 #endif
 
-extern GC_bool GC_print_back_height;
+GC_bool GC_print_back_height;
 
 #ifdef MAKE_BACK_GRAPH
   void GC_print_back_graph_stats(void);
@@ -1881,9 +1869,8 @@ extern GC_bool GC_print_back_height;
 /* Macros used for collector internal allocation.       */
 /* These assume the collector lock is held.             */
 #ifdef DBG_HDRS_ALL
-    extern void * GC_debug_generic_malloc_inner(size_t lb, int k);
-    extern void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb,
-                                                                int k);
+    void * GC_debug_generic_malloc_inner(size_t lb, int k);
+    void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb, int k);
 #   define GC_INTERNAL_MALLOC GC_debug_generic_malloc_inner
 #   define GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE \
                  GC_debug_generic_malloc_inner_ignore_off_page
@@ -2044,13 +2031,13 @@ void GC_err_puts(const char *s);
      void GC_notify_all_builder(void);
      void GC_wait_for_reclaim(void);
 
-     extern word GC_fl_builder_count;   /* Protected by mark lock.      */
+     word GC_fl_builder_count;          /* Protected by mark lock.      */
 
      void GC_notify_all_marker(void);
      void GC_wait_marker(void);
-     extern word GC_mark_no;            /* Protected by mark lock.      */
+     word GC_mark_no;                   /* Protected by mark lock.      */
 
-     extern void GC_help_marker(word my_mark_no);
+     void GC_help_marker(word my_mark_no);
                 /* Try to help out parallel marker for mark cycle       */
                 /* my_mark_no.  Returns if the mark cycle finishes or   */
                 /* was already done, or there was nothing to do for     */
@@ -2149,10 +2136,10 @@ JMP_BUF GC_jmp_buf;
 
 /* Set up a handler for address faults which will longjmp to    */
 /* GC_jmp_buf;                                                  */
-extern void GC_setup_temporary_fault_handler(void);
+void GC_setup_temporary_fault_handler(void);
 
 /* Undo the effect of GC_setup_temporary_fault_handler.         */
-extern void GC_reset_fault_handler(void);
+void GC_reset_fault_handler(void);
 
 # endif /* Need to handle address faults.       */
 
index f9db88378d1c105801e2b99c12077d96de115540..5dacf2161397c5b6b3fa0ba03ffb66ad44e0f07a 100644 (file)
 #       define OS_TYPE "SOLARIS"
         extern int _etext[];
         extern int _end[];
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
 #       define DATAEND (ptr_t)(_end)
 #       if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
 #   endif
 #   ifdef DRSNX
 #       define OS_TYPE "DRSNX"
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
         extern int etext[];
 #       define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext)
 #       define MPROTECT_VDB
       extern int _etext[];
 #     define DATAEND (ptr_t)(_end)
 #     define SVR4
-      extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+      ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #     ifdef __arch64__
 #       define DATASTART GC_SysVGetDataStart(0x100000, (ptr_t)_etext)
 #     else
 #   ifdef SOLARIS
 #       define OS_TYPE "SOLARIS"
         extern int _etext[], _end[];
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
 #       define DATAEND (ptr_t)(_end)
 /*      # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7,      */
 #   ifdef DGUX
 #       define OS_TYPE "DGUX"
         extern int _etext, _end;
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)(&_etext))
 #       define DATAEND (ptr_t)(&_end)
 #       define STACK_GROWS_DOWN
 #           define DYNAMIC_LOADING
 #       endif
         extern char etext[];
-        extern char * GC_FreeBSDGetDataStart(size_t, ptr_t);
+        char * GC_FreeBSDGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_FreeBSDGetDataStart(0x1000, (ptr_t)etext)
 #   endif
 #   ifdef NETBSD
         /* address minus one page.                                      */
 #       define BACKING_STORE_DISPLACEMENT 0x1000000
 #       define BACKING_STORE_ALIGNMENT 0x1000
-        extern ptr_t GC_register_stackbottom;
+        ptr_t GC_register_stackbottom;
 #       define BACKING_STORE_BASE GC_register_stackbottom
         /* Known to be wrong for recent HP/UX versions!!!       */
 #   endif
         /* constants:                                           */
 #       define BACKING_STORE_ALIGNMENT 0x100000
 #       define BACKING_STORE_DISPLACEMENT 0x80000000
-        extern ptr_t GC_register_stackbottom;
+        ptr_t GC_register_stackbottom;
 #       define BACKING_STORE_BASE GC_register_stackbottom
 #       define SEARCH_FOR_DATA_START
 #       ifdef __GNUC__
 #   endif
 #   ifdef  DGUX
 #       define OS_TYPE "DGUX"
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext)
 #   endif
 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
         extern int etext[];
         extern int _etext[];
         extern int _end[];
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
 #       define DATAEND (ptr_t)(_end)
 #       define HEURISTIC2
 #       define OS_TYPE "SOLARIS"
 #       define ELF_CLASS ELFCLASS64
         extern int _etext[], _end[];
-        extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+        ptr_t GC_SysVGetDataStart(size_t, ptr_t);
 #       define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
 #       define DATAEND (ptr_t)(_end)
 /*      # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7,      */
 #   define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
 # elif defined(MACOS)
 #   if defined(USE_TEMPORARY_MEMORY)
-      extern Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory);
+      Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory);
 #     define GET_MEM(bytes) HBLKPTR( \
                             GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
                             + GC_page_size-1)
     ptr_t GC_wince_get_mem(GC_word bytes);
 #   define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
 # elif defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
-    extern void *GC_amiga_get_mem(size_t size);
+    void *GC_amiga_get_mem(size_t size);
 #   define GET_MEM(bytes) HBLKPTR((size_t) \
                           GC_amiga_get_mem((size_t)bytes + GC_page_size) \
                           + GC_page_size-1)
index 1d75f3e6958c00f0c7d07966e57523b7154560fd..be97ad391b6a55247c288c9742e168aa43a3af8a 100644 (file)
@@ -98,15 +98,15 @@ typedef struct GC_Thread_Rep {
 } * GC_thread;
 
 # define THREAD_TABLE_SZ 256    /* Must be power of 2   */
-extern volatile GC_thread GC_threads[THREAD_TABLE_SZ];
+volatile GC_thread GC_threads[THREAD_TABLE_SZ];
 
-extern GC_bool GC_thr_initialized;
+GC_bool GC_thr_initialized;
 
 GC_thread GC_lookup_thread(pthread_t id);
 
 void GC_stop_init(void);
 
-extern GC_bool GC_in_thread_creation;
+GC_bool GC_in_thread_creation;
         /* We may currently be in thread creation or destruction.       */
         /* Only set to TRUE while allocation lock is held.              */
         /* When set, it is OK to run GC from unknown thread.            */
index 5d147d0d149b98fbaa6d0ca244cd9d5247dbd2f2..12642563a305aaac0280d9dfbb010fa90bcb846b 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -322,7 +322,7 @@ void * malloc(size_t lb)
   static ptr_t GC_libpthread_end = 0;
   static ptr_t GC_libld_start = 0;
   static ptr_t GC_libld_end = 0;
-  extern GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp);
+  GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp);
         /* From os_dep.c */
 
   STATIC void GC_init_lib_bounds(void)
index a3336923e2ba830b9219b1094db4fd0b238802de..fce51c050bbe95118b6e14944bf92dbca8c78533 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -234,7 +234,7 @@ GC_API void GC_CALL GC_incr_bytes_freed(size_t n)
 
 #if defined(THREADS)
 
-extern signed_word GC_bytes_found;   /* Protected by GC lock.  */
+signed_word GC_bytes_found;     /* Protected by GC lock.  */
 
 #ifdef PARALLEL_MARK
 volatile signed_word GC_bytes_allocd_tmp = 0;
diff --git a/mark.c b/mark.c
index 22851eaaad40e5da257b3ae96b3bcc1e6705f5a4..35aca8e2f42f599b60976d6bacb7784fc6456e87 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -251,7 +251,7 @@ void GC_clear_marks(void)
 }
 
 #ifdef CHECKSUMS
-extern void GC_check_dirty(void);
+  void GC_check_dirty(void);
 #endif
 
 /* Initiate a garbage collection.  Initiates a full collection if the   */
@@ -473,7 +473,7 @@ static void alloc_mark_stack(size_t);
 # endif /* __GNUC__  && MSWIN32 */
 
 #ifdef GC_WIN32_THREADS
-  extern GC_bool GC_started_thread_while_stopped(void);
+  GC_bool GC_started_thread_while_stopped(void);
   /* In win32_threads.c.  Did we invalidate mark phase with an  */
   /* unexpected thread start?                                   */
 #endif
index d696bb437ffde8e3aa067837032a002e1ff7f7bf..64b1b5dbe0b4492da8af21b005451d2875fe180b 100644 (file)
@@ -611,7 +611,7 @@ STATIC void GC_push_all_stack_part_eager_frames(ptr_t lo, ptr_t hi,
 }
 
 # ifdef IA64
-    extern word GC_save_regs_ret_val;
+    word GC_save_regs_ret_val;
                         /* Previously set to backing store pointer.     */
 # endif
 
@@ -719,6 +719,10 @@ STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame)
     GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
 }
 
+#ifdef THREAD_LOCAL_ALLOC
+  GC_bool GC_world_stopped; /* defined in alloc.c */
+#endif
+
 /*
  * Call the mark routines (GC_tl_push for a single pointer, GC_push_conditional
  * on groups of pointers) on every top level accessible pointer.
diff --git a/misc.c b/misc.c
index c31503b596ade04b14f06d6f06d423216fa7cfda..359276cc0f451c2baf80c3a9eba16481b7134df9 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -238,7 +238,7 @@ void GC_extend_size_map(size_t i)
 # define CLEAR_SIZE 213  /* Granularity for GC_clear_stack_inner */
 
 #if defined(ASM_CLEAR_CODE)
-  extern void *GC_clear_stack_inner(void *, ptr_t);
+  void *GC_clear_stack_inner(void *, ptr_t);
 #else
 /* Clear the stack up to about limit.  Return arg. */
 /*ARGSUSED*/
@@ -457,7 +457,7 @@ GC_API size_t GC_CALL GC_get_total_bytes(void)
 GC_bool GC_is_initialized = FALSE;
 
 # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
-  extern void GC_init_parallel(void);
+    void GC_init_parallel(void);
 # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
 
 #if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
@@ -465,10 +465,10 @@ GC_bool GC_is_initialized = FALSE;
 #endif
 
 #ifdef MSWIN32
-    extern void GC_init_win32(void);
+    void GC_init_win32(void);
 #endif
 
-extern void GC_setpagesize(void);
+void GC_setpagesize(void);
 
 STATIC void GC_exit_check(void)
 {
@@ -476,12 +476,12 @@ STATIC void GC_exit_check(void)
 }
 
 #ifdef SEARCH_FOR_DATA_START
-  extern void GC_init_linux_data_start(void);
+  void GC_init_linux_data_start(void);
 #endif
 
 #ifdef UNIX_LIKE
 
-extern void GC_set_and_save_fault_handler(void (*handler)(int));
+void GC_set_and_save_fault_handler(void (*handler)(int));
 
 static void looping_handler(int sig)
 {
@@ -512,7 +512,16 @@ static void maybe_install_looping_handler(void)
 #endif
 
 #ifdef USE_MUNMAP
-  extern int GC_unmap_threshold;
+  int GC_unmap_threshold;
+#endif
+
+#ifdef LINT
+  int GC_read(void);
+  void GC_register_finalizer_no_order(void);
+#endif
+
+#if defined(DYNAMIC_LOADING) && defined(DARWIN)
+  void GC_init_dyld(void);
 #endif
 
 GC_API void GC_CALL GC_init(void)
@@ -838,9 +847,6 @@ GC_API void GC_CALL GC_init(void)
 #   ifdef LINT
       {
           extern char * GC_copyright[];
-          extern int GC_read();
-          extern void GC_register_finalizer_no_order();
-
           GC_noop(GC_copyright, GC_find_header,
                   GC_push_one, GC_call_with_alloc_lock, GC_read,
                   GC_dont_expand,
@@ -857,18 +863,13 @@ GC_API void GC_CALL GC_init(void)
         /* Make sure marker threads are started and thread local */
         /* allocation is initialized, in case we didn't get      */
         /* called from GC_init_parallel();                       */
-        {
-          GC_init_parallel();
-        }
+        GC_init_parallel();
 #   endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
 
 #   if defined(DYNAMIC_LOADING) && defined(DARWIN)
-    {
-        /* This must be called WITHOUT the allocation lock held
-        and before any threads are created */
-        extern void GC_init_dyld();
+        /* This must be called WITHOUT the allocation lock held */
+        /* and before any threads are created.                  */
         GC_init_dyld();
-    }
 #   endif
     RESTORE_CANCEL(cancel_state);
 }
@@ -1211,6 +1212,7 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
 }
 
 #if !defined(PCR) && !defined(SMALL_CONFIG)
+/* Abort the program with a message. msg must not be NULL. */
 void GC_abort(const char *msg)
 {
 #   if defined(MSWIN32)
@@ -1245,7 +1247,8 @@ void GC_abort(const char *msg)
             for(;;) {}
     }
 #   if defined(MSWIN32) && defined(NO_DEBUGGING)
-        /* A more user-friendly abort after showing fatal message.      */
+      /* A more user-friendly abort after showing fatal message.        */
+      if (msg) /* to suppress compiler warnings in ABORT callers. */
         _exit(-1); /* exit on error without running "at-exit" callbacks */
 #   elif defined(MSWIN32) || defined(MSWINCE)
         DebugBreak();
index 93e452ac72b4426fc044337bf32e086085d7fcf5..c38aa61f6fefe591817585f4478ca18ecd893218 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -1387,7 +1387,7 @@ void GC_register_data_segments(void)
          /* This is a Windows NT derivative, i.e. NT, W2K, XP or later.  */
 
 # ifdef USE_MUNMAP
-    extern int GC_unmap_threshold; /* defined in allchblk.c     */
+    int GC_unmap_threshold; /* defined in allchblk.c */
 # endif
 
   void GC_init_win32(void)
@@ -2221,19 +2221,16 @@ 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;
 
 void GC_default_push_other_roots(void)
 {
     /* Traverse data allocated by previous memory managers.             */
-        {
-          extern struct PCR_MM_ProcsRep * GC_old_allocator;
-
           if ((*(GC_old_allocator->mmp_enumerate))(PCR_Bool_false,
                                                    GC_push_old_obj, 0)
               != PCR_ERes_okay) {
               ABORT("Old object enumeration failed");
           }
-        }
     /* Traverse all thread stacks. */
         if (PCR_ERes_IsErr(
                 PCR_ThCtl_ApplyToAllOtherThreads(GC_push_thread_stack,0))
@@ -2247,7 +2244,7 @@ void GC_default_push_other_roots(void)
 
 # if defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)
 
-extern void GC_push_all_stacks(void);
+void GC_push_all_stacks(void);
 
 STATIC void GC_default_push_other_roots(void)
 {
@@ -3469,7 +3466,7 @@ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree)
 #include <mach/task.h>
 #include <pthread.h>
 
-extern void GC_darwin_register_mach_handler_thread(mach_port_t);
+void GC_darwin_register_mach_handler_thread(mach_port_t);
 
 /* These are not defined in any header, although they are documented */
 extern boolean_t
index b2d9518ad387d50f12f098231cb43ccab7f37b53..6691c26c72daa159d44cddc210c628622a6bebda 100644 (file)
@@ -309,7 +309,7 @@ STATIC void * GC_mark_thread(void * id)
   }
 }
 
-extern long GC_markers;         /* Number of mark threads we would      */
+long GC_markers;                /* Number of mark threads we would      */
                                 /* like to have.  Includes the          */
                                 /* initiating thread.                   */
 
@@ -643,7 +643,7 @@ STATIC int GC_get_nprocs(void)
 /* If wait_for_all is true, then we exit with the GC lock held and no   */
 /* collection in progress; otherwise we just wait for the current GC    */
 /* to finish.                                                           */
-extern GC_bool GC_collection_in_progress(void);
+GC_bool GC_collection_in_progress(void);
 STATIC void GC_wait_for_gc_completion(GC_bool wait_for_all)
 {
     GC_ASSERT(I_HOLD_LOCK());
index 5621db8fb3397e0c0348cf40c92df0add305ab01..ace1be51a85f516cd0977596895b9826233363ff 100644 (file)
@@ -99,7 +99,7 @@ int realloc_count = 0;
 
 #if defined(GC_AMIGA_FASTALLOC) && defined(AMIGA)
 
-  extern void GC_amiga_free_all_mem(void);
+  void GC_amiga_free_all_mem(void);
   void Amiga_Fail(void){GC_amiga_free_all_mem();abort();}
 # define FAIL (void)Amiga_Fail()
   void *GC_amiga_gctest_malloc_explicitly_typed(size_t lb, GC_descr d){
index 0045e1edfc802821c4a89c5bc4f29a111faf33c3..f377eaac51007864c9f9e5c13d2a2f09222c6840 100644 (file)
@@ -111,7 +111,7 @@ void GC_init_thread_local(GC_tlfs p)
 }
 
 #ifdef GC_GCJ_SUPPORT
-  extern ptr_t * GC_gcjobjfreelist;
+  ptr_t * GC_gcjobjfreelist;
 #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
-  extern GC_bool GC_gcj_malloc_initialized;
+  GC_bool GC_gcj_malloc_initialized;
 #endif
 
-extern int GC_gcj_kind;
+int GC_gcj_kind;
 
 /* Gcj-style allocation without locks is extremely tricky.  The         */
 /* fundamental issue is that we may end up marking a free list, which   */
index 3392755f15192627bdb65ea2b2893f6591636478..3e2662d69e384d95e771791bf30c725e27eec186 100644 (file)
@@ -354,11 +354,10 @@ STATIC GC_thread GC_new_thread(DWORD id)
   return(result);
 }
 
-extern LONG WINAPI GC_write_fault_handler(
-                                struct _EXCEPTION_POINTERS *exc_info);
+LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
 
 #if defined(GWW_VDB) && defined(MPROTECT_VDB)
-  extern GC_bool GC_gww_dirty_init(void);
+  GC_bool GC_gww_dirty_init(void);
   /* Defined in os_dep.c.  Returns TRUE if GetWriteWatch is available.  */
   /* may be called repeatedly.                                          */
 #endif
@@ -924,7 +923,7 @@ void GC_push_thread_structures(void)
 
 #if defined(MPROTECT_VDB)
 # include "atomic_ops.h"
-  extern volatile AO_TS_t GC_fault_handler_lock;  /* from os_dep.c */
+  volatile AO_TS_t GC_fault_handler_lock; /* from os_dep.c */
 #endif
 
 /* Suspend the given thread, if it's still active.      */
@@ -976,9 +975,8 @@ STATIC void GC_suspend(GC_thread t)
 # endif
 }
 
-/* Defined in misc.c */
 #ifndef CYGWIN32
-  extern CRITICAL_SECTION GC_write_cs;
+  CRITICAL_SECTION GC_write_cs; /* defined in misc.c */
 #endif
 
 void GC_stop_world(void)
@@ -1316,7 +1314,7 @@ void GC_push_all_stacks(void)
 #   define MAX_MARKERS 16
 # endif
 
-  extern long GC_markers;       /* Number of mark threads we would      */
+  long GC_markers;              /* Number of mark threads we would      */
                                 /* like to have.  Includes the          */
                                 /* initiating thread.                   */