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 18
18
* Compiler: fix js parser/printer wrt async functions (#1515 )
19
19
* Compiler: fix free variables pass wrt parameters' default value (#1521 )
20
20
* Compiler: fix free variables for classes
21
+ * Compiler: fix internal invariant (continuation)
21
22
* Lib: Url.Current.set_fragment need not any urlencode (#1497 )
22
23
23
24
# 5.4.0 (2023-07-06) - Lille
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ Compiler optimizations
7
7
- constant hoisting (including functions, out of loops and functions)
8
8
- inline also partially applied functions
9
9
10
- - we should check stack compatibility when parsing:
11
- when jumping somewhere, the stack should keep the same shape
12
-
13
10
- cross-function optimizations
14
11
15
12
- 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; _ } =
687
687
let defs = Var.ISet. empty () in
688
688
let check_cont (cont , args ) =
689
689
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)
691
691
in
692
692
let define x =
693
693
if check_defs
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ let rec filter_args st pl al =
130
130
match pl, al with
131
131
| x :: pl , y :: al ->
132
132
if st.live.(Var. idx x) > 0 then y :: filter_args st pl al else filter_args st pl al
133
- | [] , _ -> []
133
+ | [] , [] -> []
134
134
| _ -> assert false
135
135
136
136
let filter_cont blocks st (pc , args ) =
@@ -184,7 +184,8 @@ let rec add_arg_dep defs params args =
184
184
| x :: params , y :: args ->
185
185
add_def defs x (Var y);
186
186
add_arg_dep defs params args
187
- | _ -> ()
187
+ | [] , [] -> ()
188
+ | _ -> assert false
188
189
189
190
let add_cont_dep blocks defs (pc , args ) =
190
191
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 =
926
926
let f (p , live_vars ) =
927
927
let t = Timer. make () in
928
928
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
929
931
let flow_info = Global_flow. f ~fast: false p in
930
932
let cps_needed = Partial_cps_analysis. f p flow_info in
931
933
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 =
81
81
add_dep deps x y;
82
82
add_assign_def vars defs x y;
83
83
arg_deps vars deps defs params args
84
- | _ -> ()
84
+ | [] , [] -> ()
85
+ | _ -> assert false
85
86
86
87
let cont_deps blocks vars deps defs (pc , args ) =
87
88
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 =
139
139
| Some y' when Var. equal y y' -> ()
140
140
| _ -> add_assign_def st x y);
141
141
arg_deps st params args
142
- | _ -> ()
142
+ | [] , [] -> ()
143
+ | _ -> assert false
143
144
144
145
let cont_deps blocks st ?ignore (pc , args ) =
145
146
let block = Addr.Map. find pc blocks in
You can’t perform that action at this time.
0 commit comments