1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

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.
This commit is contained in:
Andy Wingo 2020-05-11 22:42:50 +02:00
parent 44ad8fbde5
commit cb8cabe85f
3 changed files with 25 additions and 28 deletions

View file

@ -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)