summaryrefslogtreecommitdiff
path: root/module/system/base/compile.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2020-05-11 22:42:50 +0200
committerAndy Wingo <wingo@pobox.com>2020-05-12 09:54:19 +0200
commitcb8cabe85f535542ac4fcb165d89722500e42653 (patch)
tree7c48aa561ceb705d378e14a70d5e12f527e836e3 /module/system/base/compile.scm
parent44ad8fbde55df452ac1c88427662403e7af5b9bb (diff)
downloadguile-cb8cabe85f535542ac4fcb165d89722500e42653.tar.gz
Delay loading CPS unless CPS compiler used
* module/language/tree-il/spec.scm: Remove #:compilers declaration; instead rely on choose-compiler. (choose-compiler): Load compilers on demand. * module/system/base/compile.scm (find-language-joint): Use next-pass instead of lookup-compilation-order, to avoid loading unused compilers. (read-and-compile): Adapt to find-language-joint change. (compute-compiler): Export. * module/scripts/compile.scm (compile): Use compute-compiler to load compiler modules.
Diffstat (limited to 'module/system/base/compile.scm')
-rw-r--r--module/system/base/compile.scm25
1 files changed, 12 insertions, 13 deletions
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index 26b28bf41..567765dc0 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -26,6 +26,7 @@
#:export (compiled-file-name
compile-file
compile-and-load
+ compute-compiler
read-and-compile
compile
decompile
@@ -267,18 +268,16 @@
;; unit.
(values exp env cenv)))))))))
-(define (find-language-joint from to)
- (match (lookup-compilation-order from to)
- (((langs . passes) ...)
- (or (let lp ((langs langs))
- (match langs
- (() #f)
- ((lang . langs)
- (or (lp langs)
- (and (language-joiner lang)
- lang)))))
- to))
- (_ (error "no way to compile" from "to" to))))
+(define (find-language-joint from to optimization-level opts)
+ (let ((from (ensure-language from))
+ (to (ensure-language to)))
+ (let lp ((lang from))
+ (match (next-pass from lang to optimization-level opts)
+ (#f #f)
+ ((next . pass)
+ (or (lp next)
+ (and (language-joiner next)
+ next)))))))
(define (default-language-joiner lang)
(lambda (exps env)
@@ -305,7 +304,7 @@
(opts '()))
(let* ((from (ensure-language from))
(to (ensure-language to))
- (joint (find-language-joint from to)))
+ (joint (find-language-joint from to optimization-level opts)))
(parameterize ((current-language from))
(let lp ((exps '()) (env #f) (cenv env) (from #f) (compile1 #f))
(match (read-and-parse (current-language) port cenv)