Undo delayed adding of hash-table to population. Instead, skip uniqueness check...
authorJoe Marshall <jmarshall@alum.mit.edu>
Mon, 18 Jan 2016 19:45:37 +0000 (11:45 -0800)
committerJoe Marshall <jmarshall@alum.mit.edu>
Mon, 18 Jan 2016 19:45:37 +0000 (11:45 -0800)
src/runtime/hashtb.scm
src/runtime/runtime.pkg

index 27391c527bc67202139341ed0eb4b592a657d6f6..677bd6c0e21dc70d310d5c8656b6f3a9a08566f2 100644 (file)
@@ -67,17 +67,10 @@ USA.
   buckets
   (primes prime-numbers-stream)
   (needs-rehash? #f)
-  (initial-size-in-effect? #f)
-  (record-address-hash-table? #f))
+  (initial-size-in-effect? #f))
 
 (define-guarantee hash-table "hash table")
 
-(define-integrable (check-address-hash-table table)
-  (if (table-record-address-hash-table? table)
-      (begin
-       (record-address-hash-table! table)
-       (set-table-record-address-hash-table?! table #f))))
-
 (define-integrable (increment-table-count! table)
   (set-table-count! table (fix:+ (table-count table) 1)))
 
@@ -114,7 +107,7 @@ USA.
            (set-table-initial-size-in-effect?! table #t)))
       (reset-table! table)
       (if (table-type-rehash-after-gc? type)
-         (set-table-record-address-hash-table?! table #t))
+         (record-address-hash-table! table))
       table)))
 
 (define (hash-table/type table)
@@ -642,7 +635,6 @@ USA.
                  (if q
                      (set-cdr! q r)
                      (vector-set! (table-buckets table) hash r)))
-               (check-address-hash-table table)
                (increment-table-count! table)
                (maybe-grow-table! table)))))))
   method:put!)
@@ -672,7 +664,6 @@ USA.
                    (if q
                        (set-cdr! q r)
                        (vector-set! (table-buckets table) hash r)))
-                 (check-address-hash-table table)
                  (increment-table-count! table)
                  (maybe-grow-table! table)))
              datum)))))
@@ -1368,7 +1359,10 @@ USA.
   unspecific)
 
 (define (record-address-hash-table! table)
-  (add-to-population! address-hash-tables table))
+  (if (cadr address-hash-tables)
+      (with-thread-mutex-lock (cadr address-hash-tables)
+        (lambda () (add-to-population!/unsafe address-hash-tables table)))
+      (add-to-population! address-hash-tables table)))
 
 (define (mark-address-hash-tables!)
   (for-each-inhabitant address-hash-tables
index ac93c1762cfc6b39101a6fd7a6e9153700f42dd9..9cec565f70db8183a3fbfb13f2f415b5e7834256 100644 (file)
@@ -2140,6 +2140,8 @@ USA.
 (define-package (runtime hash-table)
   (files "hashtb")
   (parent (runtime))
+  (import (runtime population)
+         add-to-population!/unsafe)
   (export ()
          (eq-hash-table-type key-weak-eq-hash-table-type)
          (eqv-hash-table-type key-weak-eqv-hash-table-type)