Skip to content

Commit

Permalink
Remove some dead code and debug printing
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierNicole committed Apr 28, 2023
1 parent 1c76aeb commit 49e7c91
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions compiler/lib/effects.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1124,40 +1124,6 @@ let cps_transform ~lifter_functions ~live_vars ~flow_info ~cps_needed p =
new_blocks
}
in
let p =
match Hashtbl.find_opt closure_info p.start with
| None -> p
| Some (cps_params, cps_cont) ->
(* Call [caml_trampoline_cps] to set up the execution context. *)
let new_start = p.free_pc in
let blocks =
let main = Var.fresh () in
let args = Var.fresh () in
let res = Var.fresh () in
Addr.Map.add
new_start
{ params = []
; body =
[ Let (main, Closure (cps_params, cps_cont)), noloc
; Let (args, Prim (Extern "%js_array", [])), noloc
; ( Let (res, Prim (Extern "caml_trampoline_cps", [ Pv main; Pv args ]))
, noloc )
]
; branch = Return res, noloc
}
p.blocks
in
(* Remove the direct-style toplevel code as it is now unreachable *)
let blocks =
Code.traverse
{ fold = Code.fold_children }
(fun pc blocks -> Addr.Map.remove pc blocks)
p.start
blocks
blocks
in
{ start = new_start; blocks; free_pc = new_start + 1 }
in
let p =
(* Initialize the global fiber stack and define a global identity function,
needed to translate [%resume] *)
Expand Down Expand Up @@ -1304,9 +1270,6 @@ let f (p, live_vars) =
let p = remove_empty_blocks ~live_vars p in
let flow_info = Global_flow.f ~fast:false p in
let cps_needed = Partial_cps_analysis.f p flow_info in
debug_print "@[<v>cps_needed = @[<hov 2>";
Var.Set.iter (fun v -> debug_print "%s,@ " (Var.to_string v)) cps_needed;
debug_print "@]@,@]";
let p, lifter_functions, liftings = Lambda_lifting_simple.f ~to_lift:cps_needed p in
let cps_needed =
Var.Set.map (fun f -> try Subst.from_map liftings f with Not_found -> f) cps_needed
Expand Down

0 comments on commit 49e7c91

Please sign in to comment.