Log fuel and closure size.
That way, we can detect close calls post facto.
This commit is contained in:
parent
8e580b5c6f
commit
570c5ef0f4
|
@ -75,6 +75,7 @@
|
||||||
"( in: (([^ :]+):([^ :]+):([^ :]+): )?([^ ]+))?"
|
"( in: (([^ :]+):([^ :]+):([^ :]+): )?([^ ]+))?"
|
||||||
;; module info, useless to us (at least for now)
|
;; module info, useless to us (at least for now)
|
||||||
" in module: [^ ]+")
|
" in module: [^ ]+")
|
||||||
|
" size: ([^ ]+) threshold: ([^ ]+)"
|
||||||
"$"))
|
"$"))
|
||||||
|
|
||||||
(struct inlining-event (kind ; success, miss, out of fuel, ...
|
(struct inlining-event (kind ; success, miss, out of fuel, ...
|
||||||
|
@ -82,13 +83,17 @@
|
||||||
loc ; (U #f (List path line col pos span))
|
loc ; (U #f (List path line col pos span))
|
||||||
where-name ; _where_ it gets inlined (enclosing fun)
|
where-name ; _where_ it gets inlined (enclosing fun)
|
||||||
where-loc ; (U #f (Line path line col))
|
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)
|
(define (parse-inlining-event l)
|
||||||
(match (regexp-match inlining-event-regexp l)
|
(match (regexp-match inlining-event-regexp l)
|
||||||
[`(,all ,kind
|
[`(,all ,kind
|
||||||
,what ,name ,path ,line ,col ,pos ,span
|
,what ,name ,path ,line ,col ,pos ,span
|
||||||
,only-name
|
,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
|
(inlining-event kind
|
||||||
(string->symbol (or name only-name))
|
(string->symbol (or name only-name))
|
||||||
(if only-name
|
(if only-name
|
||||||
|
@ -103,13 +108,15 @@
|
||||||
(list where-path
|
(list where-path
|
||||||
(string->number where-line)
|
(string->number where-line)
|
||||||
(string->number where-col))
|
(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)]))
|
[_ (error "ill-formed inlining log entry" l)]))
|
||||||
|
|
||||||
;; f gets inlined in f (or tried to)
|
;; f gets inlined in f (or tried to)
|
||||||
(define (self-inline-evt? evt)
|
(define (self-inline-evt? evt)
|
||||||
(match 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)
|
(match* (loc where-loc)
|
||||||
[((list path line col pos span)
|
[((list path line col pos span)
|
||||||
(list where-path where-line where-col))
|
(list where-path where-line where-col))
|
||||||
|
@ -121,7 +128,7 @@
|
||||||
|
|
||||||
(define (inlining-event->forged-stx evt)
|
(define (inlining-event->forged-stx evt)
|
||||||
(match 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)]))
|
(datum->syntax #'here name loc)]))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1092,9 +1092,11 @@ Scheme_Object *optimize_for_inline(Optimize_Info *info, Scheme_Object *le, int a
|
||||||
scheme_log(NULL,
|
scheme_log(NULL,
|
||||||
SCHEME_LOG_WARNING,
|
SCHEME_LOG_WARNING,
|
||||||
0,
|
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_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,
|
le = apply_inlined(le, data, sub_info, argc, app, app2, app3, context,
|
||||||
nested_count, orig_le, prev, prev_offset);
|
nested_count, orig_le, prev, prev_offset);
|
||||||
if (nested_count)
|
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(NULL,
|
||||||
SCHEME_LOG_WARNING,
|
SCHEME_LOG_WARNING,
|
||||||
0,
|
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_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 {
|
} 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),
|
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(NULL,
|
||||||
SCHEME_LOG_WARNING,
|
SCHEME_LOG_WARNING,
|
||||||
0,
|
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_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 {
|
} else {
|
||||||
/* Issue warning below */
|
/* Issue warning below */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user