[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/07: Disable resolve-primitives pass below -O2
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/07: Disable resolve-primitives pass below -O2 |
Date: |
Fri, 5 Jan 2018 09:25:24 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 51fd5952cb9e45f850e606a682c17b7609dd72ca
Author: Andy Wingo <address@hidden>
Date: Fri Jan 5 10:40:03 2018 +0100
Disable resolve-primitives pass below -O2
* module/language/tree-il/optimize.scm (optimize): Disable
resolve-primitives below -O2. This is because compile-cps is going to
start expanding all primcalls it sees.
---
module/language/tree-il/optimize.scm | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/module/language/tree-il/optimize.scm
b/module/language/tree-il/optimize.scm
index 1bd0c79..13b0977 100644
--- a/module/language/tree-il/optimize.scm
+++ b/module/language/tree-il/optimize.scm
@@ -28,16 +28,30 @@
#:export (optimize
tree-il-optimizations))
+(define (kw-arg-ref args kw default)
+ (match (memq kw args)
+ ((_ val . _) val)
+ (_ default)))
+
+(define *debug?* #f)
+
+(define (maybe-verify x)
+ (if *debug?*
+ (verify-tree-il x)
+ x))
+
(define (optimize x env opts)
- (let ((peval (match (memq #:partial-eval? opts)
- ((#:partial-eval? #f _ ...)
- ;; Disable partial evaluation.
- (lambda (x e) x))
- (_ peval))))
- (fix-letrec
- (verify-tree-il
- (peval (expand-primitives (resolve-primitives x env))
- env)))))
+ (define-syntax-rule (run-pass pass kw default)
+ (when (kw-arg-ref opts kw default)
+ (set! x (maybe-verify (pass x)))))
+ (define (resolve* x) (resolve-primitives x env))
+ (define (peval* x) (peval x env))
+ (maybe-verify x)
+ (run-pass resolve* #:resolve-primitives? #t)
+ (run-pass expand-primitives #:expand-primitives? #t)
+ (run-pass peval* #:partial-eval? #t)
+ (run-pass fix-letrec #:fix-letrec? #t)
+ x)
(define (tree-il-optimizations)
;; Avoid resolve-primitives until -O2, when CPS optimizations kick in.
- [Guile-commits] branch master updated (118f516 -> 7486806), Andy Wingo, 2018/01/05
- [Guile-commits] 03/07: Prevent LICM of memory accesses guarded by effect-free predicates, Andy Wingo, 2018/01/05
- [Guile-commits] 06/07: Allow peval to gnaw on string->symbol, symbol->string, Andy Wingo, 2018/01/05
- [Guile-commits] 04/07: Allow peeling loops with bailouts, Andy Wingo, 2018/01/05
- [Guile-commits] 02/07: Disable resolve-primitives pass below -O2,
Andy Wingo <=
- [Guile-commits] 05/07: Instruction explosion for vector-{length, ref, set!}, Andy Wingo, 2018/01/05
- [Guile-commits] 01/07: Add (system base optimize) module, Andy Wingo, 2018/01/05
- [Guile-commits] 07/07: Improve compilation of make-vector without init, Andy Wingo, 2018/01/05