[commit: ghc] master: Document putDictionary determinism (46d2da0)

git at git.haskell.org git at git.haskell.org
Mon Jun 6 15:19:19 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/46d2da00ddb8756d966a5ba491b618367911de0f/ghc

>---------------------------------------------------------------

commit 46d2da00ddb8756d966a5ba491b618367911de0f
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Mon Jun 6 07:38:03 2016 -0700

    Document putDictionary determinism
    
    Summary: Like explained in the comment it's OK here.
    
    Test Plan: ./validate
    
    Reviewers: simonmar, austin, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2306
    
    GHC Trac Issues: #4012


>---------------------------------------------------------------

46d2da00ddb8756d966a5ba491b618367911de0f
 compiler/utils/Binary.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 8800d98..9f8d926 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -650,7 +650,9 @@ type Dictionary = Array Int FastString -- The dictionary
 putDictionary :: BinHandle -> Int -> UniqFM (Int,FastString) -> IO ()
 putDictionary bh sz dict = do
   put_ bh sz
-  mapM_ (putFS bh) (elems (array (0,sz-1) (eltsUFM dict)))
+  mapM_ (putFS bh) (elems (array (0,sz-1) (nonDetEltsUFM dict)))
+    -- It's OK to use nonDetEltsUFM here because the elements have indices
+    -- that array uses to create order
 
 getDictionary :: BinHandle -> IO Dictionary
 getDictionary bh = do



More information about the ghc-commits mailing list