Repository : ssh://darcs.haskell.org//srv/darcs/packages/hoopl On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c6c6e93ed198a2a31820562d673b6af77aebb632 >--------------------------------------------------------------- commit c6c6e93ed198a2a31820562d673b6af77aebb632 Author: Simon Marlow <[email protected]> Date: Wed Jul 4 16:57:45 2012 +0100 Change the block representation (version bumped to 3.9.0.0) This patch implements the change to the block representation as agreed with Norman. I also took the liberty of doing a lot of refactoring and rearrangement to make the code organisation more logical. A summary of the API changes is below. Summary of refactorings: - Compiler.Hoopl.Block contains the Block datatype and all the operations on Blocks. It seemed like a good idea to collect all this stuff together in one place. - Compiler.Hoopl.Graph now has the operations on Graphs. - Compiler.Hoopl.Util and Compiler.Hoopl.GraphUtil are no more; their contents have been moved to other homes. (and a bit of duplicated functionality has been removed). - I removed the newtypes around Unique and Label, these are now just type synonyms. The newtype wrappers were costing some performance in GHC, because in cases like mapToList the newtype isn't optimised away. This change might be controversial. Feel free to complain. Other changes: - Optimisations to the Dataflow algorithms. I'm not actually using this implementation of Dataflow in GHC any more, instead I have a local copy specialised to our monad, for speed. Nevertheless I've put some of the optimisations I'm using in the GHC version into the generic library version too. Summary of API changes: ADDED - IsMap(mapInsertWith, mapFromListWith) - mapGraphBlocks (was previously called graphMapBlocks, and not exported) - mapBlock' (strict version of mapBlock) - New API for working with Blocks: -- ** Predicates on Blocks , isEmptyBlock -- ** Constructing blocks , emptyBlock, blockCons, blockSnoc , blockJoinHead, blockJoinTail, blockJoin, blockJoinAny , blockAppend -- ** Deconstructing blocks , firstNode, lastNode, endNodes , blockSplitHead, blockSplitTail, blockSplit, blockSplitAny -- ** Modifying blocks , replaceFirstNode, replaceLastNode -- ** Converting to and from lists , blockToList, blockFromList -- ** Maps and folds , mapBlock, mapBlock', mapBlock3' , foldBlockNodesF, foldBlockNodesF3 , foldBlockNodesB, foldBlockNodesB3 REMOVED - mapMaybeO, mapMaybeC (no need: we have Functor instances) - Block constructors are no longer exported (use the block API instead) - blockToNodeList, blockToNodeList', blockToNodeList'', blockToNodeList''' (use the block API instead) - tfFoldBlock, ScottBlock, scottFoldBlock, fbnf3, BlockResult(..), lookupBlock, (I don't know what any of these are for, if they're still important we could reinstate) CHANGED - Compiler.Hoopl.GHC is now Compiler.Hoopl.Internals and exports some more stuff. - Label is not a newtype; type Label = Unique - Unique is not a newtype: type Unique = Int (these newtypes were adding overhead) - blockMapNodes3 is now mapBlock3' - Lots of internal refactoring and tidying up FAQ | 20 -- LICENSE | 2 +- hoopl.cabal | 26 ++- src/Compiler/Hoopl.hs | 12 +- src/Compiler/Hoopl/Block.hs | 421 +++++++++++++++++++++++++++++++ src/Compiler/Hoopl/Collections.hs | 2 + src/Compiler/Hoopl/Combinators.hs | 3 +- src/Compiler/Hoopl/Dataflow.hs | 280 +++++++++++----------- src/Compiler/Hoopl/DataflowFold.hs | 5 +- src/Compiler/Hoopl/Graph.hs | 478 ++++++++++++++++++++++++++++-------- src/Compiler/Hoopl/GraphUtil.hs | 127 ---------- src/Compiler/Hoopl/Internals.hs | 18 ++ src/Compiler/Hoopl/Label.hs | 75 +----- src/Compiler/Hoopl/MkGraph.hs | 14 +- src/Compiler/Hoopl/OldDataflow.hs | 1 - src/Compiler/Hoopl/Pointed.hs | 2 +- src/Compiler/Hoopl/Show.hs | 12 +- src/Compiler/Hoopl/Unique.hs | 47 ++-- src/Compiler/Hoopl/Util.hs | 271 -------------------- src/Compiler/Hoopl/XUtil.hs | 358 +-------------------------- src/README | 35 --- testing/EvalMonad.hs | 8 +- testing/Main.hs | 5 +- testing/Test.hs | 2 + testing/tests/ExpectedOutput | 38 ++-- 25 files changed, 1063 insertions(+), 1199 deletions(-) Diff suppressed because of size. To see it, use: git show c6c6e93ed198a2a31820562d673b6af77aebb632 _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
