Cut down bootstrap time by 10% by caching the values of scheme-stx.
Macroexpansion time is reduced by 25%.
This commit is contained in:
parent
1943212436
commit
a3f6e3e039
|
@ -1 +1 @@
|
|||
1411
|
||||
1412
|
||||
|
|
|
@ -811,19 +811,26 @@
|
|||
;;; (psyntax system $all) library, it creates a fresh identifier
|
||||
;;; that maps only the symbol to its label in that library.
|
||||
;;; Symbols not in that library become fresh.
|
||||
(define scheme-stx-hashtable (make-eq-hashtable))
|
||||
(define scheme-stx
|
||||
(lambda (sym)
|
||||
(let ((subst
|
||||
(library-subst
|
||||
(find-library-by-name '(psyntax system $all)))))
|
||||
(cond
|
||||
((assq sym subst) =>
|
||||
(lambda (x)
|
||||
(let ((name (car x)) (label (cdr x)))
|
||||
(add-subst
|
||||
(make-rib (list name) (list top-mark*) (list label) #f)
|
||||
(mkstx sym top-mark* '() '())))))
|
||||
(else (mkstx sym top-mark* '() '()))))))
|
||||
(or (hashtable-ref scheme-stx-hashtable sym #f)
|
||||
(let* ((subst
|
||||
(library-subst
|
||||
(find-library-by-name '(psyntax system $all))))
|
||||
(stx (mkstx sym top-mark* '() '()))
|
||||
(stx
|
||||
(cond
|
||||
((assq sym subst) =>
|
||||
(lambda (x)
|
||||
(let ((name (car x)) (label (cdr x)))
|
||||
(add-subst
|
||||
(make-rib (list name)
|
||||
(list top-mark*) (list label) #f)
|
||||
stx))))
|
||||
(else stx))))
|
||||
(hashtable-set! scheme-stx-hashtable sym stx)
|
||||
stx))))
|
||||
|
||||
;;; macros
|
||||
(define lexical-var car)
|
||||
|
|
Loading…
Reference in New Issue