Skip to content

Commit 74c15f4

Browse files
committed
[analyzer] make new record to replace terror tuple
1 parent 8569fc2 commit 74c15f4

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/optimization/analyzerTexprTransformer.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,9 +1018,12 @@ and block_to_texpr_coroutine ctx bb vcontinuation vresult verror p =
10181018
])) com.basic.tvoid p
10191019

10201020
and func ctx i =
1021-
let bb,t,p,tf,coroutine = Hashtbl.find ctx.graph.g_functions i in
1021+
let tfi = Hashtbl.find ctx.graph.g_functions i in
1022+
let tf = tfi.tf_tf in
1023+
let bb = tfi.tf_bb in
1024+
let p = tfi.tf_pos in
10221025
let e,tf_args,tf_type =
1023-
match coroutine with
1026+
match tfi.tf_coroutine with
10241027
| Some (vresult,verror) ->
10251028
let vcontinuation = alloc_var VGenerated "_hx_continuation" (tfun [t_dynamic] ctx.com.basic.tvoid) p in
10261029
declare_var ctx.graph vcontinuation bb;
@@ -1072,7 +1075,7 @@ and func ctx i =
10721075
Type.map_expr loop e
10731076
in
10741077
let e = loop e in
1075-
mk (TFunction {tf with tf_args = tf_args; tf_type = tf_type; tf_expr = e}) t p
1078+
mk (TFunction {tf with tf_args = tf_args; tf_type = tf_type; tf_expr = e}) tfi.tf_t p
10761079

10771080
let to_texpr ctx =
10781081
func ctx ctx.entry.bb_id

src/optimization/analyzerTypes.ml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,14 @@ end
246246
module Graph = struct
247247
open BasicBlock
248248

249-
type tfunc_info = BasicBlock.t * Type.t * pos * tfunc * (tvar * tvar) option
249+
type tfunc_info = {
250+
tf_bb : BasicBlock.t;
251+
tf_t : Type.t;
252+
tf_pos : pos;
253+
tf_tf : tfunc;
254+
tf_coroutine : (tvar * tvar) option;
255+
}
256+
250257
type texpr_lookup = BasicBlock.t * texpr_lookup_target
251258
type var_write = BasicBlock.t list
252259
type 'a itbl = (int,'a) Hashtbl.t
@@ -332,8 +339,8 @@ module Graph = struct
332339

333340
(* nodes *)
334341

335-
let add_function g tf t p bb coroutine =
336-
Hashtbl.add g.g_functions bb.bb_id (bb,t,p,tf,coroutine)
342+
let add_function g tf_tf tf_t tf_pos tf_bb tf_coroutine =
343+
Hashtbl.add g.g_functions tf_bb.bb_id ({tf_bb;tf_t;tf_pos;tf_tf;tf_coroutine})
337344

338345
let alloc_id =
339346
let r = ref 1 in
@@ -589,7 +596,7 @@ module Graph = struct
589596
()
590597
end
591598
in
592-
Hashtbl.iter (fun _ (bb,_,_,_,_) -> loop [0] bb) g.g_functions
599+
Hashtbl.iter (fun _ tfi -> loop [0] tfi.tf_bb) g.g_functions
593600
end
594601

595602
type analyzer_context = {

0 commit comments

Comments
 (0)