Skip to content

Fix invariant #2013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions compiler/lib/lambda_lifting.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,16 @@ let rec traverse var_depth (program, functions) pc depth limit =
program.blocks
(program, functions)

let f program =
let f p =
let t = Timer.make () in
let nv = Var.count () in
let var_depth = Array.make nv (-1) in
let program, functions =
let p, functions =
let threshold = Config.Param.lambda_lifting_threshold () in
let baseline = Config.Param.lambda_lifting_baseline () in
traverse var_depth (program, []) program.start 0 (baseline + threshold)
traverse var_depth (p, []) p.start 0 (baseline + threshold)
in
assert (List.is_empty functions);
if Debug.find "times" () then Format.eprintf " lambda lifting: %a@." Timer.print t;
program
Code.invariant p;
p
10 changes: 7 additions & 3 deletions compiler/lib/specialize_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ let f_once_before p =
let blocks =
Addr.Map.map (fun block -> { block with Code.body = loop [] block.body }) p.blocks
in
{ p with blocks }
let p = { p with blocks } in
Code.invariant p;
p

let rec args_equal xs ys =
match xs, ys with
Expand Down Expand Up @@ -485,11 +487,13 @@ let f_once_after p =
| i -> i
in
if first_class_primitives
then
then (
let blocks =
Addr.Map.map
(fun block -> { block with Code.body = List.map block.body ~f })
p.blocks
in
Deadcode.remove_unused_blocks { p with blocks }
let p = Deadcode.remove_unused_blocks { p with blocks } in
Code.invariant p;
p)
else p
2 changes: 1 addition & 1 deletion dune-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
(runtest_alias runtest-wasm))
(js_of_ocaml
;; enable for debugging
;; (flags (:standard --debug stats-debug --debug invariant))
(flags (:standard --debug stats-debug --debug invariant))
(runtest_alias runtest-js))))
Loading