From 5e0fa58295f77d720b602a8b4e75a82189a477f2 Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Mon, 18 Jan 2016 11:45:37 -0800 Subject: [PATCH] Undo delayed adding of hash-table to population. Instead, skip uniqueness check on new hash-tables. --- src/runtime/hashtb.scm | 18 ++++++------------ src/runtime/runtime.pkg | 2 ++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index 27391c527..677bd6c0e 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -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 diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index ac93c1762..9cec565f7 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -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) -- 2.25.1