From b5cf24813cb4342427eb42638c81207a78fae8a2 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 1 Jun 2011 16:38:03 -0400 Subject: [PATCH] Add a "unique" key to log messages that are sent by the optimizer. original commit: 81d6e380dad25205ddbf82120cad27ad65c83235 --- collects/typed-scheme/optimizer/utils.rkt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/collects/typed-scheme/optimizer/utils.rkt b/collects/typed-scheme/optimizer/utils.rkt index 6a7d4a2d..a99d184f 100644 --- a/collects/typed-scheme/optimizer/utils.rkt +++ b/collects/typed-scheme/optimizer/utils.rkt @@ -8,6 +8,7 @@ (rep type-rep)) (provide log-optimization log-missed-optimization + optimization-log-key print-log clear-log *show-optimized-code* subtypeof? isoftype? @@ -25,6 +26,12 @@ (struct log-entry (msg line col) #:transparent) +;; to identify log messages that come from the optimizer +;; to be stored in the data section of log messages +;; external tools/scripts (like the test harness) can look for it +;; since this is used across phases, can't be a gensym +(define optimization-log-key 'log-message-coming-from-the-TR-optimizer) + ;; we keep track of log entries, to avoid repetitions that would be ;; caused by traversing the same syntax multiple times (which is not ;; a problem per se) @@ -43,7 +50,9 @@ ;; once the optimizer is done, we sort the log according to source ;; location, then print it (define (print-log) - (for-each (lambda (x) (log-warning (log-entry-msg x))) + (define logger (current-logger)) + (for-each (lambda (x) (log-message logger 'warning (log-entry-msg x) + optimization-log-key)) (sort (set->list log-so-far) (lambda (x y) (match* (x y)