restore module cache
The module cache was added in97ce26b1
(April 16, 2011), but it was accidentally disabled ine9721058
(May 5, 2011). This time, I figured out a way to test whether the cache is working (other than to benchmark examples, which is how I discovered that it wasn't working).
This commit is contained in:
parent
2d1b0172fb
commit
b02e37b0b9
|
@ -202,6 +202,31 @@
|
|||
(kill-thread th)))
|
||||
(test #t namespace? (make-base-empty-namespace)))
|
||||
|
||||
;; ----------------------------------------
|
||||
;; Check module caching by monitoring `current-eval'.
|
||||
;; If the module cache works, then it turns out that
|
||||
;; the `module-compiled-imports' of modules to evaluate
|
||||
;; will be `eq?' the second time around to the first time
|
||||
;; around. This is a fragile and imprecise check, but it's
|
||||
;; the best idea we have to checking that the module cache
|
||||
;; works.
|
||||
|
||||
(let ([codes (make-hash)])
|
||||
(define (go-once)
|
||||
(parameterize ([current-namespace (make-base-namespace)]
|
||||
[current-eval
|
||||
(let ([orig (current-eval)])
|
||||
(lambda (x)
|
||||
(when (syntax? x)
|
||||
(when (compiled-module-expression? (syntax-e x))
|
||||
(hash-set! codes (module-compiled-imports (syntax-e x)) #t)))
|
||||
(orig x)))])
|
||||
(dynamic-require 'racket/string #f)))
|
||||
(go-once)
|
||||
(let ([pre (hash-count codes)])
|
||||
(go-once)
|
||||
(test pre hash-count codes)))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -5334,7 +5334,7 @@ static Scheme_Object *do_module_execute(Scheme_Object *data, Scheme_Env *genv, i
|
|||
|
||||
Scheme_Object *scheme_module_execute(Scheme_Object *data, Scheme_Env *genv)
|
||||
{
|
||||
return do_module_execute(data, genv, 0);
|
||||
return do_module_execute(data, genv, 1);
|
||||
}
|
||||
|
||||
static Scheme_Object *rebuild_et_vec(Scheme_Object *naya, Scheme_Object *vec, Resolve_Prefix *rp)
|
||||
|
|
Loading…
Reference in New Issue
Block a user