From a71565e77ab1251c7a8ff64ccf47a44b5a10e803 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 11 Oct 2011 17:03:40 -0400 Subject: [PATCH] Parse inlining location information. --- collects/typed-racket/optimizer/tool/mzc.rkt | 34 +++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/collects/typed-racket/optimizer/tool/mzc.rkt b/collects/typed-racket/optimizer/tool/mzc.rkt index 5a3537f315..53d5e7d477 100644 --- a/collects/typed-racket/optimizer/tool/mzc.rkt +++ b/collects/typed-racket/optimizer/tool/mzc.rkt @@ -51,25 +51,35 @@ ;; Attempt at making this thing readable. any-inlining-event-regexp "involving: " + ;; _What_ gets inlined (or not). (string-append ; either a vector with name and source info, or just name "(" "#\\(([^ ]+) # ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) [^ ]+\\)" "|" - "([^ ]+)" - ")"))) + "([^ ]+)" ; just name, we won't be able to do much with it + ")") + ;; _Where_ this happens (in which function, can't get more precise info). + (string-append + ;; maybe full path info: path, line, col, name + "( in: (([^ :]+):([^ :]+):([^ :]+): )?([^ ]+))?" + ;; module info, useless to us (at least for now) + " in module: [^ ]+") + "$")) (define (inlining-event->forged-stx l) (match (regexp-match inlining-event-regexp l) - [`(,all ,pre ,vec ,name ,path ,line ,col ,pos ,span #f) - (datum->syntax #'here (string->symbol name) - (list path - (string->number line) - (string->number col) - (string->number pos) - (string->number span)))] - [`(,all ,pre ,name #f #f #f #f #f #f ,name) - ;; We only know the name. there's not much we can do with that. - (datum->syntax #'here (string->symbol name) #f)] + [`(,all ,kind + ,what ,name ,path ,line ,col ,pos ,span + ,only-name + ,where ,where-loc ,where-path ,where-line ,where-col ,where-name) + (datum->syntax #'here (string->symbol (or name only-name)) + (if only-name + #f ; no source location + (list path + (string->number line) + (string->number col) + (string->number pos) + (string->number span))))] [_ (error "ill-formed inlining log entry" l)])) (define success-kind "Inlining")