diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-06-14 03:28:30 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-06-23 07:53:12 -0700 |
commit | 35d1564cea2e611a4fecf24f09eff83f8a55af1c (patch) | |
tree | 5d46f89500052d356bf68e2befd6bf854550193a /compiler/main/GhcMake.hs | |
parent | 7fc20b02b20c97209b97f0e36d34a4ef40f537a4 (diff) | |
download | haskell-35d1564cea2e611a4fecf24f09eff83f8a55af1c.tar.gz |
Provide Uniquable version of SCC
We want to remove the `Ord Unique` instance because there's
no way to implement it in deterministic way and it's too
easy to use by accident.
We sometimes compute SCC for datatypes whose Ord instance
is implemented in terms of Unique. The Ord constraint on
SCC is just an artifact of some internal data structures.
We can have an alternative implementation with a data
structure that uses Uniquable instead.
This does exactly that and I'm pleased that I didn't have
to introduce any duplication to do that.
Test Plan:
./validate
I looked at performance tests and it's a tiny bit better.
Reviewers: bgamari, simonmar, ezyang, austin, goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2359
GHC Trac Issues: #4012
Diffstat (limited to 'compiler/main/GhcMake.hs')
-rw-r--r-- | compiler/main/GhcMake.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index c02ad7a671..93f1cd44bb 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -1479,7 +1479,7 @@ topSortModuleGraph drop_hs_boot_nodes summaries mb_root_mod -- the specified node. let root | Just node <- lookup_node HsSrcFile root_mod, graph `hasVertexG` node = node | otherwise = throwGhcException (ProgramError "module does not exist") - in graphFromEdgedVertices (seq root (reachableG graph root)) + in graphFromEdgedVerticesUniq (seq root (reachableG graph root)) type SummaryNode = (ModSummary, Int, [Int]) @@ -1491,7 +1491,8 @@ summaryNodeSummary (s, _, _) = s moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) -moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, lookup_node) +moduleGraphNodes drop_hs_boot_nodes summaries = + (graphFromEdgedVerticesUniq nodes, lookup_node) where numbered_summaries = zip summaries [1..] |