* make-hashtable is renamed to make-eq-hashtable, along with all

references
This commit is contained in:
Abdulaziz Ghuloum 2007-10-10 07:09:18 -04:00
parent b24ce124b2
commit 8bfadc3a67
8 changed files with 26 additions and 18 deletions

Binary file not shown.

View File

@ -501,7 +501,7 @@
(cond (cond
[(null? rhs*) '()] [(null? rhs*) '()]
[else [else
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(let ([ref (let ([ref
(lambda (x) (lambda (x)
(unless (hashtable-ref h x #f) (unless (hashtable-ref h x #f)
@ -519,7 +519,7 @@
(cond (cond
[(null? rhs*) '()] [(null? rhs*) '()]
[else [else
(let ([h (make-hashtable)] (let ([h (make-eq-hashtable)]
[rest (do-rhs* (fxadd1 i) lhs* (cdr rhs*) ref comp vref vcomp)]) [rest (do-rhs* (fxadd1 i) lhs* (cdr rhs*) ref comp vref vcomp)])
(let ([ref (let ([ref
(lambda (x) (lambda (x)
@ -552,7 +552,7 @@
(values (cons lhs slhs*) (cons rhs srhs*) llhs* lrhs* clhs* crhs*)] (values (cons lhs slhs*) (cons rhs srhs*) llhs* lrhs* clhs* crhs*)]
))])) ))]))
(define (do-recbind lhs* rhs* body ref comp letrec?) (define (do-recbind lhs* rhs* body ref comp letrec?)
(let ([h (make-hashtable)] (let ([h (make-eq-hashtable)]
[vref (make-vector (length lhs*) #f)] [vref (make-vector (length lhs*) #f)]
[vcomp (make-vector (length lhs*) #f)]) [vcomp (make-vector (length lhs*) #f)])
(let* ([ref (extend-hash lhs* h ref)] (let* ([ref (extend-hash lhs* h ref)]
@ -594,7 +594,7 @@
[(primref) x] [(primref) x]
[(bind lhs* rhs* body) [(bind lhs* rhs* body)
(let ([rhs* (E* rhs* ref comp)]) (let ([rhs* (E* rhs* ref comp)])
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(let ([body (E body (extend-hash lhs* h ref) comp)]) (let ([body (E body (extend-hash lhs* h ref) comp)])
(make-bind lhs* rhs* body))))] (make-bind lhs* rhs* body))))]
[(recbind lhs* rhs* body) [(recbind lhs* rhs* body)
@ -613,7 +613,7 @@
(map (lambda (x) (map (lambda (x)
(record-case x (record-case x
[(clambda-case info body) [(clambda-case info body)
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(let ([body (E body (extend-hash (case-info-args info) h ref) void)]) (let ([body (E body (extend-hash (case-info-args info) h ref) void)])
(make-clambda-case info body)))])) (make-clambda-case info body)))]))
cls*) cls*)

View File

@ -287,7 +287,7 @@
[else (error 'fasl-write "~s is not fasl-writable" x)])])))) [else (error 'fasl-write "~s is not fasl-writable" x)])]))))
(define fasl-write-to-port (define fasl-write-to-port
(lambda (x port) (lambda (x port)
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(make-graph x h) (make-graph x h)
(write-char #\# port) (write-char #\# port)
(write-char #\@ port) (write-char #\@ port)

View File

@ -1,12 +1,12 @@
(library (ikarus hash-tables) (library (ikarus hash-tables)
(export make-hashtable hashtable-ref hashtable-set! hashtable?) (export make-eq-hashtable hashtable-ref hashtable-set! hashtable?)
(import (import
(ikarus system $pairs) (ikarus system $pairs)
(ikarus system $vectors) (ikarus system $vectors)
(ikarus system $tcbuckets) (ikarus system $tcbuckets)
(ikarus system $fx) (ikarus system $fx)
(except (ikarus) make-hashtable hashtable-ref hashtable-set! hashtable?)) (except (ikarus) make-eq-hashtable hashtable-ref hashtable-set! hashtable?))
(define-record hasht (vec count tc)) (define-record hasht (vec count tc))
@ -178,10 +178,18 @@
;;; public interface ;;; public interface
(define (hashtable? x) (hasht? x)) (define (hashtable? x) (hasht? x))
(define (make-hashtable) (define make-eq-hashtable
(let ([x (cons #f #f)]) (case-lambda
(let ([tc (cons x x)]) [()
(make-hasht (make-base-vec 32) 0 tc)))) (let ([x (cons #f #f)])
(let ([tc (cons x x)])
(make-hasht (make-base-vec 32) 0 tc)))]
[(k)
(if (and (or (fixnum? k) (bignum? k))
(>= k 0))
(make-eq-hashtable)
(error 'make-eq-hashtable
"invalid initial capacity ~s" k))]))
(define hashtable-ref (define hashtable-ref
(lambda (h x v) (lambda (h x v)

View File

@ -569,7 +569,7 @@
[else x]))) [else x])))
(define (unshare x) (define (unshare x)
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(if (hasher x h) (if (hasher x h)
(rewrite-shared x h) (rewrite-shared x h)
x))) x)))

View File

@ -630,13 +630,13 @@
(dynamic x h))) (dynamic x h)))
(define (write-to-port x p) (define (write-to-port x p)
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(hasher x h) (hasher x h)
(writer x p #t h 0)) (writer x p #t h 0))
(flush-output-port p)) (flush-output-port p))
(define (display-to-port x p) (define (display-to-port x p)
(let ([h (make-hashtable)]) (let ([h (make-eq-hashtable)])
(hasher x h) (hasher x h)
(writer x p #f h 0)) (writer x p #f h 0))
(flush-output-port p)) (flush-output-port p))

View File

@ -179,7 +179,7 @@
(lambda (x) (eq? id (library-id x)))) (lambda (x) (eq? id (library-id x))))
(error #f "cannot find library with spec ~s" spec)))) (error #f "cannot find library with spec ~s" spec))))
(define label->binding-table (make-hashtable)) (define label->binding-table (make-eq-hashtable))
(define (install-library-record lib) (define (install-library-record lib)
(let ((exp-env (library-env lib))) (let ((exp-env (library-env lib)))

View File

@ -17,8 +17,8 @@
[fi (rnrs files (6))] [fi (rnrs files (6))]
[ne (null-environment)] [ne (null-environment)]
[sr (rnrs sorting (6))] [sr (rnrs sorting (6))]
[ba (rnrs base (6))]
[ls (rnrs lists (6))] [ls (rnrs lists (6))]
[ba (rnrs base (6))]
[is (rnrs io simple (6))] [is (rnrs io simple (6))]
[bv (rnrs bytevectors (6))] [bv (rnrs bytevectors (6))]
[uc (rnrs unicode (6))] [uc (rnrs unicode (6))]
@ -678,7 +678,7 @@
[hashtable-size S ht] [hashtable-size S ht]
[hashtable-update! S ht] [hashtable-update! S ht]
[hashtable? S ht] [hashtable? S ht]
[make-eq-hashtable S ht] [make-eq-hashtable C ht]
[make-eqv-hashtable S ht] [make-eqv-hashtable S ht]
[hashtable-hash-function D ht] [hashtable-hash-function D ht]
[make-hashtable D ht] [make-hashtable D ht]