Skip to content

Commit 1240e26

Browse files
committed
Add debug timing for Call_graph_analysis and Typing
1 parent 93908d7 commit 1240e26

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/lib-wasm/call_graph_analysis.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ open Code
33

44
let debug = Debug.find "call-graph"
55

6+
let times = Debug.find "times"
7+
68
let block_deps ~info ~non_escaping ~ambiguous ~blocks pc =
79
let block = Addr.Map.find pc blocks in
810
List.iter block.body ~f:(fun i ->
@@ -39,6 +41,7 @@ let direct_calls_only info f =
3941
Config.Flag.optcall () && Var.Hashtbl.mem info.unambiguous_non_escaping f
4042

4143
let f p info =
44+
let t = Timer.make () in
4245
let non_escaping = Var.Hashtbl.create 128 in
4346
let ambiguous = Var.Hashtbl.create 128 in
4447
fold_closures
@@ -56,4 +59,5 @@ let f p info =
5659
Var.Hashtbl.iter (fun x () -> Var.Hashtbl.remove non_escaping x) ambiguous;
5760
if debug ()
5861
then Format.eprintf " unambiguous-non-escaping:%d@." (Var.Hashtbl.length non_escaping);
62+
if times () then Format.eprintf " call graph analysis: %a@." Timer.print t;
5963
{ unambiguous_non_escaping = non_escaping }

compiler/lib-wasm/typing.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ open Global_flow
44

55
let debug = Debug.find "typing"
66

7+
let times = Debug.find "times"
8+
79
module Integer = struct
810
type kind =
911
| Ref
@@ -420,10 +422,12 @@ let solver st =
420422
Solver.f () g (propagate st)
421423

422424
let f ~state ~info ~deadcode_sentinal p =
425+
let t = Timer.make () in
423426
update_deps state p;
424427
let function_parameters = mark_function_parameters p in
425428
let typ = solver { state; info; function_parameters } in
426429
Var.Tbl.set typ deadcode_sentinal (Int Normalized);
430+
if times () then Format.eprintf " type analysis: %a@." Timer.print t;
427431
if debug ()
428432
then (
429433
Var.ISet.iter

0 commit comments

Comments
 (0)