Skip to content
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

Compiler: fix parallel renaming #1580

Merged
merged 2 commits into from
Mar 4, 2024
Merged
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 @@ -7,6 +7,7 @@
## Bug fixes
* Compiler: fix --enable=vardecl
* Lib: fix paragraph construction and coercion
* Compiler: fix parallel renaming (bug introduced in #1567)

# 5.7.0 (2024-02-16) - Lille

Expand Down
11 changes: 7 additions & 4 deletions compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,9 @@ let parallel_renaming back_edge params args continuation queue =
~f:(fun (queue, before, renaming, seen) (y, x) ->
let (((_, deps_x) as px), cx, locx), queue = access_queue_loc queue x in
let seen' = Code.Var.Set.add y seen in
if back_edge && not Code.Var.Set.(is_empty (inter seen deps_x))
if not Code.Var.Set.(is_empty (inter seen deps_x))
then
let () = assert back_edge in
let before, queue =
flush_queue
queue
Expand Down Expand Up @@ -1778,9 +1779,11 @@ and compile_argument_passing ctx queue (pc, args) back_edge continuation =
and compile_branch st queue ((pc, _) as cont) scope_stack ~fall_through : bool * _ =
let scope = List.assoc_opt pc scope_stack in
let back_edge =
match scope with
| Some (_l, _used, Loop) -> true
| None | Some _ -> false
List.exists
~f:(function
| pc', (_, _, Loop) when pc' = pc -> true
| _ -> false)
scope_stack
in
compile_argument_passing st.ctx queue cont back_edge (fun queue ->
if match fall_through with
Expand Down
Loading