[Git][cmucl/cmucl][issue-69-compile-in-gc-assert] 2 commits: Correct an assertion on rehash-threshold.
Raymond Toy
rtoy at common-lisp.net
Sun Sep 2 22:40:09 UTC 2018
Raymond Toy pushed to branch issue-69-compile-in-gc-assert at cmucl / cmucl
Commits:
d895efeb by Raymond Toy at 2018-09-02T22:39:02Z
Correct an assertion on rehash-threshold.
The limit for rehash-threshold is 0.1 to 1. not 0 to 1. Also fix a
compiler warning about bad casts. And use an appropriate structure
type for the single-float object instead of hacking as float array.
- - - - -
cfaac541 by Raymond Toy at 2018-09-02T22:39:56Z
Add gc-assert-level in lisp
This allows users to change the runtime GC assertion level. Zero
means no assertions and greater than 0 means assertions are enabled.
- - - - -
2 changed files:
- src/code/gc.lisp
- src/lisp/gencgc.c
Changes:
=====================================
src/code/gc.lisp
=====================================
@@ -72,7 +72,11 @@
(progn
(alien:def-alien-routine get_bytes_allocated_lower c-call:int)
(alien:def-alien-routine get_bytes_allocated_upper c-call:int)
-
+ ;; Controls GC assertions that are enabled in the runtime. A value
+ ;; of 0 disables all assertions (the normal default).
+ (alien:def-alien-variable gc_assert_level c-call:int)
+ (setf (documentation 'gc-assert-level 'variable)
+ "Current GC assertion level. Higher values enable more GC assertions")
(defun dynamic-usage ()
(dfixnum:dfixnum-pair-integer
(get_bytes_allocated_upper) (get_bytes_allocated_lower))))
=====================================
src/lisp/gencgc.c
=====================================
@@ -4813,12 +4813,12 @@ scav_hash_vector(lispobj * where, lispobj object)
if (gc_assert_level > 0) {
/*
* Check to see that hash-table-rehash-threshold is a single
- * float in the range (0, 1]
+ * float in the range [0.1, 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);
+ struct single_float* float_slot = (struct single_float*) PTR(threshold_obj);
+ float threshold = float_slot->value;
+ gc_assert(threshold >= 0.1 && threshold <= 1);
}
scavenge((lispobj *) hash_table, HASH_TABLE_SIZE);
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/ab9c63efd703fd07305b049165a6ef185a282830...cfaac541a0529e4947f267500c3ccaf5052da96b
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/ab9c63efd703fd07305b049165a6ef185a282830...cfaac541a0529e4947f267500c3ccaf5052da96b
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20180902/b6f90dc0/attachment-0001.html>
More information about the cmucl-cvs
mailing list