Skip to content

Commit a0b8c17

Browse files
committed
[analyzer] make new record to replace terror tuple
1 parent 8eceedc commit a0b8c17

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
@@ -1021,9 +1021,12 @@ and block_to_texpr_coroutine ctx bb vcontinuation vresult verror p =
10211021
])) com.basic.tvoid p
10221022

10231023
and func ctx i =
1024-
let bb,t,p,tf,coroutine = Hashtbl.find ctx.graph.g_functions i in
1024+
let tfi = Hashtbl.find ctx.graph.g_functions i in
1025+
let tf = tfi.tf_tf in
1026+
let bb = tfi.tf_bb in
1027+
let p = tfi.tf_pos in
10251028
let e,tf_args,tf_type =
1026-
match coroutine with
1029+
match tfi.tf_coroutine with
10271030
| Some (vresult,verror) ->
10281031
let vcontinuation = alloc_var VGenerated "_hx_continuation" (tfun [t_dynamic] ctx.com.basic.tvoid) p in
10291032
declare_var ctx.graph vcontinuation bb;
@@ -1075,7 +1078,7 @@ and func ctx i =
10751078
Type.map_expr loop e
10761079
in
10771080
let e = loop e in
1078-
mk (TFunction {tf with tf_args = tf_args; tf_type = tf_type; tf_expr = e}) t p
1081+
mk (TFunction {tf with tf_args = tf_args; tf_type = tf_type; tf_expr = e}) tfi.tf_t p
10791082

10801083
let to_texpr ctx =
10811084
func ctx ctx.entry.bb_id

src/optimization/analyzerTypes.ml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,14 @@ end
229229
module Graph = struct
230230
open BasicBlock
231231

232-
type tfunc_info = BasicBlock.t * Type.t * pos * tfunc * (tvar * tvar) option
232+
type tfunc_info = {
233+
tf_bb : BasicBlock.t;
234+
tf_t : Type.t;
235+
tf_pos : pos;
236+
tf_tf : tfunc;
237+
tf_coroutine : (tvar * tvar) option;
238+
}
239+
233240
type texpr_lookup = BasicBlock.t * texpr_lookup_target
234241
type var_write = BasicBlock.t list
235242
type 'a itbl = (int,'a) Hashtbl.t
@@ -315,8 +322,8 @@ module Graph = struct
315322

316323
(* nodes *)
317324

318-
let add_function g tf t p bb coroutine =
319-
Hashtbl.add g.g_functions bb.bb_id (bb,t,p,tf,coroutine)
325+
let add_function g tf_tf tf_t tf_pos tf_bb tf_coroutine =
326+
Hashtbl.add g.g_functions tf_bb.bb_id ({tf_bb;tf_t;tf_pos;tf_tf;tf_coroutine})
320327

321328
let alloc_id =
322329
let r = ref 1 in
@@ -573,7 +580,7 @@ module Graph = struct
573580
()
574581
end
575582
in
576-
Hashtbl.iter (fun _ (bb,_,_,_,_) -> loop [0] bb) g.g_functions
583+
Hashtbl.iter (fun _ tfi -> loop [0] tfi.tf_bb) g.g_functions
577584
end
578585

579586
type analyzer_context = {

0 commit comments

Comments
 (0)