From: Joe Marshall Date: Sat, 16 Jan 2016 23:51:23 +0000 (-0800) Subject: Don't add table to rehash population until an entry is created. X-Git-Tag: mit-scheme-pucked-9.2.12~373^2~9 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=90f199a0813aa56cfca7cbbfc925782c88102994;p=mit-scheme.git Don't add table to rehash population until an entry is created. --- diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index aa9a10485..27391c527 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -67,10 +67,17 @@ USA. buckets (primes prime-numbers-stream) (needs-rehash? #f) - (initial-size-in-effect? #f)) + (initial-size-in-effect? #f) + (record-address-hash-table? #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))) @@ -107,7 +114,7 @@ USA. (set-table-initial-size-in-effect?! table #t))) (reset-table! table) (if (table-type-rehash-after-gc? type) - (record-address-hash-table! table)) + (set-table-record-address-hash-table?! table #t)) table))) (define (hash-table/type table) @@ -635,6 +642,7 @@ 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!) @@ -664,6 +672,7 @@ 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)))))