[cmucl-cvs] [git] CMU Common Lisp branch master updated. snapshot-2012-06-2-g8a9d1d8

Raymond Toy rtoy at common-lisp.net
Fri Jun 15 19:52:30 UTC 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  8a9d1d8d186004b5bd3354f2f9e0d0cc4b307d86 (commit)
      from  b0e85da9332a8822dd9496a0e4a72571b6d3546b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8a9d1d8d186004b5bd3354f2f9e0d0cc4b307d86
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Fri Jun 15 12:52:24 2012 -0700

    Change min_av_mem_age to be an int instead of double.  No floating
    point operations should occur in allocation or GC now, except when
    printing stats.

diff --git a/src/lisp/gencgc.c b/src/lisp/gencgc.c
index f8aed88..1e20421 100644
--- a/src/lisp/gencgc.c
+++ b/src/lisp/gencgc.c
@@ -451,6 +451,9 @@ gc_write_barrier(void *addr)
 /*
  * A structure to hold the state of a generation.
  */
+#define MEM_AGE_SHIFT 16
+#define MEM_AGE_SCALE (1 << MEM_AGE_SHIFT)
+
 struct generation {
 
     /* The first page that gc_alloc checks on its next call. */
@@ -502,8 +505,11 @@ struct generation {
      * A minimum average memory age before a GC will occur helps prevent
      * a GC when a large number of new live objects have been added, in
      * which case a GC could be a waste of time.
+     *
+     * The age is represented as an integer between 0 and 32767
+     * corresponding to an age of 0 to (just less than) 1.
      */
-    double min_av_mem_age;
+    int min_av_mem_age;
 };
 
 /*
@@ -524,7 +530,7 @@ struct generation_stats {
     int num_gc;
     int trigger_age;
     int cum_sum_bytes_allocated;
-    double min_av_mem_age;
+    int min_av_mem_age;
 };
 
 
@@ -647,14 +653,14 @@ generation_bytes_allocated(int generation)
 /*
  * Return the average age of the memory in a generation.
  */
-static double
+static int
 gen_av_mem_age(int gen)
 {
     if (generations[gen].bytes_allocated == 0)
-	return 0.0;
+	return 0;
 
-    return (double) generations[gen].cum_sum_bytes_allocated /
-	(double) generations[gen].bytes_allocated;
+    return (((long) generations[gen].cum_sum_bytes_allocated) << MEM_AGE_SHIFT) /
+	generations[gen].bytes_allocated;
 }
 
 /*
@@ -753,7 +759,7 @@ print_generation_stats(int verbose)
 		GC_PAGE_SIZE * count_generation_pages(i) -
 		generations[i].bytes_allocated, generations[i].gc_trigger,
 		count_write_protect_generation_pages(i), generations[i].num_gc,
-		gen_av_mem_age(i));
+		(double)gen_av_mem_age(i) / MEM_AGE_SCALE);
     }
     fprintf(stderr, "   Total bytes alloc=%ld\n", bytes_allocated);
 
@@ -804,7 +810,7 @@ void
 set_min_mem_age(int gen, double min_mem_age)
 {
     if (gen <= NUM_GENERATIONS) {
-	generations[gen].min_av_mem_age = min_mem_age;
+	generations[gen].min_av_mem_age = min_mem_age * MEM_AGE_SCALE;
     }
 }
 
@@ -4532,7 +4538,20 @@ scav_hash_vector(lispobj * where, lispobj object)
         fprintf(stderr, "scav_hash_vector: scavenge table %p\n", hash_table);
     }
 #endif
-
+    
+#ifdef GC_ASSERTIONS
+    {
+        /*
+         * Check to see that hash-table-rehash-threshold is a single
+         * float in the range (0, 1]
+         */
+        lispobj threshold_obj = (lispobj) hash_table->rehash_threshold;
+        float* raw_slots = PTR(threshold_obj);
+        float threshold = raw_slots[2];
+        gc_assert(threshold > 0 && threshold <= 1);
+    }
+#endif
+    
     scavenge((lispobj *) hash_table, HASH_TABLE_SIZE);
 
     if (hash_table->weak_p == NIL) {
@@ -7325,7 +7344,7 @@ garbage_collect_generation(int generation, int raise)
 
 #ifdef GC_ASSERTIONS
 #if defined(i386) || defined(__x86_64)
-    invalid_stack_start = (void *) control_stack_start;
+    invalid_stack_start = (void *) CONTROL_STACK_START;
     invalid_stack_end = (void *) &raise;
 #else /* not i386 */
     invalid_stack_start = (void *) &raise;
@@ -7897,7 +7916,7 @@ gc_init(void)
 	/* The tune-able parameters */
 	generations[i].bytes_consed_between_gc = 2000000;
 	generations[i].trigger_age = 1;
-	generations[i].min_av_mem_age = 0.75;
+	generations[i].min_av_mem_age = 24508; /* 0.75 * MEM_AGE_SCALE */
     }
 
     /* Initialise gc_alloc */

-----------------------------------------------------------------------

Summary of changes:
 src/lisp/gencgc.c |   41 ++++++++++++++++++++++++++++++-----------
 1 files changed, 30 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp




More information about the cmucl-cvs mailing list