Skip to content

Commit 8082401

Browse files
committed
Typing: use a bitset rather than an array of bools
1 parent 4e3c8db commit 8082401

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/lib-wasm/typing.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ let update_deps st { blocks; _ } =
134134
blocks
135135

136136
let mark_function_parameters { blocks; _ } =
137-
let function_parameters = Var.Tbl.make () false in
138-
let set x = Var.Tbl.set function_parameters x true in
137+
let function_parameters = Var.ISet.empty () in
138+
let set x = Var.ISet.add function_parameters x in
139139
Addr.Map.iter
140140
(fun _ block ->
141141
List.iter block.body ~f:(fun i ->
@@ -148,7 +148,7 @@ let mark_function_parameters { blocks; _ } =
148148
type st =
149149
{ state : state
150150
; info : info
151-
; function_parameters : bool Var.Tbl.t
151+
; function_parameters : Var.ISet.t
152152
}
153153

154154
let rec constant_type (c : constant) =
@@ -328,7 +328,7 @@ let propagate st approx x : Domain.t =
328328
| Phi { known; others; unit } ->
329329
let res = Domain.join_set ~others (fun y -> Var.Tbl.get approx y) known in
330330
let res = if unit then Domain.join (Int Unnormalized) res else res in
331-
if Var.Tbl.get st.function_parameters x then Domain.box res else res
331+
if Var.ISet.mem st.function_parameters x then Domain.box res else res
332332
| Expr e -> (
333333
match e with
334334
| Constant c -> constant_type c

0 commit comments

Comments
 (0)