2007-01-03 Hans Boehm <Hans.Boehm@hp.com> (based on a patch from
authorhboehm <hboehm>
Thu, 3 Jan 2008 21:56:19 +0000 (21:56 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:42 +0000 (21:06 +0400)
John Bowman, and an ancient patch from Fergus Henderson)

* allchblk.c, alloc.c, include/private/gc_priv.h:
Track GC_bytes_dropped and use in GC triggering decisions.
* alloc.c (min_bytes_allocd): Weight atomic blocks less.

ChangeLog
allchblk.c
alloc.c
include/private/gc_priv.h

index 1623bb5..d131f80 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-03  Hans Boehm <Hans.Boehm@hp.com> (based on a patch from
+       John Bowman, and an ancient patch from Fergus Henderson)
+
+       * allchblk.c, alloc.c, include/private/gc_priv.h:
+       Track GC_bytes_dropped and use in GC triggering decisions.
+       * alloc.c (min_bytes_allocd): Weight atomic blocks less.
+
 2007-01-02  Hans Boehm <Hans.Boehm@hp.com>
 
        * alloc.c (GC_add_to_heap): Call GC_install_header(p) AFTER
index 2be870e..b3daa59 100644 (file)
@@ -720,6 +720,7 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n)
                      struct hblk * prev = hhdr -> hb_prev;
                      
                      GC_large_free_bytes -= total_size;
+                     GC_bytes_dropped += total_size;
                      GC_remove_from_fl(hhdr, n);
                      for (h = hbp; h < limit; h++) {
                        if (h == hbp || 0 != (hhdr = GC_install_header(h))) {
diff --git a/alloc.c b/alloc.c
index f996bff..5772b2d 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -164,7 +164,7 @@ static word min_bytes_allocd()
     
     if (stack_size < 0) stack_size = -stack_size;
     total_root_size = 2 * stack_size + GC_root_size;
-    scan_size = 2 * GC_composite_in_use + GC_atomic_in_use
+    scan_size = 2 * GC_composite_in_use + GC_atomic_in_use/4
                + total_root_size;
     if (TRUE_INCREMENTAL) {
         return scan_size / (2 * GC_free_space_divisor);
@@ -188,6 +188,7 @@ word GC_adj_bytes_allocd(void)
     /* managed object should not alter result, assuming the client     */
     /* is playing by the rules.                                                */
     result = (signed_word)GC_bytes_allocd
+            + (signed_word)GC_bytes_dropped
             - (signed_word)GC_bytes_freed 
             + (signed_word)GC_finalizer_bytes_freed
             - expl_managed;
@@ -723,6 +724,7 @@ void GC_finish_collection()
       GC_bytes_allocd_before_gc += GC_bytes_allocd;
       GC_non_gc_bytes_at_gc = GC_non_gc_bytes;
       GC_bytes_allocd = 0;
+      GC_bytes_dropped = 0;
       GC_bytes_freed = 0;
       GC_finalizer_bytes_freed = 0;
       
index 219adb9..a1e931e 100644 (file)
@@ -862,6 +862,11 @@ struct _GC_arrays {
     word _bytes_allocd;
        /* Number of words allocated during this collection cycle */
 # endif
+  word _bytes_dropped;
+       /* Number of black-listed bytes dropped during GC cycle */
+       /* as a result of repeated scanning during allocation   */
+       /* attempts.  These are treated largely as allocated,   */
+       /* even though they are not useful to the client.       */
   word _bytes_finalized;
        /* Approximate number of bytes in objects (and headers) */
        /* That became ready for finalization in the last       */
@@ -1039,6 +1044,7 @@ GC_API GC_FAR struct _GC_arrays GC_arrays;
 # define GC_large_free_bytes GC_arrays._large_free_bytes
 # define GC_large_allocd_bytes GC_arrays._large_allocd_bytes
 # define GC_max_large_allocd_bytes GC_arrays._max_large_allocd_bytes
+# define GC_bytes_dropped GC_arrays._bytes_dropped
 # define GC_bytes_finalized GC_arrays._bytes_finalized
 # define GC_non_gc_bytes_at_gc GC_arrays._non_gc_bytes_at_gc
 # define GC_bytes_freed GC_arrays._bytes_freed