Skip to content

Data flow: do not enforce dependencies on mutually defined code IDs#551

Merged
mshinwell merged 2 commits intooxcaml:mainfrom
lthls:relaxed-data-flow-dependencies
Feb 23, 2022
Merged

Data flow: do not enforce dependencies on mutually defined code IDs#551
mshinwell merged 2 commits intooxcaml:mainfrom
lthls:relaxed-data-flow-dependencies

Conversation

@lthls
Copy link
Copy Markdown
Contributor

@lthls lthls commented Feb 23, 2022

This reflects the ability to make individual code bindings deleted during the rebuilding step.

This PR helps ensuring that code that has never gone through Simplify cannot end up in the final term.

Here is one example that was problematic (from the Queue module):

let rec aux c () = match c with
  | Nil -> Seq.Nil
  | Cons { content=x; next; } -> Seq.Cons (x, aux next)

Here simplifying the partial application of aux creates a new code ID (aux_n0_partial_n1), and a new set of closures that uses this code ID.
When the set of closures is simplified, a new version of the code ID is created (aux_n0_partial_n2), and we end up at toplevel with four lifted bindings: the closure symbol aux_n0, the specialised code ID aux_n0_n3, and both versions of the partial code stub. The only dependency to the old partial code ID is through the newer_version_of field of the new partial code ID, but because of that dependency Lifted_constant_state has to group all bindings together (otherwise we would get first the three other bindings together, then the old partial code ID binding; but this means that the new partial code ID is defined as the newer version of a code ID that isn't bound yet, and we don't want that to be allowed).

The property that all code in the result term must have gone through Simplify will become required in a subsequent PR for closure offsets.

This reflects the ability to make individual code bindings deleted during the rebuilding step.
@mshinwell mshinwell merged commit f5ad4ab into oxcaml:main Feb 23, 2022
mshinwell pushed a commit that referenced this pull request Mar 3, 2022
…551)

This reflects the ability to make individual code bindings deleted during the rebuilding step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flambda2 beta flambda2 Prerequisite for, or part of, flambda2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants