Skip to content

Commit 63f3a8e

Browse files
committed
Use a list to store variable dependencies
1 parent 62b2e25 commit 63f3a8e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/lib/global_flow.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type escape_status =
8787

8888
type state =
8989
{ vars : Var.ISet.t (* Set of all veriables considered *)
90-
; deps : Var.t Var.Tbl.DataSet.t Var.Tbl.t (* Dependency between variables *)
90+
; deps : Var.t list Var.Tbl.t (* Dependency between variables *)
9191
; defs : def array (* Definition of each variable *)
9292
; variable_may_escape : escape_status array
9393
(* Any value bound to this variable may escape *)
@@ -114,7 +114,7 @@ type state =
114114
let add_var st x = Var.ISet.add st.vars x
115115

116116
(* x depends on y *)
117-
let add_dep st x y = Var.Tbl.add_set st.deps y x
117+
let add_dep st x y = Var.Tbl.set st.deps y (x :: Var.Tbl.get st.deps y)
118118

119119
let add_expr_def st x e =
120120
add_var st x;
@@ -606,7 +606,7 @@ let solver st =
606606
{ G.domain = st.vars
607607
; G.iter_children =
608608
(fun f x ->
609-
Var.Tbl.DataSet.iter f (Var.Tbl.get st.deps x);
609+
List.iter ~f (Var.Tbl.get st.deps x);
610610
List.iter
611611
~f:(fun g -> List.iter ~f (associated_list st.function_call_sites g))
612612
(associated_list st.functions_from_returned_value x))
@@ -642,7 +642,7 @@ let f ~fast p =
642642
let rets = return_values p in
643643
let nv = Var.count () in
644644
let vars = Var.ISet.empty () in
645-
let deps = Var.Tbl.make_set () in
645+
let deps = Var.Tbl.make () [] in
646646
let defs = Array.make nv undefined in
647647
let variable_may_escape = Array.make nv No in
648648
let variable_possibly_mutable = Var.ISet.empty () in

0 commit comments

Comments
 (0)