Skip to content

Commit b9d4de3

Browse files
committed
Add debug timing for Call_graph_analysis and Typing
1 parent 976c9ae commit b9d4de3

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 get_approx info x =
79
(* Specialization can add some variables *)
810
if Var.idx x < Var.Tbl.length info.Global_flow.info_approximation
@@ -41,6 +43,7 @@ let direct_calls_only info f =
4143
Config.Flag.optcall () && Var.Hashtbl.mem info.unambiguous_non_escaping f
4244

4345
let f p info =
46+
let t = Timer.make () in
4447
let non_escaping = Var.Hashtbl.create 128 in
4548
let ambiguous = Var.Hashtbl.create 128 in
4649
fold_closures
@@ -58,4 +61,5 @@ let f p info =
5861
Var.Hashtbl.iter (fun x () -> Var.Hashtbl.remove non_escaping x) ambiguous;
5962
if debug ()
6063
then Format.eprintf " unambiguous-non-escaping:%d@." (Var.Hashtbl.length non_escaping);
64+
if times () then Format.eprintf " call graph analysis: %a@." Timer.print t;
6165
{ 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)