* the library manager now has a hash table mapping all labels to
their bindings. This gives a 0.3 second speed up to the bootstrap process.
This commit is contained in:
parent
4c12889e10
commit
08a0bb0989
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -67,6 +67,8 @@
|
||||||
(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-hash-table))
|
||||||
|
|
||||||
(define (install-library id name ver
|
(define (install-library id name ver
|
||||||
imp* vis* inv* exp-subst exp-env visit-code invoke-code)
|
imp* vis* inv* exp-subst exp-env visit-code invoke-code)
|
||||||
(let ([imp-lib* (map find-library-by-spec/die imp*)]
|
(let ([imp-lib* (map find-library-by-spec/die imp*)]
|
||||||
|
@ -78,14 +80,14 @@
|
||||||
(error 'install-library "~s is already installed" name))
|
(error 'install-library "~s is already installed" name))
|
||||||
(let ([lib (make-library id name ver imp-lib* vis-lib* inv-lib*
|
(let ([lib (make-library id name ver imp-lib* vis-lib* inv-lib*
|
||||||
exp-subst exp-env visit-code invoke-code)])
|
exp-subst exp-env visit-code invoke-code)])
|
||||||
|
(for-each
|
||||||
|
(lambda (x)
|
||||||
|
(put-hash-table! label->binding-table (car x) (cdr x)))
|
||||||
|
exp-env)
|
||||||
((current-library-collection) lib))))
|
((current-library-collection) lib))))
|
||||||
|
|
||||||
(define (imported-label->binding lab)
|
(define (imported-label->binding lab)
|
||||||
(let f ([ls ((current-library-collection))])
|
(get-hash-table label->binding-table lab #f))
|
||||||
(cond
|
|
||||||
[(null? ls) #f]
|
|
||||||
[(assq lab (library-env (car ls))) => cdr]
|
|
||||||
[else (f (cdr ls))])))
|
|
||||||
|
|
||||||
(define (imported-loc->library loc)
|
(define (imported-loc->library loc)
|
||||||
(define (loc-in-env? ls)
|
(define (loc-in-env? ls)
|
||||||
|
|
Loading…
Reference in New Issue