diff options
author | Bartosz Nitka <niteria@gmail.com> | 2015-10-27 15:17:32 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-27 15:20:38 +0100 |
commit | 158d2a91581d82dc1690a858b474eaab3a02e43e (patch) | |
tree | 178aad1b3bcb80923d2376e784f3e87074dd5821 /ghc | |
parent | d1d8704cb3d003315177fad1394fce49f98fb1a2 (diff) | |
download | haskell-158d2a91581d82dc1690a858b474eaab3a02e43e.tar.gz |
Make it possible to have different UniqSupply strategies
To get reproducible/deterministic builds, the way that the Uniques are
assigned shouldn't matter. This allows to test for that.
It add 2 new flags:
* `-dinitial-unique`
* `-dunique-increment`
And by varying these you can get interesting effects:
* `-dinitial-unique=0 -dunique-increment 1` - current sequential
UniqSupply
* `-dinitial-unique=16777215 -dunique-increment -1` - UniqSupply that
generates in decreasing order
* `-dinitial-unique=1 -dunique-increment PRIME` - where PRIME big enough
to overflow often - nonsequential order
I haven't proven the usefullness of the last one yet and it's the reason
why we have to mask the bits with `0xFFFFFF` in `genSym`, so I can
remove it if it becomes contentious.
Test Plan: validate on harbormaster
Reviewers: simonmar, austin, ezyang, bgamari
Reviewed By: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1360
GHC Trac Issues: #4012
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/Main.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index fc6ab88960..647bbadcf9 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -44,6 +44,7 @@ import Outputable import SrcLoc import Util import Panic +import UniqSupply import MonadUtils ( liftIO ) -- Imports for --abi-hash @@ -236,6 +237,7 @@ main' postLoadMode dflags0 args flagWarnings = do printInfoForUser (dflags6 { pprCols = 200 }) (pkgQual dflags6) (pprModuleMap dflags6) + liftIO $ initUniqSupply (initialUnique dflags6) (uniqueIncrement dflags6) ---------------- Final sanity checking ----------- liftIO $ checkOptions postLoadMode dflags6 srcs objs |