diff options
author | Andy Wingo <wingo@pobox.com> | 2020-06-01 21:15:39 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2020-06-01 21:15:39 +0200 |
commit | e2066d2e639ecc81078e83fcd7acd8b75faf27a3 (patch) | |
tree | ce8b586b16364aee313557d568bc0cd82853eb40 | |
parent | 4c10ea0e5780d9eb3ad26bfe218a0c72030f15b2 (diff) | |
download | guile-e2066d2e639ecc81078e83fcd7acd8b75faf27a3.tar.gz |
Change -O1 compiler to use baseline and also resolve primitives
* bootstrap/Makefile.am (GUILE_OPTIMIZATIONS): Change to just -O1.
* module/language/tree-il/spec.scm (choose-compiler): Use CPS for -O2
and higher.
* module/system/base/optimize.scm (available-optimizations): CPS for -O2
and higher, but -Oresolve-primitives now at -O1 also.
-rw-r--r-- | bootstrap/Makefile.am | 7 | ||||
-rw-r--r-- | module/language/tree-il/spec.scm | 2 | ||||
-rw-r--r-- | module/system/base/optimize.scm | 12 |
3 files changed, 4 insertions, 17 deletions
diff --git a/bootstrap/Makefile.am b/bootstrap/Makefile.am index 6010f8411..a4634c447 100644 --- a/bootstrap/Makefile.am +++ b/bootstrap/Makefile.am @@ -22,12 +22,7 @@ GUILE_WARNINGS = -W0 -# Loading eval.go happens before boot and therefore before modules are -# resolved. For some reason if compiled without resolve-primitives, -# attempts to resolve primitives at boot fail; weird. Should fix this -# but in the meantime we turn on primitive resolution (which normally -# only happens at -O2). -GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ono-cps +GUILE_OPTIMIZATIONS = -O1 include $(top_srcdir)/am/bootstrap.am diff --git a/module/language/tree-il/spec.scm b/module/language/tree-il/spec.scm index 511a2e29c..05decf1a9 100644 --- a/module/language/tree-il/spec.scm +++ b/module/language/tree-il/spec.scm @@ -42,7 +42,7 @@ (module-ref (resolve-interface `(language tree-il ,compiler)) compiler)) (if (match (memq #:cps? opts) ((_ cps? . _) cps?) - (#f (<= 1 optimization-level))) + (#f (<= 2 optimization-level))) (cons 'cps (load-compiler 'compile-cps)) (cons 'bytecode (load-compiler 'compile-bytecode)))) diff --git a/module/system/base/optimize.scm b/module/system/base/optimize.scm index 3b056a540..6a88d7ecd 100644 --- a/module/system/base/optimize.scm +++ b/module/system/base/optimize.scm @@ -27,16 +27,8 @@ (define* (available-optimizations #:optional lang-name) (match lang-name ('tree-il - ;; Avoid resolve-primitives until -O2, when CPS optimizations kick in. - ;; Otherwise, inlining the primcalls during Tree-IL->CPS compilation - ;; will result in a lot of code that will never get optimized nicely. - ;; Similarly letrectification is great for generated code quality, but - ;; as it gives the compiler more to work with, it increases compile - ;; time enough that we reserve it for -O2. Also, this makes -O1 avoid - ;; assumptions about top-level values, in the same way that avoiding - ;; resolve-primitives does. - '((#:cps? 1) - (#:resolve-primitives? 2) + '((#:cps? 2) + (#:resolve-primitives? 1) (#:expand-primitives? 1) (#:letrectify? 2) (#:seal-private-bindings? 3) |