@@ -1124,40 +1124,6 @@ let cps_transform ~lifter_functions ~live_vars ~flow_info ~cps_needed p =
11241124 new_blocks
11251125 }
11261126 in
1127- let p =
1128- match Hashtbl. find_opt closure_info p.start with
1129- | None -> p
1130- | Some (cps_params , cps_cont ) ->
1131- (* Call [caml_trampoline_cps] to set up the execution context. *)
1132- let new_start = p.free_pc in
1133- let blocks =
1134- let main = Var. fresh () in
1135- let args = Var. fresh () in
1136- let res = Var. fresh () in
1137- Addr.Map. add
1138- new_start
1139- { params = []
1140- ; body =
1141- [ Let (main, Closure (cps_params, cps_cont)), noloc
1142- ; Let (args, Prim (Extern " %js_array" , [] )), noloc
1143- ; ( Let (res, Prim (Extern " caml_trampoline_cps" , [ Pv main; Pv args ]))
1144- , noloc )
1145- ]
1146- ; branch = Return res, noloc
1147- }
1148- p.blocks
1149- in
1150- (* Remove the direct-style toplevel code as it is now unreachable *)
1151- let blocks =
1152- Code. traverse
1153- { fold = Code. fold_children }
1154- (fun pc blocks -> Addr.Map. remove pc blocks)
1155- p.start
1156- blocks
1157- blocks
1158- in
1159- { start = new_start; blocks; free_pc = new_start + 1 }
1160- in
11611127 let p =
11621128 (* Initialize the global fiber stack and define a global identity function,
11631129 needed to translate [%resume] *)
@@ -1304,9 +1270,6 @@ let f (p, live_vars) =
13041270 let p = remove_empty_blocks ~live_vars p in
13051271 let flow_info = Global_flow. f ~fast: false p in
13061272 let cps_needed = Partial_cps_analysis. f p flow_info in
1307- debug_print " @[<v>cps_needed = @[<hov 2>" ;
1308- Var.Set. iter (fun v -> debug_print " %s,@ " (Var. to_string v)) cps_needed;
1309- debug_print " @]@,@]" ;
13101273 let p, lifter_functions, liftings = Lambda_lifting_simple. f ~to_lift: cps_needed p in
13111274 let cps_needed =
13121275 Var.Set. map (fun f -> try Subst. from_map liftings f with Not_found -> f) cps_needed
0 commit comments