Improved the commenting on the flow algorithm stuff and fixed a bug in the implicit mobility

This commit is contained in:
Neil Brown 2009-08-19 17:00:12 +00:00
parent 728fa5f328
commit c0e2e9c401
2 changed files with 12 additions and 3 deletions

View File

@ -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.

View File

@ -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