1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

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.
This commit is contained in:
Andy Wingo 2020-06-01 21:15:39 +02:00
parent 4c10ea0e57
commit e2066d2e63
3 changed files with 4 additions and 17 deletions

View file

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

View file

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

View file

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