diff --git a/flow/FlowAlgorithms.hs b/flow/FlowAlgorithms.hs index 8430900..def709d 100644 --- a/flow/FlowAlgorithms.hs +++ b/flow/FlowAlgorithms.hs @@ -28,6 +28,13 @@ import Utils data GraphFuncs n e result = GF { -- (Node, Edge) -> current value for said node -> current aggregate effect for -- the current node -> new aggregate effect + -- The first parameter is the node from nodesToProcess that is connected to + -- the target node for which the value is being processed (the edge is the connection). + -- The second parameter is the current value for that node from nodesToProcess + -- (from last time it was processed). + -- The third parameter is Nothing for the first node from nodesToProcess that + -- is calculated, and Just with the previous answer otherwise. + -- -- If it is the first node to be processed for this iteration, it will be -- given Nothing, otherwise the result is fed back when processing the next -- node. The second parameter is from the last iteration. diff --git a/transformations/ImplicitMobility.hs b/transformations/ImplicitMobility.hs index 64bca84..7a1ea97 100644 --- a/transformations/ImplicitMobility.hs +++ b/transformations/ImplicitMobility.hs @@ -97,7 +97,8 @@ readAgainAfterFuncs g = GF let vs = nodeVars $ getNodeData ul readFromVars = readVars vs writtenToVars = writtenVars vs - addTo = fromMaybe prevVars maybeVars + -- prevVars is the value from the node after us. + addTo = fromMaybe Set.empty maybeVars `Set.union` prevVars in (readFromVars `Set.union` addTo) `Set.difference` Map.keysSet writtenToVars Nothing -> error "Node label not found in readAgainAfterFuncs" @@ -278,7 +279,8 @@ makeMoveCopyDecisions grOrig roots ns Left err -> dieP (getNodeMeta $ fromJust $ lab gr n) err Right mvs -> case calculateUsedInParallel gr roots n of Left err -> throwError err - Right mp -> foldM (processNode gr mvs mp) m $ Map.keys mvs + Right mp -> do debug $ show (grOrig, gr, mvs) + foldM (processNode gr mvs mp) m $ Map.keys mvs where gf = joinGraphFuncs (readAgainAfterFuncs gr) (usedBeforeOverwriteFuncs gr) @@ -338,7 +340,7 @@ implicitMobility -- We go from the terminator nodes, because we are performing backward -- data-flow analysis do decs <- makeMoveCopyDecisions g roots terms - --printMoveCopyDecisions decs + printMoveCopyDecisions decs effectMoveCopyDecisions g decs t) -- This leaves alone proc parameters for now