[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 04/25: Make integer devirtualization less eager
From: |
Andy Wingo |
Subject: |
[Guile-commits] 04/25: Make integer devirtualization less eager |
Date: |
Mon, 8 Jan 2018 09:25:02 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit ef23e512b528b9c45e0461d661ece4f0de1c84a8
Author: Andy Wingo <address@hidden>
Date: Sun Jan 7 12:59:33 2018 +0100
Make integer devirtualization less eager
* module/language/cps/devirtualize-integers.scm (bailout?): Factor out.
(peel-trace): Adapt to call external bailout? predicate.
(peel-traces-in-function): Don't peel traces whose alternate is a
bailout.
---
module/language/cps/devirtualize-integers.scm | 34 +++++++++++++++------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/module/language/cps/devirtualize-integers.scm
b/module/language/cps/devirtualize-integers.scm
index 16117c3..c4b875d 100644
--- a/module/language/cps/devirtualize-integers.scm
+++ b/module/language/cps/devirtualize-integers.scm
@@ -83,6 +83,11 @@
cps
(transient-intmap))))
+(define (bailout? cps label)
+ (match (intmap-ref cps label)
+ (($ $kargs _ _ ($ $throw)) #t)
+ (_ #f)))
+
(define (peel-trace cps label fx kexit use-counts)
"For the graph starting at LABEL, try to peel out a trace that uses
the variable FX. A peelable trace consists of effect-free terms, or
@@ -116,10 +121,6 @@ the trace should be referenced outside of it."
((= count 1) (intmap-remove live-vars var))
(else (intmap-replace live-vars var (1- count)))))
vars))))
- (define (bailout? k)
- (match (intmap-ref cps k)
- (($ $kargs _ _ ($ $throw)) #t)
- (_ #f)))
(match (intmap-ref cps label)
;; We know the initial label is a $kargs, and we won't follow the
;; graph to get to $kreceive etc, so we can stop with these two
@@ -172,12 +173,12 @@ the trace should be referenced outside of it."
(cond
((not uses-of-interest?)
(fail))
- ((bailout? kt)
+ ((bailout? cps kt)
(continue kf live-vars defs-of-interest? can-terminate-trace?
(lambda (kf)
(build-term
($branch kf kt src op param peeled-args)))))
- ((bailout? kf)
+ ((bailout? cps kf)
(continue kt live-vars defs-of-interest? can-terminate-trace?
(lambda (kt)
(build-term
@@ -236,15 +237,18 @@ the trace should be referenced outside of it."
;; Traces start with a fixnum? predicate. We could expand this
;; in the future if we wanted to.
(($ $kargs names vars ($ $branch kf kt src 'fixnum? #f (x)))
- (with-cps cps
- (let$ kt (peel-trace kt x kf use-counts))
- ($ ((lambda (cps)
- (if kt
- (with-cps cps
- (setk label
- ($kargs names vars
- ($branch kf kt src 'fixnum? #f (x)))))
- cps))))))
+ (if (and (bailout? cps kf) #f)
+ ;; Don't peel traces whose alternate is just a bailout.
+ cps
+ (with-cps cps
+ (let$ kt (peel-trace kt x kf use-counts))
+ ($ ((lambda (cps)
+ (if kt
+ (with-cps cps
+ (setk label
+ ($kargs names vars
+ ($branch kf kt src 'fixnum? #f (x)))))
+ cps)))))))
(_ cps)))
body
cps))
- [Guile-commits] 24/25: Sync IP before allocating closures, (continued)
- [Guile-commits] 24/25: Sync IP before allocating closures, Andy Wingo, 2018/01/08
- [Guile-commits] 19/25: Expand pair-related primcalls, Andy Wingo, 2018/01/08
- [Guile-commits] 16/25: Re-add compiler backend support for immutable vectors, Andy Wingo, 2018/01/08
- [Guile-commits] 25/25: Save VM compare result before calling out to hooks, Andy Wingo, 2018/01/08
- [Guile-commits] 01/25: Fix verify.scm for call-thunk/no-inline, Andy Wingo, 2018/01/08
- [Guile-commits] 22/25: Better compilation of vector constructors and initializers, Andy Wingo, 2018/01/08
- [Guile-commits] 08/25: Instruction explosion for /immediate variants of vector prims, Andy Wingo, 2018/01/08
- [Guile-commits] 06/25: Fix primitive reification for scm-set! / word-set!., Andy Wingo, 2018/01/08
- [Guile-commits] 17/25: Compiler frontend support for vector mutability checks, Andy Wingo, 2018/01/08
- [Guile-commits] 23/25: Improve make-vector compilation for known big sizes, Andy Wingo, 2018/01/08
- [Guile-commits] 04/25: Make integer devirtualization less eager,
Andy Wingo <=
- [Guile-commits] 02/25: Fix specialization of the allocate-words family of instructions, Andy Wingo, 2018/01/08
- [Guile-commits] 14/25: Fix bug in struct-ref effects analysis, Andy Wingo, 2018/01/08
- [Guile-commits] 20/25: Remove special optimizer and backend support for pairs, Andy Wingo, 2018/01/08