Skip to content

Commit 9f838a6

Browse files
committed
Wasm: type analysis
1 parent 80de909 commit 9f838a6

File tree

5 files changed

+470
-17
lines changed

5 files changed

+470
-17
lines changed

compiler/lib-wasm/generate.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module Generate (Target : Target_sig.S) = struct
3636
{ live : int array
3737
; in_cps : Effects.in_cps
3838
; deadcode_sentinal : Var.t
39+
; types : Typing.typ Var.Tbl.t [@warning "-69"]
3940
; blocks : block Addr.Map.t
4041
; closures : Closure_conversion.closure Var.Map.t
4142
; global_context : Code_generation.context
@@ -1183,7 +1184,8 @@ module Generate (Target : Target_sig.S) = struct
11831184
~should_export
11841185
~warn_on_unhandled_effect
11851186
*)
1186-
~deadcode_sentinal =
1187+
~deadcode_sentinal
1188+
~types =
11871189
global_context.unit_name <- unit_name;
11881190
let p, closures = Closure_conversion.f p in
11891191
(*
@@ -1193,6 +1195,7 @@ module Generate (Target : Target_sig.S) = struct
11931195
{ live = live_vars
11941196
; in_cps
11951197
; deadcode_sentinal
1198+
; types
11961199
; blocks = p.blocks
11971200
; closures
11981201
; global_context
@@ -1300,9 +1303,11 @@ let init = G.init
13001303
let start () = make_context ~value_type:Gc_target.Type.value
13011304

13021305
let f ~context ~unit_name p ~live_vars ~in_cps ~deadcode_sentinal =
1306+
let state, info = Global_flow.f' ~fast:false p in
1307+
let types = Typing.f ~state ~info p in
13031308
let t = Timer.make () in
13041309
let p = fix_switch_branches p in
1305-
let res = G.f ~context ~unit_name ~live_vars ~in_cps ~deadcode_sentinal p in
1310+
let res = G.f ~context ~unit_name ~live_vars ~in_cps ~deadcode_sentinal ~types p in
13061311
if times () then Format.eprintf " code gen.: %a@." Timer.print t;
13071312
res
13081313

0 commit comments

Comments
 (0)