Have multiple irritants for missed optimizations.

This commit is contained in:
Vincent St-Amour 2011-06-03 12:24:41 -04:00
parent cb706aab9c
commit 6b5095df2d
5 changed files with 31 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#; #;
( (
all-real.rkt 24:0 (#%app + (quote 3) (quote 4)) -- binary, args all float-arg-expr, return type not Float -- caused by: 24:8 (quote 3) all-real.rkt 24:0 (#%app + (quote 3) (quote 4)) -- binary, args all float-arg-expr, return type not Float -- caused by: 24:8 (quote 3), 24:21 (quote 4)
all-real.rkt 25:0 (#%app * (quote 3) (quote 4)) -- binary, args all float-arg-expr, return type not Float -- caused by: 25:8 (quote 3) all-real.rkt 25:0 (#%app * (quote 3) (quote 4)) -- binary, args all float-arg-expr, return type not Float -- caused by: 25:8 (quote 3), 25:21 (quote 4)
7 7
12 12
) )

View File

@ -0,0 +1,9 @@
#;
(
multiple-irritants.rkt 9:0 (#%app * (quote 4) (quote 5) (quote 6.0)) -- binary, args all float-arg-expr, return type not Float -- caused by: 9:8 (quote 4), 9:24 (quote 5)
120.0
)
#lang typed/racket
(* (ann 4 Integer) (ann 5 Integer) 6.0)

View File

@ -8,7 +8,7 @@ precision-loss.rkt 28:1 + -- binary float
precision-loss.rkt 30:1 + -- binary float precision-loss.rkt 30:1 + -- binary float
precision-loss.rkt 36:0 (#%app * (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) -- binary, args all float-arg-expr, return type not Float -- caused by: 36:8 (#%app * (quote 3/4) (quote 2/3)) precision-loss.rkt 36:0 (#%app * (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) -- binary, args all float-arg-expr, return type not Float -- caused by: 36:8 (#%app * (quote 3/4) (quote 2/3))
precision-loss.rkt 36:0 (#%app * (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) -- exact arithmetic subexpression inside a float expression, extra precision discarded -- caused by: 36:8 (#%app * (quote 3/4) (quote 2/3)) precision-loss.rkt 36:0 (#%app * (#%app * (quote 3/4) (quote 2/3)) (quote 2.0)) -- exact arithmetic subexpression inside a float expression, extra precision discarded -- caused by: 36:8 (#%app * (quote 3/4) (quote 2/3))
precision-loss.rkt 36:8 (#%app * (quote 3/4) (quote 2/3)) -- binary, args all float-arg-expr, return type not Float -- caused by: 36:11 (quote 3/4) precision-loss.rkt 36:8 (#%app * (quote 3/4) (quote 2/3)) -- binary, args all float-arg-expr, return type not Float -- caused by: 36:11 (quote 3/4), 36:15 (quote 2/3)
2.5 2.5
2.75 2.75
1.25 1.25

View File

@ -102,7 +102,7 @@
(when missed-optimization? (when missed-optimization?
(log-missed-optimization "binary, args all float-arg-expr, return type not Float" (log-missed-optimization "binary, args all float-arg-expr, return type not Float"
this-syntax this-syntax
(for/first ([x (in-list (syntax->list #'(f1 f2 fs ...)))] (for/list ([x (in-list (syntax->list #'(f1 f2 fs ...)))]
#:when (not (subtypeof? x -Flonum))) #:when (not (subtypeof? x -Flonum)))
x))) x)))
;; If an optimization was expected (whether it was safe or not doesn't matter), ;; If an optimization was expected (whether it was safe or not doesn't matter),

View File

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require unstable/match racket/match racket/set (require unstable/match racket/match racket/set racket/string
racket/dict syntax/id-table racket/syntax unstable/syntax racket/dict syntax/id-table racket/syntax unstable/syntax
"../utils/utils.rkt" "../utils/utils.rkt"
(for-template racket/base) (for-template racket/base)
@ -82,14 +82,22 @@
;; of reporting them to the user. ;; of reporting them to the user.
;; This is meant to help users understand what hurts the performance of ;; This is meant to help users understand what hurts the performance of
;; their programs. ;; their programs.
(define (log-missed-optimization kind stx [irritant #f]) (define (log-missed-optimization kind stx [irritants '()])
(do-logging (if irritant ;; for convenience, if a single irritant is given, wrap it in a list
(format "~a -- caused by: ~a ~a" ;; implicitly
(let ([irritants (if (list? irritants) irritants (list irritants))])
(do-logging
(if (not (null? irritants))
(format "~a -- caused by: ~a"
kind kind
(string-join (map (lambda (irritant)
(format "~a ~a"
(line+col->string irritant) (line+col->string irritant)
(syntax->datum irritant)) (syntax->datum irritant)))
irritants)
", "))
kind) kind)
stx)) stx)))
;; if set to #t, the optimizer will dump its result to stdout before compilation ;; if set to #t, the optimizer will dump its result to stdout before compilation
(define *show-optimized-code* #f) (define *show-optimized-code* #f)