summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-01-03 21:56:19 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:42 +0400
commit404df539af342bf581545547b0170114b2a842d8 (patch)
tree23169da6484257d4115e8fa435e3df87850d57c5
parentd3eb7db9e53a42a681ac99d2ff8d7a00f8ce1002 (diff)
downloadbdwgc-404df539af342bf581545547b0170114b2a842d8.tar.gz
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.
-rw-r--r--ChangeLog7
-rw-r--r--allchblk.c1
-rw-r--r--alloc.c4
-rw-r--r--include/private/gc_priv.h6
4 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1623bb5b..d131f806 100644
--- 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
diff --git a/allchblk.c b/allchblk.c
index 2be870e9..b3daa591 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -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 f996bff0..5772b2d8 100644
--- 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;
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 219adb92..a1e931e5 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -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