2009-10-19 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Mon, 19 Oct 2009 14:17:03 +0000 (14:17 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:50 +0000 (21:06 +0400)
* 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).
* include/private/gc_priv.h (GC_objects_are_marked): Remove the
declaration (since made static).
* mark.c (GC_objects_are_marked): Define as STATIC.
* win32_threads.c (GC_thr_initialized, GC_in_thread_creation):
Ditto.
* mark.c (GC_N_KINDS_INITIAL_VALUE): New macro (defined and used
to initialize GC_n_kinds).
* win32_threads.c (start_mark_threads): Adjust the comment.

ChangeLog
include/private/gc_priv.h
mark.c
win32_threads.c

index 82f9501..3398cd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 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).
+       * include/private/gc_priv.h (GC_objects_are_marked): Remove the
+       declaration (since made static).
+       * mark.c (GC_objects_are_marked): Define as STATIC.
+       * win32_threads.c (GC_thr_initialized, GC_in_thread_creation):
+       Ditto.
+       * mark.c (GC_N_KINDS_INITIAL_VALUE): New macro (defined and used
+       to initialize GC_n_kinds).
+       * win32_threads.c (start_mark_threads): Adjust the comment.
+
+2009-10-19  Ivan Maidanski <ivmai@mail.ru>
+
        * alloc.c (GC_notify_full_gc): Use GC_INLINE for a tiny static
        function.
        * backgraph.c (pop_in_progress, GC_apply_to_each_object): Ditto.
index 5ca40ae..18143e4 100644 (file)
@@ -1227,14 +1227,14 @@ GC_EXTERN struct obj_kind {
 /* introduce maintenance problems.                                      */
 
 #ifdef SEPARATE_GLOBALS
-  GC_EXTERN word GC_bytes_allocd;
+  extern word GC_bytes_allocd;
         /* Number of words allocated during this collection cycle */
-  GC_EXTERN ptr_t GC_objfreelist[MAXOBJGRANULES+1];
+  extern ptr_t GC_objfreelist[MAXOBJGRANULES+1];
                           /* free list for NORMAL objects */
 # define beginGC_objfreelist ((ptr_t)(&GC_objfreelist))
 # define endGC_objfreelist (beginGC_objfreelist + sizeof(GC_objfreelist))
 
-  GC_EXTERN ptr_t GC_aobjfreelist[MAXOBJGRANULES+1];
+  extern ptr_t GC_aobjfreelist[MAXOBJGRANULES+1];
                           /* free list for atomic (PTRFREE) objs        */
 # define beginGC_aobjfreelist ((ptr_t)(&GC_aobjfreelist))
 # define endGC_aobjfreelist (beginGC_aobjfreelist + sizeof(GC_aobjfreelist))
@@ -1277,9 +1277,6 @@ GC_EXTERN word GC_black_list_spacing;
                         /* "stack-blacklisted", i.e. that are           */
                         /* problematic in the interior of an object.    */
 
-GC_EXTERN GC_bool GC_objects_are_marked; /* There are marked objects in */
-                                         /* the heap.                   */
-
 #ifndef SMALL_CONFIG
   GC_EXTERN GC_bool GC_incremental;
                         /* Using incremental/generational collection. */
diff --git a/mark.c b/mark.c
index 208d959..949ed27 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -72,18 +72,19 @@ struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
 
 # ifdef ATOMIC_UNCOLLECTABLE
 #   ifdef STUBBORN_ALLOC
-      unsigned GC_n_kinds = 5;
+#     define GC_N_KINDS_INITIAL_VALUE 5
 #   else
-      unsigned GC_n_kinds = 4;
+#     define GC_N_KINDS_INITIAL_VALUE 4
 #   endif
 # else
 #   ifdef STUBBORN_ALLOC
-      unsigned GC_n_kinds = 4;
+#     define GC_N_KINDS_INITIAL_VALUE 4
 #   else
-      unsigned GC_n_kinds = 3;
+#     define GC_N_KINDS_INITIAL_VALUE 3
 #   endif
 # endif
 
+unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE;
 
 # ifndef INITIAL_MARK_STACK_SIZE
 #   define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE)
@@ -106,14 +107,12 @@ STATIC word GC_n_rescuing_pages = 0;
                                 /* excludes ptrfree pages, etc.         */
 
 mse * GC_mark_stack = NULL;
-
 mse * GC_mark_stack_limit = NULL;
-
 size_t GC_mark_stack_size = 0;
 
 #ifdef PARALLEL_MARK
   mse * volatile GC_mark_stack_top = NULL;
-  /* Updated only with mark lock held, but read asynchronously. */
+        /* Updated only with mark lock held, but read asynchronously.   */
   STATIC volatile AO_t GC_first_nonempty = 0;
         /* Lowest entry on mark stack   */
         /* that may be nonempty.        */
@@ -123,14 +122,14 @@ size_t GC_mark_stack_size = 0;
   mse * GC_mark_stack_top = NULL;
 #endif
 
-static struct hblk * scan_ptr;
-
 mark_state_t GC_mark_state = MS_NONE;
 
 GC_bool GC_mark_stack_too_small = FALSE;
 
-GC_bool GC_objects_are_marked = FALSE;  /* Are there collectable marked */
-                                        /* objects in the heap?         */
+static struct hblk * scan_ptr;
+
+STATIC GC_bool GC_objects_are_marked = FALSE;
+                /* Are there collectable marked objects in the heap?    */
 
 /* Is a collection in progress?  Note that this can return true in the  */
 /* nonincremental case, if a collection has been abandoned and the      */
index 49dc4e9..1ca9d32 100644 (file)
 /* this better.                                                 */
 typedef LONG * IE_t;
 
-GC_bool GC_thr_initialized = FALSE;
+STATIC GC_bool GC_thr_initialized = FALSE;
 
 GC_bool GC_need_to_lock = FALSE;
 
@@ -359,7 +359,8 @@ LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
   /* may be called repeatedly.                                          */
 #endif
 
-GC_bool GC_in_thread_creation = FALSE;  /* Protected by allocation lock. */
+STATIC GC_bool GC_in_thread_creation = FALSE;
+                                /* Protected by allocation lock. */
 
 /*
  * This may be called from DllMain, and hence operates under unusual
@@ -1487,8 +1488,7 @@ void GC_get_next_stack(char *start, char *limit,
     /* start_mark_threads() is the same as in pthread_support.c except for: */
     /* - GC_markers value is adjusted already;                              */
     /* - thread stack is assumed to be large enough; and                    */
-    /* - statistics about the number of marker threads is already printed.  */
-
+    /* - statistics about the number of marker threads is printed outside.  */
     static void start_mark_threads(void)
     {
       int i;