2009-10-19 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Mon, 19 Oct 2009 15:06:58 +0000 (15:06 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:51 +0000 (21:06 +0400)
* include/private/gc_priv.h (GC_INNER): New macro (for GC-scope
variable definitions).
* include/private/gc_priv.h (GC_EXTERN): Update the comment.
* allchblk.c (GC_unmap_threshold): Define as GC_INNER.
* alloc.c (GC_incremental, GC_world_stopped, GC_n_heap_sects,
GC_n_memory, GC_fail_count): Ditto.
* blacklst.c (GC_black_list_spacing, GC_print_heap_obj): Ditto.
* gcj_mlc.c (GC_gcj_malloc_initialized, GC_gcjobjfreelist): Ditto.
* mach_dep.c (GC_save_regs_ret_val): Ditto.
* mark.c (GC_n_mark_procs, GC_obj_kinds, GC_n_kinds,
GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_size,
GC_mark_stack_top, GC_mark_state, GC_mark_stack_too_small,
GC_mark_no, GC_markers): Ditto.
* mark_rts.c (GC_root_size, GC_push_typed_structures): Ditto.
* misc.c (GC_allocate_ml, GC_debugging_started, GC_check_heap,
GC_print_all_smashed, GC_print_back_height, GC_dump_regularly,
GC_backtraces, GC_force_unmap_on_gcollect,
GC_large_alloc_warn_interval, GC_is_initialized, GC_write_cs,
GC_current_warn_proc, GC_blocked_sp, GC_activation_frame): Ditto.
* os_dep.c (GC_page_size, GC_dont_query_stack_min,
GC_no_win32_dlls, GC_wnt, GC_sysinfo, GC_push_other_roots,
GC_dirty_maintained, GC_fault_handler_lock): Ditto.
* pthread_support.c (GC_allocate_ml, GC_lock_holder,
GC_need_to_lock, GC_thr_initialized, GC_threads,
GC_in_thread_creation, GC_collecting, GC_allocate_lock,
GC_mark_lock_holder): Ditto.
* reclaim.c (GC_bytes_found, GC_fl_builder_count, GC_have_errors):
Ditto.
* win32_threads.c (GC_allocate_ml, GC_lock_holder,
GC_need_to_lock, GC_mark_lock_holder, GC_collecting): Ditto.
* extra/gc.c (GC_INNER, GC_EXTERN): Define as STATIC.
* mach_dep.c (GC_with_callee_saves_pushed): Remove redundant {}.
* os_dep.c (GC_init_win32): Reformat the comment.

15 files changed:
ChangeLog
allchblk.c
alloc.c
blacklst.c
extra/gc.c
gcj_mlc.c
include/private/gc_priv.h
mach_dep.c
mark.c
mark_rts.c
misc.c
os_dep.c
pthread_support.c
reclaim.c
win32_threads.c

index 3398cd8..3f80f1e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,41 @@
 2009-10-19  Ivan Maidanski <ivmai@mail.ru>
 
+       * include/private/gc_priv.h (GC_INNER): New macro (for GC-scope
+       variable definitions).
+       * include/private/gc_priv.h (GC_EXTERN): Update the comment.
+       * allchblk.c (GC_unmap_threshold): Define as GC_INNER.
+       * alloc.c (GC_incremental, GC_world_stopped, GC_n_heap_sects,
+       GC_n_memory, GC_fail_count): Ditto.
+       * blacklst.c (GC_black_list_spacing, GC_print_heap_obj): Ditto.
+       * gcj_mlc.c (GC_gcj_malloc_initialized, GC_gcjobjfreelist): Ditto.
+       * mach_dep.c (GC_save_regs_ret_val): Ditto.
+       * mark.c (GC_n_mark_procs, GC_obj_kinds, GC_n_kinds,
+       GC_mark_stack, GC_mark_stack_limit, GC_mark_stack_size,
+       GC_mark_stack_top, GC_mark_state, GC_mark_stack_too_small,
+       GC_mark_no, GC_markers): Ditto.
+       * mark_rts.c (GC_root_size, GC_push_typed_structures): Ditto.
+       * misc.c (GC_allocate_ml, GC_debugging_started, GC_check_heap,
+       GC_print_all_smashed, GC_print_back_height, GC_dump_regularly,
+       GC_backtraces, GC_force_unmap_on_gcollect,
+       GC_large_alloc_warn_interval, GC_is_initialized, GC_write_cs,
+       GC_current_warn_proc, GC_blocked_sp, GC_activation_frame): Ditto.
+       * os_dep.c (GC_page_size, GC_dont_query_stack_min,
+       GC_no_win32_dlls, GC_wnt, GC_sysinfo, GC_push_other_roots,
+       GC_dirty_maintained, GC_fault_handler_lock): Ditto.
+       * pthread_support.c (GC_allocate_ml, GC_lock_holder,
+       GC_need_to_lock, GC_thr_initialized, GC_threads,
+       GC_in_thread_creation, GC_collecting, GC_allocate_lock,
+       GC_mark_lock_holder): Ditto.
+       * reclaim.c (GC_bytes_found, GC_fl_builder_count, GC_have_errors):
+       Ditto.
+       * win32_threads.c (GC_allocate_ml, GC_lock_holder,
+       GC_need_to_lock, GC_mark_lock_holder, GC_collecting): Ditto.
+       * extra/gc.c (GC_INNER, GC_EXTERN): Define as STATIC.
+       * mach_dep.c (GC_with_callee_saves_pushed): Remove redundant {}.
+       * os_dep.c (GC_init_win32): Reformat the comment.
+
+2009-10-19  Ivan Maidanski <ivmai@mail.ru>
+
        * include/private/gc_priv.h (GC_bytes_allocd, GC_objfreelist,
        GC_aobjfreelist): Replace GC_EXTERN to extern for SEPARATE_GLOBALS
        case (since they are not defined inside GC at present).
index 67a4be6..84ed4d2 100644 (file)
@@ -386,7 +386,7 @@ STATIC void GC_add_to_fl(struct hblk *h, hdr *hhdr)
 #     define MUNMAP_THRESHOLD 6
 #   endif
 
-int GC_unmap_threshold = MUNMAP_THRESHOLD;
+GC_INNER int GC_unmap_threshold = MUNMAP_THRESHOLD;
 
 /* Unmap blocks that haven't been recently touched.  This is the only way */
 /* way blocks are ever unmapped.                                          */
diff --git a/alloc.c b/alloc.c
index 5a95308..da93a93 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -59,7 +59,7 @@ word GC_non_gc_bytes = 0;  /* Number of bytes not intended to be collected */
 word GC_gc_no = 0;
 
 #ifndef SMALL_CONFIG
-  int GC_incremental = 0;  /* By default, stop the world.       */
+  GC_INNER int GC_incremental = 0;      /* By default, stop the world.  */
 #endif
 
 int GC_parallel = FALSE;   /* By default, parallel GC is off.   */
@@ -76,7 +76,7 @@ STATIC GC_bool GC_need_full_gc = FALSE;
                            /* Need full GC do to heap growth.   */
 
 #ifdef THREAD_LOCAL_ALLOC
-  GC_bool GC_world_stopped = FALSE;
+  GC_INNER GC_bool GC_world_stopped = FALSE;
 #endif
 
 STATIC word GC_used_heap_size_after_full = 0;
@@ -967,11 +967,12 @@ GC_API void GC_CALL GC_gcollect_and_unmap(void)
     (void)GC_try_to_collect_general(GC_never_stop_func, TRUE);
 }
 
-word GC_n_heap_sects = 0;       /* Number of sections currently in heap. */
+GC_INNER word GC_n_heap_sects = 0;
+                        /* Number of sections currently in heap. */
 
 #ifdef USE_PROC_FOR_LIBRARIES
-  word GC_n_memory = 0;         /* Number of GET_MEM allocated memory   */
-                                /* sections.                            */
+  GC_INNER word GC_n_memory = 0;
+                        /* Number of GET_MEM allocated memory sections. */
 #endif
 
 #ifdef USE_PROC_FOR_LIBRARIES
@@ -1173,7 +1174,7 @@ GC_API int GC_CALL GC_expand_hp(size_t bytes)
     return(result);
 }
 
-unsigned GC_fail_count = 0;
+GC_INNER unsigned GC_fail_count = 0;
                         /* How many consecutive GC/expansion failures?  */
                         /* Reset by GC_allochblk.                       */
 
index e93b7bd..3e7316d 100644 (file)
@@ -49,7 +49,8 @@ STATIC word * GC_incomplete_stack_bl = NULL;
 STATIC word GC_total_stack_black_listed = 0;
                         /* Number of bytes on stack blacklist.  */
 
-word GC_black_list_spacing = MINHINCR*HBLKSIZE;  /* Initial rough guess */
+GC_INNER word GC_black_list_spacing = MINHINCR * HBLKSIZE;
+                        /* Initial rough guess. */
 
 void GC_clear_bl(word *);
 
@@ -61,7 +62,7 @@ void GC_default_print_heap_obj_proc(ptr_t p)
                   (unsigned long)GC_size(base));
 }
 
-void (*GC_print_heap_obj) (ptr_t p) = GC_default_print_heap_obj_proc;
+GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc;
 
 #ifdef PRINT_BLACK_LIST
 STATIC void GC_print_source_ptr(ptr_t p)
index 3baa4e5..08def0c 100644 (file)
 /* This file is not well tested (for now). */
 
 
+#define GC_INNER STATIC
+#define GC_EXTERN GC_INNER
+                /* STATIC is defined in gcconfig.h. */
+
 /* Small files go first... */
 #include "../backgraph.c"
 #include "../blacklst.c"
index e5c0bac..ea761cf 100644 (file)
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -40,7 +40,7 @@
 #include "gc_gcj.h"
 #include "private/dbg_mlc.h"
 
-GC_bool GC_gcj_malloc_initialized = FALSE;
+GC_INNER GC_bool GC_gcj_malloc_initialized = FALSE;
 
 int GC_gcj_kind = 0;    /* Object kind for objects with descriptors     */
                         /* in "vtable".                                 */
@@ -48,7 +48,8 @@ int GC_gcj_debug_kind = 0;
                         /* The kind of objects that is always marked    */
                         /* with a mark proc call.                       */
 
-ptr_t * GC_gcjobjfreelist = NULL;
+GC_INNER ptr_t * GC_gcjobjfreelist = NULL;
+
 STATIC ptr_t * GC_gcjdebugobjfreelist = NULL;
 
 /*ARGSUSED*/
index 18143e4..51fc456 100644 (file)
@@ -86,6 +86,7 @@ typedef char * ptr_t;   /* A generic pointer to which we can add        */
   /* the debugging-only or profiling-only variables.  Currently, not    */
   /* used for the variables accessed from the "dated" source files      */
   /* (pcr_interface.c, specific.c/h, and in the "extra" folder).        */
+  /* The corresponding variable definition must start with GC_INNER.    */
 # if defined(GC_DLL) && defined(__GNUC__) && !defined(MSWIN32) \
         && !defined(MSWINCE)
 #   if __GNUC__ >= 4
@@ -100,6 +101,12 @@ typedef char * ptr_t;   /* A generic pointer to which we can add        */
 # endif
 #endif
 
+#ifndef GC_INNER
+  /* This tagging macro must be used at the start of every variable     */
+  /* definition which is declared with GC_EXTERN.                       */
+# define GC_INNER /* empty */
+#endif
+
 #ifndef HEADERS_H
 # include "gc_hdrs.h"
 #endif
index 56e3ed2..e8fdb1f 100644 (file)
@@ -65,7 +65,7 @@ asm static void PushMacRegisters()
 # if defined(SPARC) || defined(IA64)
     /* Value returned from register flushing routine; either sp (SPARC) */
     /* or ar.bsp (IA64).                                                */
-    ptr_t GC_save_regs_ret_val = NULL;
+    GC_INNER ptr_t GC_save_regs_ret_val = NULL;
 # endif
 
 /* Routine to mark from registers that are preserved by the C compiler. */
@@ -198,9 +198,7 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
         /* On a register window machine, we need to save register       */
         /* contents on the stack for this to work.  This may already be */
         /* subsumed by the getcontext() call.                           */
-        {
-          GC_save_regs_ret_val = GC_save_regs_in_stack();
-        }
+        GC_save_regs_ret_val = GC_save_regs_in_stack();
 #     endif /* register windows. */
 #   elif defined(HAVE_BUILTIN_UNWIND_INIT) && \
          !(defined(POWERPC) && defined(DARWIN))
diff --git a/mark.c b/mark.c
index 949ed27..0b4bb60 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -44,13 +44,13 @@ GC_API void GC_CALL GC_noop1(word x)
 
 /* mark_proc GC_mark_procs[MAX_MARK_PROCS] = {0} -- declared in gc_priv.h */
 
-unsigned GC_n_mark_procs = GC_RESERVED_MARK_PROCS;
+GC_INNER unsigned GC_n_mark_procs = GC_RESERVED_MARK_PROCS;
 
 /* Initialize GC_obj_kinds properly and standard free lists properly.   */
 /* This must be done statically since they may be accessed before       */
 /* GC_init is called.                                                   */
 /* It's done here, since we need to deal with mark descriptors.         */
-struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
+GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
 /* PTRFREE */ { &GC_aobjfreelist[0], 0 /* filled in dynamically */,
                 0 | GC_DS_LENGTH, FALSE, FALSE },
 /* NORMAL  */ { &GC_objfreelist[0], 0,
@@ -84,7 +84,7 @@ struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
 #   endif
 # endif
 
-unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE;
+GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE;
 
 # ifndef INITIAL_MARK_STACK_SIZE
 #   define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE)
@@ -106,12 +106,12 @@ STATIC word GC_n_rescuing_pages = 0;
                                 /* Number of dirty pages we marked from */
                                 /* excludes ptrfree pages, etc.         */
 
-mse * GC_mark_stack = NULL;
-mse * GC_mark_stack_limit = NULL;
-size_t GC_mark_stack_size = 0;
+GC_INNER mse * GC_mark_stack = NULL;
+GC_INNER mse * GC_mark_stack_limit = NULL;
+GC_INNER size_t GC_mark_stack_size = 0;
 
 #ifdef PARALLEL_MARK
-  mse * volatile GC_mark_stack_top = NULL;
+  GC_INNER mse * volatile GC_mark_stack_top = NULL;
         /* Updated only with mark lock held, but read asynchronously.   */
   STATIC volatile AO_t GC_first_nonempty = 0;
         /* Lowest entry on mark stack   */
@@ -119,12 +119,12 @@ size_t GC_mark_stack_size = 0;
         /* Updated only by initiating   */
         /* thread.                      */
 #else
-  mse * GC_mark_stack_top = NULL;
+  GC_INNER mse * GC_mark_stack_top = NULL;
 #endif
 
-mark_state_t GC_mark_state = MS_NONE;
+GC_INNER mark_state_t GC_mark_state = MS_NONE;
 
-GC_bool GC_mark_stack_too_small = FALSE;
+GC_INNER GC_bool GC_mark_stack_too_small = FALSE;
 
 static struct hblk * scan_ptr;
 
@@ -888,7 +888,7 @@ STATIC unsigned GC_active_count = 0;    /* Number of active helpers.    */
                                         /* once it returns to 0, it     */
                                         /* stays zero for the cycle.    */
 
-word GC_mark_no = 0;
+GC_INNER word GC_mark_no = 0;
 
 #define LOCAL_MARK_STACK_SIZE HBLKSIZE
         /* Under normal circumstances, this is big enough to guarantee  */
@@ -1011,7 +1011,7 @@ STATIC void GC_do_local_mark(mse *local_mark_stack, mse *local_top)
 
 #define ENTRIES_TO_GET 5
 
-long GC_markers = 2;            /* Normally changed by thread-library-  */
+GC_INNER long GC_markers = 2;   /* Normally changed by thread-library-  */
                                 /* -specific code.                      */
 
 /* Mark using the local mark stack until the global mark stack is empty */
index a2d15f7..62bc041 100644 (file)
@@ -132,7 +132,7 @@ GC_INLINE void add_roots_to_index(struct roots *p)
 
 # endif
 
-word GC_root_size = 0;
+GC_INNER word GC_root_size = 0;
 
 GC_API void GC_CALL GC_add_roots(void *b, void *e)
 {
@@ -669,7 +669,7 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
 #   endif /* !THREADS */
 }
 
-void (*GC_push_typed_structures) (void) = 0;
+GC_INNER void (*GC_push_typed_structures)(void) = 0;
 
                         /* Push GC internal roots.  These are normally  */
                         /* included in the static data segment, and     */
diff --git a/misc.c b/misc.c
index eb6ab79..e3ae946 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -45,7 +45,7 @@
 
 #if defined(THREADS) && defined(PCR)
 # include "il/PCR_IL.h"
-  PCR_Th_ML GC_allocate_ml;
+  GC_INNER PCR_Th_ML GC_allocate_ml;
 #endif
 /* For other platforms with threads, the lock and possibly              */
 /* GC_lock_holder variables are defined in the thread support code.     */
 GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */;
 
 
-GC_bool GC_debugging_started = FALSE;
+GC_INNER GC_bool GC_debugging_started = FALSE;
         /* defined here so we don't have to load debug_malloc.o */
 
-void (*GC_check_heap) (void) = 0;
-void (*GC_print_all_smashed) (void) = 0;
+GC_INNER void (*GC_check_heap)(void) = 0;
+GC_INNER void (*GC_print_all_smashed)(void) = 0;
 
 ptr_t GC_stackbottom = 0;
 
@@ -87,15 +87,16 @@ GC_bool GC_quiet = 0; /* used also in pcr_interface.c */
   GC_bool GC_print_stats = 0;
 #endif
 
-GC_bool GC_print_back_height = 0;
+GC_INNER GC_bool GC_print_back_height = 0;
 
 #ifndef NO_DEBUGGING
-  GC_bool GC_dump_regularly = 0;  /* Generate regular debugging dumps. */
+  GC_INNER GC_bool GC_dump_regularly = 0;
+                                /* Generate regular debugging dumps. */
 #endif
 
 #ifdef KEEP_BACK_PTRS
-  long GC_backtraces = 0;       /* Number of random backtraces to       */
-                                /* generate for each GC.                */
+  GC_INNER long GC_backtraces = 0;
+                /* Number of random backtraces to generate for each GC. */
 #endif
 
 #ifdef FIND_LEAK
@@ -113,16 +114,16 @@ GC_bool GC_print_back_height = 0;
 #ifdef GC_FORCE_UNMAP_ON_GCOLLECT
   /* Has no effect unless USE_MUNMAP.                           */
   /* Has no effect on implicitly-initiated garbage collections. */
-  GC_bool GC_force_unmap_on_gcollect = TRUE;
+  GC_INNER GC_bool GC_force_unmap_on_gcollect = TRUE;
 #else
-  GC_bool GC_force_unmap_on_gcollect = FALSE;
+  GC_INNER GC_bool GC_force_unmap_on_gcollect = FALSE;
 #endif
 
 #ifndef GC_LARGE_ALLOC_WARN_INTERVAL
 # define GC_LARGE_ALLOC_WARN_INTERVAL 5
 #endif
-long GC_large_alloc_warn_interval = GC_LARGE_ALLOC_WARN_INTERVAL;
-        /* Interval between unsuppressed warnings.      */
+GC_INNER long GC_large_alloc_warn_interval = GC_LARGE_ALLOC_WARN_INTERVAL;
+                        /* Interval between unsuppressed warnings.      */
 
 /*ARGSUSED*/
 STATIC void * GC_CALLBACK GC_default_oom_fn(size_t bytes_requested)
@@ -449,14 +450,14 @@ GC_API size_t GC_CALL GC_get_total_bytes(void)
     return value;
 }
 
-GC_bool GC_is_initialized = FALSE;
+GC_INNER GC_bool GC_is_initialized = FALSE;
 
 # if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
     void GC_init_parallel(void);
 # endif /* PARALLEL_MARK || THREAD_LOCAL_ALLOC */
 
 #if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
-    CRITICAL_SECTION GC_write_cs;
+    GC_INNER CRITICAL_SECTION GC_write_cs;
 #endif
 
 #ifdef MSWIN32
@@ -1180,7 +1181,7 @@ STATIC void GC_CALLBACK GC_default_warn_proc(char *msg, GC_word arg)
     GC_err_printf(msg, arg);
 }
 
-GC_warn_proc GC_current_warn_proc = GC_default_warn_proc;
+GC_INNER GC_warn_proc GC_current_warn_proc = GC_default_warn_proc;
 
 /* This is recommended for production code (release). */
 GC_API void GC_CALLBACK GC_ignore_warn_proc(char *msg, GC_word arg)
@@ -1359,13 +1360,13 @@ void GC_do_blocking_inner(ptr_t data, void * context);
 
 #else
 
-ptr_t GC_blocked_sp = NULL;
+GC_INNER ptr_t GC_blocked_sp = NULL;
         /* NULL value means we are not inside GC_do_blocking() call. */
 # ifdef IA64
     STATIC ptr_t GC_blocked_register_sp = NULL;
 # endif
 
-struct GC_activation_frame_s *GC_activation_frame = NULL;
+GC_INNER struct GC_activation_frame_s *GC_activation_frame = NULL;
 
 /* This is nearly the same as in win32_threads.c        */
 GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
index 9ec5e68..3a8c7a9 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -599,7 +599,7 @@ struct o32_obj {
 # endif /* OS/2 */
 
 /* Find the page size */
-word GC_page_size = 0;
+GC_INNER word GC_page_size = 0;
 
 # if defined(MSWIN32) || defined(MSWINCE)
 
@@ -608,7 +608,7 @@ word GC_page_size = 0;
 #   endif
 
 #   if defined(MSWINCE) && defined(THREADS)
-      GC_bool GC_dont_query_stack_min = FALSE;
+      GC_INNER GC_bool GC_dont_query_stack_min = FALSE;
 #   endif
 
     void GC_setpagesize(void)
@@ -1410,19 +1410,18 @@ void GC_register_data_segments(void)
   /* and all real work is done by GC_register_dynamic_libraries.  Under */
   /* win32s, we cannot find the data segments associated with dll's.    */
   /* We register the main data segment here.                            */
-  GC_bool GC_no_win32_dlls = FALSE;
+  GC_INNER GC_bool GC_no_win32_dlls = FALSE;
         /* This used to be set for gcc, to avoid dealing with           */
         /* the structured exception handling issues.  But we now have   */
         /* assembly code to do that right.                              */
 
-  GC_bool GC_wnt = FALSE;
-         /* This is a Windows NT derivative, i.e. NT, W2K, XP or later.  */
+  GC_INNER GC_bool GC_wnt = FALSE;
+         /* This is a Windows NT derivative, i.e. NT, W2K, XP or later. */
 
   void GC_init_win32(void)
   {
-    /* Set GC_wnt.                                                       */
-    /* If we're running under win32s, assume that no DLLs will be loaded */
-    /* I doubt anyone still runs win32s, but ...                         */
+    /* Set GC_wnt.  If we're running under win32s, assume that no DLLs  */
+    /* will be loaded.  I doubt anyone still runs win32s, but...        */
     DWORD v = GetVersion();
     GC_wnt = !(v & 0x80000000);
     GC_no_win32_dlls |= ((!GC_wnt) && (v & 0xff) <= 3);
@@ -1904,7 +1903,7 @@ void * os2_alloc(size_t bytes)
 
 
 # if defined(MSWIN32) || defined(MSWINCE)
-    SYSTEM_INFO GC_sysinfo;
+    GC_INNER SYSTEM_INFO GC_sysinfo;
 # endif
 
 # ifdef MSWIN32
@@ -2124,7 +2123,6 @@ void GC_unmap(ptr_t start, size_t bytes)
 #   endif
 }
 
-
 void GC_remap(ptr_t start, size_t bytes)
 {
     ptr_t start_addr = GC_unmap_start(start, bytes);
@@ -2225,7 +2223,7 @@ void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, size_t bytes2)
 /* environment, this is also responsible for marking from       */
 /* thread stacks.                                               */
 #ifndef THREADS
-void (*GC_push_other_roots)(void) = 0;
+  GC_INNER void (*GC_push_other_roots)(void) = 0;
 #else /* THREADS */
 
 # ifdef PCR
@@ -2282,7 +2280,7 @@ STATIC void GC_default_push_other_roots(void)
 
 # endif /* GC_WIN32_THREADS || GC_PTHREADS */
 
-void (*GC_push_other_roots)(void) = GC_default_push_other_roots;
+  GC_INNER void (*GC_push_other_roots)(void) = GC_default_push_other_roots;
 
 #endif /* THREADS */
 
@@ -2325,7 +2323,7 @@ void (*GC_push_other_roots)(void) = GC_default_push_other_roots;
  *              are running on Windows 95, Windows 2000 or earlier),
  *              MPROTECT_VDB may be defined as a fallback strategy.
  */
-GC_bool GC_dirty_maintained = FALSE;
+GC_INNER GC_bool GC_dirty_maintained = FALSE;
 
 #if defined(PROC_VDB) || defined(GWW_VDB)
 
@@ -2696,7 +2694,7 @@ STATIC GC_bool GC_old_segv_handler_used_si = FALSE;
 /* Contention should be very rare, so we do the minimum to handle it    */
 /* correctly.                                                           */
 #ifdef AO_HAVE_test_and_set_acquire
-  volatile AO_TS_t GC_fault_handler_lock = 0;
+  GC_INNER volatile AO_TS_t GC_fault_handler_lock = 0;
   static void async_set_pht_entry_from_index(volatile page_hash_table db,
                                              size_t index)
   {
index b4ec1a1..a68889a 100644 (file)
 #if defined(GC_NETBSD_THREADS)
 # include <sys/param.h>
 # include <sys/sysctl.h>
-#endif        /* GC_NETBSD_THREADS */
+#endif /* GC_NETBSD_THREADS */
 
 /* Allocator lock definitions.          */
 #if !defined(USE_SPIN_LOCK)
-  pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
+  GC_INNER pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
 #endif
-unsigned long GC_lock_holder = NO_THREAD;
+GC_INNER unsigned long GC_lock_holder = NO_THREAD;
                 /* Used only for assertions, and to prevent      */
                 /* recursive reentry in the system call wrapper. */
 
@@ -219,7 +219,7 @@ void GC_thr_init(void);
 
 static GC_bool parallel_initialized = FALSE;
 
-GC_bool GC_need_to_lock = FALSE;
+GC_INNER GC_bool GC_need_to_lock = FALSE;
 
 void GC_init_parallel(void);
 
@@ -367,9 +367,9 @@ static void start_mark_threads(void)
 
 #endif /* PARALLEL_MARK */
 
-GC_bool GC_thr_initialized = FALSE;
+GC_INNER GC_bool GC_thr_initialized = FALSE;
 
-volatile GC_thread GC_threads[THREAD_TABLE_SZ] = {0};
+GC_INNER volatile GC_thread GC_threads[THREAD_TABLE_SZ] = {0};
 
 void GC_push_thread_structures(void)
 {
@@ -1133,7 +1133,8 @@ GC_API int WRAP_FUNC(pthread_detach)(pthread_t thread)
     return result;
 }
 
-GC_bool GC_in_thread_creation = FALSE;  /* Protected by allocation lock. */
+GC_INNER GC_bool GC_in_thread_creation = FALSE;
+                                /* Protected by allocation lock. */
 
 STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
                                              pthread_t my_pthread)
@@ -1384,7 +1385,7 @@ STATIC void GC_pause(void)
 #define SPIN_MAX 128    /* Maximum number of calls to GC_pause before   */
                         /* give up.                                     */
 
-volatile GC_bool GC_collecting = 0;
+GC_INNER volatile GC_bool GC_collecting = 0;
                         /* A hint that we're in the collector and       */
                         /* holding the allocation lock for an           */
                         /* extended period.                             */
@@ -1457,7 +1458,7 @@ STATIC void GC_generic_lock(pthread_mutex_t * lock)
 /* as STL alloc.h.  This isn't really the right way to do this.   */
 /* but until the POSIX scheduling mess gets straightened out ...  */
 
-volatile AO_TS_t GC_allocate_lock = 0;
+GC_INNER volatile AO_TS_t GC_allocate_lock = 0;
 
 void GC_lock(void)
 {
@@ -1540,7 +1541,7 @@ void GC_lock(void)
 #ifdef PARALLEL_MARK
 
 #ifdef GC_ASSERTIONS
-  unsigned long GC_mark_lock_holder = NO_THREAD;
+  GC_INNER unsigned long GC_mark_lock_holder = NO_THREAD;
 #endif
 
 #if 0
index efa49a5..fe5acf8 100644 (file)
--- a/reclaim.c
+++ b/reclaim.c
 #include <stdio.h>
 #include "private/gc_priv.h"
 
-signed_word GC_bytes_found = 0;
+GC_INNER signed_word GC_bytes_found = 0;
                         /* Number of bytes of memory reclaimed     */
                         /* minus the number of bytes originally    */
                         /* on free lists which we had to drop.     */
 
 #if defined(PARALLEL_MARK)
-  word GC_fl_builder_count = 0;
+  GC_INNER word GC_fl_builder_count = 0;
         /* Number of threads currently building free lists without      */
         /* holding GC lock.  It is not safe to collect if this is       */
         /* nonzero.                                                     */
@@ -36,7 +36,7 @@ signed_word GC_bytes_found = 0;
 STATIC ptr_t GC_leaked[MAX_LEAKED] = { NULL };
 STATIC unsigned GC_n_leaked = 0;
 
-GC_bool GC_have_errors = FALSE;
+GC_INNER GC_bool GC_have_errors = FALSE;
 
 STATIC void GC_add_leaked(ptr_t leaked)
 {
index 1ca9d32..dd8268b 100644 (file)
 
 /* Allocation lock declarations.        */
 #if !defined(USE_PTHREAD_LOCKS)
-  CRITICAL_SECTION GC_allocate_ml;
-  DWORD GC_lock_holder = NO_THREAD;
+  GC_INNER CRITICAL_SECTION GC_allocate_ml;
+  GC_INNER DWORD GC_lock_holder = NO_THREAD;
         /* Thread id for current holder of allocation lock */
 #else
-  pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
-  unsigned long GC_lock_holder = NO_THREAD;
+  GC_INNER pthread_mutex_t GC_allocate_ml = PTHREAD_MUTEX_INITIALIZER;
+  GC_INNER unsigned long GC_lock_holder = NO_THREAD;
 #endif
 
 #ifdef GC_PTHREADS
@@ -151,7 +151,7 @@ typedef LONG * IE_t;
 
 STATIC GC_bool GC_thr_initialized = FALSE;
 
-GC_bool GC_need_to_lock = FALSE;
+GC_INNER GC_bool GC_need_to_lock = FALSE;
 
 static GC_bool parallel_initialized = FALSE;
 
@@ -1473,7 +1473,7 @@ void GC_get_next_stack(char *start, char *limit,
   }
 
 # ifdef GC_ASSERTIONS
-    unsigned long GC_mark_lock_holder = NO_THREAD;
+    GC_INNER unsigned long GC_mark_lock_holder = NO_THREAD;
 # endif
 
   /* GC_mark_threads[] is unused here unlike that in pthread_support.c  */
@@ -2608,7 +2608,7 @@ void GC_init_parallel(void)
   /* Pthread_mutex_try_lock may not win here,   */
   /* due to builtin support for spinning first? */
 
-  volatile GC_bool GC_collecting = 0;
+  GC_INNER volatile GC_bool GC_collecting = 0;
                         /* A hint that we're in the collector and       */
                         /* holding the allocation lock for an           */
                         /* extended period.                             */