diff options
author | Reid Barton <rwbarton@gmail.com> | 2017-01-06 11:23:37 -0500 |
---|---|---|
committer | Reid Barton <rwbarton@gmail.com> | 2017-01-06 11:23:37 -0500 |
commit | 83003dea51dabee93a27afad95d5aacf57dbd351 (patch) | |
tree | 159814ac5cb102d17e549cff29dcd50e06170d04 /compiler | |
parent | df723689c415573fa6c7d83663758154fa7dc46f (diff) | |
download | haskell-wip/rwbarton-large-tuple.tar.gz |
WIP: Move large tuples to a new module GHC.LargeTuplewip/rwbarton-large-tuple
Goal is to avoid reading its interface file for programs that don't use
large tuples, so we can add instances for large tuples without affecting
compiler performance in the common case.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/Constants.hs | 3 | ||||
-rw-r--r-- | compiler/prelude/PrelNames.hs | 3 | ||||
-rw-r--r-- | compiler/prelude/TysWiredIn.hs | 7 |
3 files changed, 10 insertions, 3 deletions
diff --git a/compiler/main/Constants.hs b/compiler/main/Constants.hs index 3dafbac996..e734f1d425 100644 --- a/compiler/main/Constants.hs +++ b/compiler/main/Constants.hs @@ -17,6 +17,9 @@ mAX_TUPLE_SIZE :: Int mAX_TUPLE_SIZE = 62 -- Should really match the number -- of decls in Data.Tuple +sMALL_TUPLE_SIZE :: Int +sMALL_TUPLE_SIZE = 15 -- XXX Document these properly + mAX_CTUPLE_SIZE :: Int -- Constraint tuples mAX_CTUPLE_SIZE = 62 -- Should match the number of decls in GHC.Classes diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 41c9e36304..ee1fe3c99b 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -440,7 +440,7 @@ pRELUDE = mkBaseModule_ pRELUDE_NAME gHC_PRIM, gHC_TYPES, gHC_GENERICS, gHC_MAGIC, gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING, gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST, - gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, + gHC_TUPLE, gHC_LARGETUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, dATA_MONOID, dATA_SEMIGROUP, gHC_CONC, gHC_IO, gHC_IO_Exception, gHC_ST, gHC_ARR, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL, @@ -466,6 +466,7 @@ gHC_NUM = mkBaseModule (fsLit "GHC.Num") gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type") gHC_LIST = mkBaseModule (fsLit "GHC.List") gHC_TUPLE = mkPrimModule (fsLit "GHC.Tuple") +gHC_LARGETUPLE = mkBaseModule (fsLit "GHC.LargeTuple") dATA_TUPLE = mkBaseModule (fsLit "Data.Tuple") dATA_EITHER = mkBaseModule (fsLit "Data.Either") dATA_STRING = mkBaseModule (fsLit "Data.String") diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 1aea16aabc..f3338740ac 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -137,7 +137,8 @@ import {-# SOURCE #-} KnownUniques -- others: import CoAxiom import Id -import Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE, mAX_SUM_SIZE ) +import Constants ( mAX_TUPLE_SIZE, sMALL_TUPLE_SIZE, + mAX_CTUPLE_SIZE, mAX_SUM_SIZE ) import Module ( Module ) import Type import DataCon @@ -830,7 +831,9 @@ mk_tuple Boxed arity = (tycon, tuple_con) tuple_con = pcDataCon dc_name dc_tvs dc_arg_tys tycon boxity = Boxed - modu = gHC_TUPLE + modu + | arity <= sMALL_TUPLE_SIZE = gHC_TUPLE + | otherwise = gHC_LARGETUPLE tc_name = mkWiredInName modu (mkTupleOcc tcName boxity arity) tc_uniq (ATyCon tycon) BuiltInSyntax dc_name = mkWiredInName modu (mkTupleOcc dataName boxity arity) dc_uniq |