diff options
author | Bartosz Nitka <niteria@gmail.com> | 2017-12-26 12:54:27 +0000 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2018-01-04 14:03:54 +0000 |
commit | 6c34824434a67baa34e4ee2ddb753708eb61c5bc (patch) | |
tree | ca8c84cae978b3cc61ff096f74016d7aebfd1707 /compiler/codeGen | |
parent | 649e777211fe08432900093002547d7358f92d82 (diff) | |
download | haskell-6c34824434a67baa34e4ee2ddb753708eb61c5bc.tar.gz |
Cache the number of data cons in DataTyCon and SumTyCon
This is a follow-up after faf60e85 - Make tagForCon non-linear.
On the mailing list @simonpj suggested to solve the
linear behavior by caching the sizes.
Test Plan: ./validate
Reviewers: simonpj, simonmar, bgamari, austin
Reviewed By: simonpj
Subscribers: carter, goldfire, rwbarton, thomie, simonpj
Differential Revision: https://phabricator.haskell.org/D4131
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmClosure.hs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index 2501ec9cbd..1da1f707a2 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -361,18 +361,13 @@ type DynTag = Int -- The tag on a *pointer* isSmallFamily :: DynFlags -> Int -> Bool isSmallFamily dflags fam_size = fam_size <= mAX_PTR_TAG dflags --- | Faster version of isSmallFamily if you haven't computed the size yet. -isSmallFamilyTyCon :: DynFlags -> TyCon -> Bool -isSmallFamilyTyCon dflags tycon = - tyConFamilySizeAtMost tycon (mAX_PTR_TAG dflags) - tagForCon :: DynFlags -> DataCon -> DynTag tagForCon dflags con - | isSmallFamilyTyCon dflags tycon = con_tag - | otherwise = 1 + | isSmallFamily dflags fam_size = con_tag + | otherwise = 1 where con_tag = dataConTag con -- NB: 1-indexed - tycon = dataConTyCon con + fam_size = tyConFamilySize (dataConTyCon con) tagForArity :: DynFlags -> RepArity -> DynTag tagForArity dflags arity |