Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Lib: add `Performance` module (#2221)
* Put more values into global variables (#2211)
* Runtime: intial support for quickjs-ng
* Extract loops from toplevel function into helper functions (#2245)

## Bug fixes
* Compiler: fix reference unboxing (#2210)
Expand Down
9 changes: 9 additions & 0 deletions compiler/lib/code.ml
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,15 @@ let poptraps blocks pc =
in
loop blocks pc Addr.Set.empty 0 Addr.Set.empty |> fst

let map_branch_conts f branch =
match branch with
| Branch c -> Branch (f c)
| Cond (x, c1, c2) -> Cond (x, f c1, f c2)
| Switch (x, a) -> Switch (x, Array.map a ~f)
| Pushtrap (c1, x, c2) -> Pushtrap (f c1, x, f c2)
| Poptrap c -> Poptrap (f c)
| (Return _ | Raise _ | Stop) as b -> b

let fold_children blocks pc f accu =
let block = Addr.Map.find pc blocks in
match block.branch with
Expand Down
4 changes: 4 additions & 0 deletions compiler/lib/code.mli
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ val fold_closures_outermost_first :
outermost closures first. Unlike with {!fold_closures}, only the closures
reachable from [p.start] are considered. *)

val map_branch_conts : (cont -> cont) -> last -> last
(** Apply [f] to every continuation in [branch], leaving non-branching
terminators unchanged. *)

val fold_children : 'c fold_blocs

val fold_children_skip_try_body : 'c fold_blocs
Expand Down
1 change: 1 addition & 0 deletions compiler/lib/driver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ let optimize ~shapes ~profile ~keep_flow_data p =
| O2 -> o2
| O3 -> o3)
+> specialize_js_once_after
+> Hoist_loops.f
+> effects_and_exact_calls ~keep_flow_data ~deadcode_sentinel ~shapes profile
+> map_fst5
(match Config.target (), Config.effects () with
Expand Down
Loading
Loading