Raymond Toy pushed to branch issue-69-compile-in-gc-assert at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/gc.lisp
    ... ... @@ -72,7 +72,11 @@
    72 72
     (progn
    
    73 73
       (alien:def-alien-routine get_bytes_allocated_lower c-call:int)
    
    74 74
       (alien:def-alien-routine get_bytes_allocated_upper c-call:int)
    
    75
    -
    
    75
    +  ;; Controls GC assertions that are enabled in the runtime.  A value
    
    76
    +  ;; of 0 disables all assertions (the normal default).
    
    77
    +  (alien:def-alien-variable gc_assert_level c-call:int)
    
    78
    +  (setf (documentation 'gc-assert-level 'variable)
    
    79
    +	"Current GC assertion level.  Higher values enable more GC assertions")
    
    76 80
       (defun dynamic-usage ()
    
    77 81
         (dfixnum:dfixnum-pair-integer
    
    78 82
          (get_bytes_allocated_upper) (get_bytes_allocated_lower))))
    

  • src/lisp/gencgc.c
    ... ... @@ -4813,12 +4813,12 @@ scav_hash_vector(lispobj * where, lispobj object)
    4813 4813
         if (gc_assert_level > 0) {
    
    4814 4814
             /*
    
    4815 4815
              * Check to see that hash-table-rehash-threshold is a single
    
    4816
    -         * float in the range (0, 1]
    
    4816
    +         * float in the range [0.1, 1]
    
    4817 4817
              */
    
    4818 4818
             lispobj threshold_obj = (lispobj) hash_table->rehash_threshold;
    
    4819
    -        float* raw_slots = PTR(threshold_obj);
    
    4820
    -        float threshold = raw_slots[2];
    
    4821
    -        gc_assert(threshold > 0 && threshold <= 1);
    
    4819
    +        struct single_float* float_slot = (struct single_float*) PTR(threshold_obj);
    
    4820
    +        float threshold = float_slot->value;
    
    4821
    +        gc_assert(threshold >= 0.1 && threshold <= 1);
    
    4822 4822
         }
    
    4823 4823
         
    
    4824 4824
         scavenge((lispobj *) hash_table, HASH_TABLE_SIZE);