From ff5546f5c6898ae47f72a8edbb3c6f13be60ce7e Mon Sep 17 00:00:00 2001 From: Keisuke Nishida Date: Mon, 16 Apr 2001 03:42:36 +0000 Subject: [PATCH] * boot-9.scm (load-compiled): New variable, initialized in the VM. (try-module-autoload): Try loading compiled modules if applicable. --- ice-9/ChangeLog | 5 +++++ ice-9/boot-9.scm | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index 20e054d25..48333bd72 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,8 @@ +2001-04-15 Keisuke Nishida + + * boot-9.scm (load-compiled): New variable, initialized in the VM. + (try-module-autoload): Try loading compiled modules if applicable. + 2001-04-15 Keisuke Nishida * boot-9.scm (call-with-deprecation): New procedure. diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index afca0435a..4cdfab4c2 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -1727,6 +1727,10 @@ (module-constructor #() '() b #f #f name 'autoload '() (make-weak-value-hash-table 31) 0))) +;;; {Compiled module} + +(define load-compiled #f) + ;;; {Autoloading modules} @@ -1743,14 +1747,20 @@ (resolve-module dir-hint-module-name #f) (and (not (autoload-done-or-in-progress? dir-hint name)) (let ((didit #f)) + (define (load-file proc file) + (save-module-excursion (lambda () (proc file))) + (set! didit #t)) (dynamic-wind (lambda () (autoload-in-progress! dir-hint name)) (lambda () - (let ((full (%search-load-path (in-vicinity dir-hint name)))) - (if full - (begin - (save-module-excursion (lambda () (primitive-load full))) - (set! didit #t))))) + (let ((file (in-vicinity dir-hint name))) + (cond ((and load-compiled + (%search-load-path (string-append file ".go"))) + => (lambda (full) + (load-file load-compiled full))) + ((%search-load-path file) + => (lambda (full) + (load-file primitive-load full)))))) (lambda () (set-autoloaded! dir-hint name didit))) didit))))