diff --git a/src/lisp/regression-tests/hash-tables0.lisp b/src/lisp/regression-tests/hash-tables0.lisp index a8bfd63728..d771184cf8 100644 --- a/src/lisp/regression-tests/hash-tables0.lisp +++ b/src/lisp/regression-tests/hash-tables0.lisp @@ -127,40 +127,51 @@ ;;; These tests are pretty strict - they want the garbage to actually be ;;; collected by that garbage-collect call, which may not be the case if we -;;; ever get a more relaxed collector (generational or something) +;;; ever get a more relaxed collector (generational or something). +;;; +;;; BUILDER populates the table and then RETURNS, so the frame holding the dead +;;; temporaries is popped before we collect. Building and collecting in one frame +;;; lets Boehm's conservative stack scan see a stale reference to a temporary and +;;; keep its entry alive, which is what made these tests flaky. The assertion is +;;; unchanged: still one collection, still an exact count. +(defun weak-count (builder) + (let ((table (funcall builder))) + (gctools:garbage-collect) + (hash-table-count table))) + (test weak-key-weakness - (let ((table (make-hash-table :weakness :key))) - (setf (gethash (list 37) table) :value - (gethash :key table) (list nil) - (gethash :key2 table) (list nil)) - (gctools:garbage-collect) - (hash-table-count table)) + (weak-count (lambda () + (let ((table (make-hash-table :weakness :key))) + (setf (gethash (list 37) table) :value + (gethash :key table) (list nil) + (gethash :key2 table) (list nil)) + table))) (2)) (test weak-value-weakness - (let ((table (make-hash-table :weakness :value))) - (setf (gethash :key table) (list 37) - (gethash (list nil) table) :value - (gethash (list 18) table) :value) - (gctools:garbage-collect) - (hash-table-count table)) + (weak-count (lambda () + (let ((table (make-hash-table :weakness :value))) + (setf (gethash :key table) (list 37) + (gethash (list nil) table) :value + (gethash (list 18) table) :value) + table))) (2)) (test weak-key-and-value-weakness - (let ((table (make-hash-table :weakness :key-and-value))) - (setf (gethash (list nil) table) :value - (gethash :key table) (list nil) - (gethash (list nil) table) (list nil) - (gethash :key2 table) :value) - (gctools:garbage-collect) - (hash-table-count table)) + (weak-count (lambda () + (let ((table (make-hash-table :weakness :key-and-value))) + (setf (gethash (list nil) table) :value + (gethash :key table) (list nil) + (gethash (list nil) table) (list nil) + (gethash :key2 table) :value) + table))) (1)) (test weak-key-or-value-weakness - (let ((table (make-hash-table :weakness :key-or-value))) - (setf (gethash (list nil) table) :value - (gethash :key table) (list nil) - (gethash (list nil) table) (list nil) - (gethash :key2 table) :value) - (gctools:garbage-collect) - (hash-table-count table)) + (weak-count (lambda () + (let ((table (make-hash-table :weakness :key-or-value))) + (setf (gethash (list nil) table) :value + (gethash :key table) (list nil) + (gethash (list nil) table) (list nil) + (gethash :key2 table) :value) + table))) (3)) (test equalp-hash-table-1 diff --git a/src/lisp/regression-tests/set-unexpected-failures.lisp b/src/lisp/regression-tests/set-unexpected-failures.lisp index 4c0d849d9a..84287c1239 100644 --- a/src/lisp/regression-tests/set-unexpected-failures.lisp +++ b/src/lisp/regression-tests/set-unexpected-failures.lisp @@ -8,7 +8,5 @@ ;; include-level-2a include-level-2b include-level-3 ;;; a problem for sbcl x-compiling frame-function frame-locals - ;; these don't work well on boehm. In particular - ;; key-or-value tables are effectively strong. - #+use-boehm weak-key-and-value-weakness + ;; on boehm key-or-value tables are effectively strong. #+use-boehm weak-key-or-value-weakness))