Commit affc0e0f authored by Schuyler Eldridge's avatar Schuyler Eldridge
Browse files

Add DependencyManager and PhaseManager



Adds the DependencyManager class which can be used to determine a
legal sequence of TransformLikes given their Dependency API
constraints. A DependencyManager determines an ordering that results
in some target TransformLikes being run (without invalidations) given
an initial state (some other set of TransformLikes).

Algorithmically, this works as follows:

1. A DAG of TransformLikes w/ invalidation edges is constructed (the
   "invalidate graph")

2. A DAG of TransformLikes w/ prerequisite and dependent edges is
   constructed (the "dependents graph")

3. A toplogical sort of the dependents graph, seeded with the reverse
   topological sort of the invalidate graph, gives an ordering of
   TransformLikes.

4. This ordering is examined, node by node, cleaning up any mismatches
   between TransformLikes by solving DependencyManager sub-problems.

As new graph nodes (which are classes) are found, these are lazily
constructed. Data structures are maintained that map from classes to
objects and back. All discovered classes will point to the same object.

Determinism is maintained internally using LinkedHashMap and
LinkedHashSet.

Other changes:
- Some methods that generate Graphviz for a DependencyManager are
  added.
- One concrete implementation of a DependencyManager is added for
  Phases called "PhaseManager".

Signed-off-by: default avatarSchuyler Eldridge <schuyler.eldridge@ibm.com>
parent c219be23
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment