]> granicus.if.org Git - gc/commitdiff
2009-11-06 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Fri, 6 Nov 2009 11:12:00 +0000 (11:12 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:51 +0000 (21:06 +0400)
* doc/README.macros (GC_DISABLE_INCREMENTAL): Document.
* include/private/gcconfig.h (GC_DISABLE_INCREMENTAL): Recognize
new macro; implicitly define it if SMALL_CONFIG.
* alloc.c (GC_incremental, GC_timeout_stop_func): Check for
GC_DISABLE_INCREMENTAL instead of SMALL_CONFIG.
* include/private/gc_priv.h (GC_incremental, TRUE_INCREMENTAL,
GC_push_conditional): Ditto.
* mark.c (GC_push_next_marked_dirty, GC_push_selected,
GC_push_conditional, GC_block_was_dirty): Ditto.
* misc.c (GC_enable_incremental): Ditto.
* misc.c (GC_init): Ditto (for "GC_PAUSE_TIME_TARGET" and
"GC_ENABLE_INCREMENTAL" environment variables).
* misc.c (GC_enable_incremental): Reformat the code.

ChangeLog
alloc.c
doc/README.macros
include/private/gc_priv.h
include/private/gcconfig.h
mark.c
misc.c

index 0a98e5be067440a8ebe774760dd89b09ceea4eed..c9160babff395381544a2d0a5bf95e63ea60e4d9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2009-11-06  Ivan Maidanski <ivmai@mail.ru>
+
+       * doc/README.macros (GC_DISABLE_INCREMENTAL): Document.
+       * include/private/gcconfig.h (GC_DISABLE_INCREMENTAL): Recognize
+       new macro; implicitly define it if SMALL_CONFIG.
+       * alloc.c (GC_incremental, GC_timeout_stop_func): Check for
+       GC_DISABLE_INCREMENTAL instead of SMALL_CONFIG.
+       * include/private/gc_priv.h (GC_incremental, TRUE_INCREMENTAL,
+       GC_push_conditional): Ditto.
+       * mark.c (GC_push_next_marked_dirty, GC_push_selected,
+       GC_push_conditional, GC_block_was_dirty): Ditto.
+       * misc.c (GC_enable_incremental): Ditto.
+       * misc.c (GC_init): Ditto (for "GC_PAUSE_TIME_TARGET" and
+       "GC_ENABLE_INCREMENTAL" environment variables).
+       * misc.c (GC_enable_incremental): Reformat the code.
+
 2009-11-06  Ivan Maidanski <ivmai@mail.ru>
 
        * dyn_load.c (WIN32_LEAN_AND_MEAN): Guard with ifndef.
diff --git a/alloc.c b/alloc.c
index e96b05fc9277d6c4a488db9b263dc68ac2c469d6..21f014310b9a204924bfe83bb67f3d4fe37ea8bf 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -58,7 +58,7 @@ word GC_non_gc_bytes = 0;  /* Number of bytes not intended to be collected */
 
 word GC_gc_no = 0;
 
-#ifndef SMALL_CONFIG
+#ifndef GC_DISABLE_INCREMENTAL
   GC_INNER int GC_incremental = 0;      /* By default, stop the world.  */
 #endif
 
@@ -159,7 +159,7 @@ GC_API GC_stop_func GC_CALL GC_get_stop_func(void)
   return stop_func;
 }
 
-#if defined(SMALL_CONFIG) || defined(NO_CLOCK)
+#if defined(GC_DISABLE_INCREMENTAL) || defined(NO_CLOCK)
 # define GC_timeout_stop_func GC_default_stop_func
 #else
   STATIC int GC_CALLBACK GC_timeout_stop_func (void)
@@ -184,7 +184,7 @@ GC_API GC_stop_func GC_CALL GC_get_stop_func(void)
     }
     return(0);
   }
-#endif /* !SMALL_CONFIG */
+#endif /* !GC_DISABLE_INCREMENTAL */
 
 #ifdef THREADS
   GC_INNER word GC_total_stacksize = 0; /* updated on every push_all_stacks */
index 74e3247d209217d8a4dddbf635c5560d028431f5..2ca74d468a81093edfb25789ad970ee621b85f03 100644 (file)
@@ -149,6 +149,13 @@ SMALL_CONFIG    Tries to tune the collector for small heap sizes,
   usually causing it to use less space in such situations.
   Incremental collection no longer works in this case.
 
+GC_DISABLE_INCREMENTAL  Turn off the incremental collection support.
+
+NO_INCREMENTAL  Causes the gctest program to not invoke the incremental
+  collector.  This has no impact on the generated library, only on the test
+  program.  (This is often useful for debugging failures unrelated to
+  incremental GC.)
+
 LARGE_CONFIG    Tunes the collector for unusually large heaps.
   Necessary for heaps larger than about 4 GiB on most (64-bit) machines.
   Recommended for heaps larger than about 500 MiB.  Not recommended for
@@ -405,11 +412,6 @@ TEST_WITH_SYSTEM_MALLOC         Causes gctest to allocate (and leak) large
   getting traced by the collector.  This has no impact on the generated
   library; it only affects the test.
 
-NO_INCREMENTAL  Causes the gctest program to not invoke the incremental
-  collector.  This has no impact on the generated library, only on the test
-  program.  (This is often useful for debugging failures unrelated to
-  incremental GC.)
-
 POINTER_MASK=<0x...>    Causes candidate pointers to be AND'ed with the given
   mask before being considered.  If either this or the following macro is
   defined, it will be assumed that all pointers stored in the heap need to be
index 000661fa61057ba0720cb65b7fcdb92f5048eef2..71f6b7a04a5b475d661c8c2cad0e55f8cc01c164 100644 (file)
@@ -1305,17 +1305,17 @@ GC_EXTERN word GC_black_list_spacing;
                         /* "stack-blacklisted", i.e. that are           */
                         /* problematic in the interior of an object.    */
 
-#ifndef SMALL_CONFIG
+#ifdef GC_DISABLE_INCREMENTAL
+# define GC_incremental FALSE
+                        /* Hopefully allow optimizer to remove some code. */
+# define TRUE_INCREMENTAL FALSE
+#else
   GC_EXTERN GC_bool GC_incremental;
                         /* Using incremental/generational collection. */
 # define TRUE_INCREMENTAL \
         (GC_incremental && GC_time_limit != GC_TIME_UNLIMITED)
         /* True incremental, not just generational, mode */
-#else
-# define GC_incremental FALSE
-                        /* Hopefully allow optimizer to remove some code. */
-# define TRUE_INCREMENTAL FALSE
-#endif
+#endif /* !GC_DISABLE_INCREMENTAL */
 
 GC_EXTERN GC_bool GC_dirty_maintained;
                                 /* Dirty bits are being maintained,     */
@@ -1460,7 +1460,7 @@ GC_INNER GC_bool GC_collection_in_progress(void);
 GC_INNER void GC_push_all(ptr_t bottom, ptr_t top);
                                 /* Push everything in a range           */
                                 /* onto mark stack.                     */
-#ifndef SMALL_CONFIG
+#ifndef GC_DISABLE_INCREMENTAL
   GC_INNER void GC_push_conditional(ptr_t b, ptr_t t, GC_bool all);
 #else
 # define GC_push_conditional(b, t, all) GC_push_all(b, t)
index 4ddf85176bf73989c427939e31804d1a4cb4aa84..ace5472df9d9b65fc302ad4f94b3694b9287f451 100644 (file)
 #   error --> undefined STACKBOTTOM
 # endif
 
-# ifdef SMALL_CONFIG
+# if defined(SMALL_CONFIG) && !defined(GC_DISABLE_INCREMENTAL)
         /* Presumably not worth the space it takes. */
-#   undef PROC_VDB
+#   define GC_DISABLE_INCREMENTAL
+# endif
+
+# ifdef GC_DISABLE_INCREMENTAL
+#   undef GWW_VDB
 #   undef MPROTECT_VDB
+#   undef PCR_VDB
+#   undef PROC_VDB
 # endif
 
 # ifdef USE_GLOBAL_ALLOC
diff --git a/mark.c b/mark.c
index 4546aefbbabc04c4de3346446732583eab490192..072d6215d2b5394cee3ac4034455cecbca5560d1 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -280,13 +280,13 @@ GC_INNER void GC_initiate_gc(void)
     STATIC void GC_do_parallel_mark(void); /* initiate parallel marking. */
 #endif /* PARALLEL_MARK */
 
-#ifdef SMALL_CONFIG
+#ifdef GC_DISABLE_INCREMENTAL
 # define GC_push_next_marked_dirty(h) GC_push_next_marked(h)
 #else
   STATIC struct hblk * GC_push_next_marked_dirty(struct hblk *h);
                 /* Invoke GC_push_marked on next dirty block above h.   */
                 /* Return a pointer just past the end of this block.    */
-#endif /* !SMALL_CONFIG */
+#endif /* !GC_DISABLE_INCREMENTAL */
 STATIC struct hblk * GC_push_next_marked(struct hblk *h);
                 /* Ditto, but also mark from clean pages.       */
 STATIC struct hblk * GC_push_next_marked_uncollectable(struct hblk *h);
@@ -1289,7 +1289,7 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top)
     GC_mark_stack_top -> mse_descr = length;
 }
 
-#ifndef SMALL_CONFIG
+#ifndef GC_DISABLE_INCREMENTAL
 
   /*
    * Analogous to the above, but push only those pages h with
@@ -1367,7 +1367,7 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top)
         GC_push_selected(bottom, top, GC_page_was_dirty, GC_push_all);
     }
   }
-#endif /* !SMALL_CONFIG */
+#endif /* !GC_DISABLE_INCREMENTAL */
 
 #if defined(MSWIN32) || defined(MSWINCE)
   void __cdecl GC_push_one(word p)
@@ -1777,10 +1777,10 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
     }
 }
 
-#ifndef SMALL_CONFIG
-/* Test whether any page in the given block is dirty    */
-STATIC GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr)
-{
+#ifndef GC_DISABLE_INCREMENTAL
+  /* Test whether any page in the given block is dirty.   */
+  STATIC GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr)
+  {
     size_t sz = hhdr -> hb_sz;
 
     if (sz <= MAXOBJBYTES) {
@@ -1793,8 +1793,8 @@ STATIC GC_bool GC_block_was_dirty(struct hblk *h, hdr *hhdr)
          }
          return(FALSE);
     }
-}
-#endif /* SMALL_CONFIG */
+  }
+#endif /* GC_DISABLE_INCREMENTAL */
 
 /* Similar to GC_push_marked, but skip over unallocated blocks  */
 /* and return address of next plausible block.                  */
@@ -1811,7 +1811,7 @@ STATIC struct hblk * GC_push_next_marked(struct hblk *h)
     return(h + OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz));
 }
 
-#ifndef SMALL_CONFIG
+#ifndef GC_DISABLE_INCREMENTAL
   /* Identical to above, but mark only from dirty pages   */
   STATIC struct hblk * GC_push_next_marked_dirty(struct hblk *h)
   {
@@ -1842,7 +1842,7 @@ STATIC struct hblk * GC_push_next_marked(struct hblk *h)
     GC_push_marked(h, hhdr);
     return(h + OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz));
   }
-#endif
+#endif /* !GC_DISABLE_INCREMENTAL */
 
 /* Similar to above, but for uncollectable pages.  Needed since we      */
 /* do not clear marks for such pages, even for full collections.        */
diff --git a/misc.c b/misc.c
index 0c276f4f3287c513bb83610eb4a77bcef65b9524..96dc754a21482c0047e2d1f4b7a050d41346c50b 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -559,7 +559,7 @@ GC_API void GC_CALL GC_init(void)
 #   if (defined(MSWIN32) || defined(MSWINCE)) && defined(THREADS)
       InitializeCriticalSection(&GC_write_cs);
 #   endif
-#   if (!defined(SMALL_CONFIG))
+#   ifndef SMALL_CONFIG
 #     ifdef GC_PRINT_VERBOSE_STATS
         /* This is useful for debugging and profiling on platforms with */
         /* missing getenv() (like WinCE).                               */
@@ -584,7 +584,7 @@ GC_API void GC_CALL GC_init(void)
           }
         }
 #     endif
-#   endif
+#   endif /* !SMALL_CONFIG */
 #   ifndef NO_DEBUGGING
       if (0 != GETENV("GC_DUMP_REGULARLY")) {
         GC_dump_regularly = 1;
@@ -628,7 +628,7 @@ GC_API void GC_CALL GC_init(void)
 #       endif
       }
     }
-#   ifndef SMALL_CONFIG
+#   ifndef GC_DISABLE_INCREMENTAL
       {
         char * time_limit_string = GETENV("GC_PAUSE_TIME_TARGET");
         if (0 != time_limit_string) {
@@ -641,6 +641,8 @@ GC_API void GC_CALL GC_init(void)
           }
         }
       }
+#   endif
+#   ifndef SMALL_CONFIG
       {
         char * full_freq_string = GETENV("GC_FULL_FREQUENCY");
         if (full_freq_string != NULL) {
@@ -761,7 +763,7 @@ GC_API void GC_CALL GC_init(void)
         /* Ptr_t comparisons should behave as unsigned comparisons.     */
 #   endif
     GC_STATIC_ASSERT((signed_word)(-1) < (signed_word)0);
-#   if !defined(SMALL_CONFIG)
+#   ifndef GC_DISABLE_INCREMENTAL
       if (GC_incremental || 0 != GETENV("GC_ENABLE_INCREMENTAL")) {
         /* For GWW_MPROTECT on Win32, this needs to happen before any   */
         /* heap memory is allocated.                                    */
@@ -769,7 +771,7 @@ GC_API void GC_CALL GC_init(void)
         GC_ASSERT(GC_bytes_allocd == 0)
         GC_incremental = TRUE;
       }
-#   endif /* !SMALL_CONFIG */
+#   endif
 
     /* Add initial guess of root sets.  Do this first, since sbrk(0)    */
     /* might be used.                                                   */
@@ -865,45 +867,40 @@ GC_API void GC_CALL GC_init(void)
 
 GC_API void GC_CALL GC_enable_incremental(void)
 {
-# if !defined(SMALL_CONFIG) && !defined(KEEP_BACK_PTRS)
-  /* If we are keeping back pointers, the GC itself dirties all */
-  /* pages on which objects have been marked, making            */
-  /* incremental GC pointless.                                  */
-  if (!GC_find_leak && 0 == GETENV("GC_DISABLE_INCREMENTAL")) {
+# if !defined(GC_DISABLE_INCREMENTAL) && !defined(KEEP_BACK_PTRS)
     DCL_LOCK_STATE;
-
-    LOCK();
-    if (GC_incremental) goto out;
-    GC_setpagesize();
-    /* if (GC_no_win32_dlls) goto out; Should be win32S test? */
-    maybe_install_looping_handler();  /* Before write fault handler! */
-    GC_incremental = TRUE;
-    if (!GC_is_initialized) {
-        GC_init();
-    } else {
-        GC_dirty_init();
-    }
-    if (!GC_dirty_maintained) goto out;
-    if (GC_dont_gc) {
-        /* Can't easily do it. */
-        UNLOCK();
-        return;
+    /* If we are keeping back pointers, the GC itself dirties all */
+    /* pages on which objects have been marked, making            */
+    /* incremental GC pointless.                                  */
+    if (!GC_find_leak && 0 == GETENV("GC_DISABLE_INCREMENTAL")) {
+      LOCK();
+      if (!GC_incremental) {
+        GC_setpagesize();
+        /* if (GC_no_win32_dlls) goto out; Should be win32S test? */
+        maybe_install_looping_handler(); /* Before write fault handler! */
+        GC_incremental = TRUE;
+        if (!GC_is_initialized) {
+          GC_init();
+        } else {
+          GC_dirty_init();
+        }
+        if (GC_dirty_maintained && !GC_dont_gc) {
+                                /* Can't easily do it if GC_dont_gc.    */
+          if (GC_bytes_allocd > 0) {
+            /* There may be unmarked reachable objects. */
+            GC_gcollect_inner();
+          }
+            /* else we're OK in assuming everything's   */
+            /* clean since nothing can point to an      */
+            /* unmarked object.                         */
+          GC_read_dirty();
+        }
+      }
+      UNLOCK();
+      return;
     }
-    if (GC_bytes_allocd > 0) {
-        /* There may be unmarked reachable objects      */
-        GC_gcollect_inner();
-    }   /* else we're OK in assuming everything's       */
-        /* clean since nothing can point to an          */
-        /* unmarked object.                             */
-    GC_read_dirty();
-out:
-    UNLOCK();
-  } else {
-    GC_init();
-  }
-# else
-    GC_init();
 # endif
+  GC_init();
 }
 
 
@@ -1262,7 +1259,7 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
         (void) abort();
 #   endif
   }
-#endif
+#endif /* !SMALL_CONFIG */
 
 GC_API void GC_CALL GC_enable(void)
 {