Log fuel and closure size.

That way, we can detect close calls post facto.
This commit is contained in:
Vincent St-Amour 2011-10-20 14:30:01 -04:00
parent 8e580b5c6f
commit 570c5ef0f4
2 changed files with 23 additions and 10 deletions

View File

@ -75,6 +75,7 @@
"( in: (([^ :]+):([^ :]+):([^ :]+): )?([^ ]+))?"
;; module info, useless to us (at least for now)
" in module: [^ ]+")
" size: ([^ ]+) threshold: ([^ ]+)"
"$"))
(struct inlining-event (kind ; success, miss, out of fuel, ...
@ -82,13 +83,17 @@
loc ; (U #f (List path line col pos span))
where-name ; _where_ it gets inlined (enclosing fun)
where-loc ; (U #f (Line path line col))
size ; size of the closure being inlined
threshold ; how big of a closure can we inline
;; the last two use the same units
))
(define (parse-inlining-event l)
(match (regexp-match inlining-event-regexp l)
[`(,all ,kind
,what ,name ,path ,line ,col ,pos ,span
,only-name
,where ,where-loc ,where-path ,where-line ,where-col ,where-name)
,where ,where-loc ,where-path ,where-line ,where-col ,where-name
,size ,threshold)
(inlining-event kind
(string->symbol (or name only-name))
(if only-name
@ -103,13 +108,15 @@
(list where-path
(string->number where-line)
(string->number where-col))
#f))] ; no source location
#f) ; no source location
(string->number size)
(string->number threshold))]
[_ (error "ill-formed inlining log entry" l)]))
;; f gets inlined in f (or tried to)
(define (self-inline-evt? evt)
(match evt
[(inlining-event kind name loc where-name where-loc)
[(inlining-event kind name loc where-name where-loc size threshold)
(match* (loc where-loc)
[((list path line col pos span)
(list where-path where-line where-col))
@ -121,7 +128,7 @@
(define (inlining-event->forged-stx evt)
(match evt
[(inlining-event kind name loc where-name where-loc)
[(inlining-event kind name loc where-name where-loc size threshold)
(datum->syntax #'here name loc)]))

View File

@ -1092,9 +1092,11 @@ Scheme_Object *optimize_for_inline(Optimize_Info *info, Scheme_Object *le, int a
scheme_log(NULL,
SCHEME_LOG_WARNING,
0,
"mzc optimizer: inlining: involving: %s%s",
"mzc optimizer: inlining: involving: %s%s size: %d threshold: %d",
scheme_write_to_string(data->name ? data->name : scheme_false, NULL),
scheme_optimize_context_to_string(info->context));
scheme_optimize_context_to_string(info->context),
sz,
threshold);
le = apply_inlined(le, data, sub_info, argc, app, app2, app3, context,
nested_count, orig_le, prev, prev_offset);
if (nested_count)
@ -1105,9 +1107,11 @@ Scheme_Object *optimize_for_inline(Optimize_Info *info, Scheme_Object *le, int a
scheme_log(NULL,
SCHEME_LOG_WARNING,
0,
"mzc optimizer: no inlining: involving: %s%s",
"mzc optimizer: no inlining: involving: %s%s size: %d threshold: %d",
scheme_write_to_string(data->name ? data->name : scheme_false, NULL),
scheme_optimize_context_to_string(info->context));
scheme_optimize_context_to_string(info->context),
sz,
threshold);
}
} else {
LOG_INLINE(fprintf(stderr, "No fuel %s %d[%d]>%d@%d %d\n", scheme_write_to_string(data->name ? data->name : scheme_false, NULL),
@ -1116,9 +1120,11 @@ Scheme_Object *optimize_for_inline(Optimize_Info *info, Scheme_Object *le, int a
scheme_log(NULL,
SCHEME_LOG_WARNING,
0,
"mzc optimizer: no inlining, out of fuel: involving: %s%s",
"mzc optimizer: no inlining, out of fuel: involving: %s%s size: %d threshold: %d",
scheme_write_to_string(data->name ? data->name : scheme_false, NULL),
scheme_optimize_context_to_string(info->context));
scheme_optimize_context_to_string(info->context),
sz,
threshold);
}
} else {
/* Issue warning below */