File tree Expand file tree Collapse file tree 11 files changed +153
-109
lines changed Expand file tree Collapse file tree 11 files changed +153
-109
lines changed Original file line number Diff line number Diff line change 1818* Compiler: fix js parser/printer wrt async functions (#1515 )
1919* Compiler: fix free variables pass wrt parameters' default value (#1521 )
2020* Compiler: fix free variables for classes
21+ * Compiler: fix internal invariant (continuation)
2122* Lib: Url.Current.set_fragment need not any urlencode (#1497 )
2223
2324# 5.4.0 (2023-07-06) - Lille
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ Compiler optimizations
77- constant hoisting (including functions, out of loops and functions)
88- inline also partially applied functions
99
10- - we should check stack compatibility when parsing:
11- when jumping somewhere, the stack should keep the same shape
12-
1310- cross-function optimizations
1411
1512- should we rebind variables from a deeper level ?
Original file line number Diff line number Diff line change @@ -687,7 +687,7 @@ let invariant { blocks; start; _ } =
687687 let defs = Var.ISet. empty () in
688688 let check_cont (cont , args ) =
689689 let b = Addr.Map. find cont blocks in
690- assert (List. length args > = List. length b.params)
690+ assert (List. length args = List. length b.params)
691691 in
692692 let define x =
693693 if check_defs
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ let rec filter_args st pl al =
130130 match pl, al with
131131 | x :: pl , y :: al ->
132132 if st.live.(Var. idx x) > 0 then y :: filter_args st pl al else filter_args st pl al
133- | [] , _ -> []
133+ | [] , [] -> []
134134 | _ -> assert false
135135
136136let filter_cont blocks st (pc , args ) =
@@ -184,7 +184,8 @@ let rec add_arg_dep defs params args =
184184 | x :: params , y :: args ->
185185 add_def defs x (Var y);
186186 add_arg_dep defs params args
187- | _ -> ()
187+ | [] , [] -> ()
188+ | _ -> assert false
188189
189190let add_cont_dep blocks defs (pc , args ) =
190191 match try Some (Addr.Map. find pc blocks) with Not_found -> None with
Original file line number Diff line number Diff line change @@ -926,6 +926,8 @@ let remove_empty_blocks ~live_vars (p : Code.program) : Code.program =
926926let f (p , live_vars ) =
927927 let t = Timer. make () in
928928 let p = remove_empty_blocks ~live_vars p in
929+ (* [remove_empty_blocks] can affect [Deadcode.variable_uses] *)
930+ let p, live_vars = Deadcode. f p in
929931 let flow_info = Global_flow. f ~fast: false p in
930932 let cps_needed = Partial_cps_analysis. f p flow_info in
931933 let p, cps_needed = rewrite_toplevel ~cps_needed p in
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ let rec arg_deps vars deps defs params args =
8181 add_dep deps x y;
8282 add_assign_def vars defs x y;
8383 arg_deps vars deps defs params args
84- | _ -> ()
84+ | [] , [] -> ()
85+ | _ -> assert false
8586
8687let cont_deps blocks vars deps defs (pc , args ) =
8788 let block = Addr.Map. find pc blocks in
Original file line number Diff line number Diff line change @@ -139,7 +139,8 @@ let rec arg_deps st ?ignore params args =
139139 | Some y' when Var. equal y y' -> ()
140140 | _ -> add_assign_def st x y);
141141 arg_deps st params args
142- | _ -> ()
142+ | [] , [] -> ()
143+ | _ -> assert false
143144
144145let cont_deps blocks st ?ignore (pc , args ) =
145146 let block = Addr.Map. find pc blocks in
You can’t perform that action at this time.
0 commit comments