From 067a228666444706e2f2d75afa850b6a3a840b10 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 25 Feb 2015 08:14:30 -0700 Subject: [PATCH] smp: Use make-serial-population. Squash into 0dd59191. --- src/runtime/geneqht.scm | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/runtime/geneqht.scm b/src/runtime/geneqht.scm index d3f83e683..2c645783d 100644 --- a/src/runtime/geneqht.scm +++ b/src/runtime/geneqht.scm @@ -97,38 +97,17 @@ USA. modulus)) (define (record-address-hash-table! table) - (with-thread-mutex-locked address-hash-tables-mutex - (lambda () - (set! address-hash-tables (weak-cons table address-hash-tables)) - unspecific))) - -;; Mark-address-hash-tables! might run during record-address-hash- -;; table! (in the primitive GC daemon) and thus modify the address- -;; hash-tables list (splicing out pairs whose weak cars have turned to -;; #f). The set! in record-address-hash-table! may then write the old -;; value, before the splice, restoring the old pairs behind the new -;; one. Fortunately no harm is done. The cars of the restored pairs -;; are all #f and will be spliced out again eventually. + (add-to-population! address-hash-tables table)) (define (mark-address-hash-tables!) - (let loop ((previous #f) (tables address-hash-tables)) - (cond ((null? tables) - unspecific) - ((system-pair-car tables) - (set-table-needs-rehash?! (system-pair-car tables) #t) - (loop tables (system-pair-cdr tables))) - (else - (if previous - (system-pair-set-cdr! previous (system-pair-cdr tables)) - (set! address-hash-tables (system-pair-cdr tables))) - (loop previous (system-pair-cdr tables)))))) + (for-each-inhabitant address-hash-tables + (lambda (table) + (set-table-needs-rehash?! table #t)))) (define address-hash-tables) -(define address-hash-tables-mutex) (define (initialize-address-hashing!) - (set! address-hash-tables-mutex (make-thread-mutex)) - (set! address-hash-tables '()) + (set! address-hash-tables (make-serial-population)) (add-primitive-gc-daemon! mark-address-hash-tables!)) ;;;; Resizing -- 2.25.1