summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-06-10 09:32:50 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-17 12:20:26 -0400
commit0a9b77b8b4313a9ffe7483cbc286d249fda59e75 (patch)
treeb2f463b84513f965b3bf2b505a443230d6fc0364
parent52f755aa203c55e44dce79c9ac1abc245977b000 (diff)
downloadhaskell-0a9b77b8b4313a9ffe7483cbc286d249fda59e75.tar.gz
Create {Int,Word}32Rep
This prepares the way for making Int32# and Word32# the actual size they claim to be. Updates binary submodule for (de)serializing the new runtime reps.
-rw-r--r--compiler/cmm/CmmUtils.hs4
-rw-r--r--compiler/codeGen/StgCmmArgRep.hs2
-rw-r--r--compiler/prelude/PrelNames.hs24
-rw-r--r--compiler/prelude/TysPrim.hs16
-rw-r--r--compiler/prelude/TysWiredIn.hs49
-rw-r--r--compiler/prelude/TysWiredIn.hs-boot11
-rw-r--r--compiler/simplStg/RepType.hs2
-rw-r--r--compiler/types/TyCon.hs10
-rw-r--r--compiler/utils/Binary.hs4
-rw-r--r--libraries/base/Data/Typeable/Internal.hs2
m---------libraries/binary0
-rw-r--r--libraries/ghc-prim/GHC/Types.hs2
12 files changed, 81 insertions, 45 deletions
diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs
index c6e647f75e..8b4947de69 100644
--- a/compiler/cmm/CmmUtils.hs
+++ b/compiler/cmm/CmmUtils.hs
@@ -106,6 +106,8 @@ primRepCmmType _ Int8Rep = b8
primRepCmmType _ Word8Rep = b8
primRepCmmType _ Int16Rep = b16
primRepCmmType _ Word16Rep = b16
+primRepCmmType _ Int32Rep = b32
+primRepCmmType _ Word32Rep = b32
primRepCmmType _ Int64Rep = b64
primRepCmmType _ Word64Rep = b64
primRepCmmType dflags AddrRep = bWord dflags
@@ -142,10 +144,12 @@ primRepForeignHint UnliftedRep = AddrHint
primRepForeignHint IntRep = SignedHint
primRepForeignHint Int8Rep = SignedHint
primRepForeignHint Int16Rep = SignedHint
+primRepForeignHint Int32Rep = SignedHint
primRepForeignHint Int64Rep = SignedHint
primRepForeignHint WordRep = NoHint
primRepForeignHint Word8Rep = NoHint
primRepForeignHint Word16Rep = NoHint
+primRepForeignHint Word32Rep = NoHint
primRepForeignHint Word64Rep = NoHint
primRepForeignHint AddrRep = AddrHint -- NB! AddrHint, but NonPtrArg
primRepForeignHint FloatRep = NoHint
diff --git a/compiler/codeGen/StgCmmArgRep.hs b/compiler/codeGen/StgCmmArgRep.hs
index 7d1962fd09..ef40fce464 100644
--- a/compiler/codeGen/StgCmmArgRep.hs
+++ b/compiler/codeGen/StgCmmArgRep.hs
@@ -74,6 +74,8 @@ toArgRep Int8Rep = N -- Gets widened to native word width for calls
toArgRep Word8Rep = N -- Gets widened to native word width for calls
toArgRep Int16Rep = N -- Gets widened to native word width for calls
toArgRep Word16Rep = N -- Gets widened to native word width for calls
+toArgRep Int32Rep = N -- Gets widened to native word width for calls
+toArgRep Word32Rep = N -- Gets widened to native word width for calls
toArgRep AddrRep = N
toArgRep Int64Rep = L
toArgRep Word64Rep = L
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
index 2ed73d269a..a889f70363 100644
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -2024,7 +2024,7 @@ sumRepDataConKey = mkPreludeDataConUnique 73
runtimeRepSimpleDataConKeys, unliftedSimpleRepDataConKeys, unliftedRepDataConKeys :: [Unique]
liftedRepDataConKey :: Unique
runtimeRepSimpleDataConKeys@(liftedRepDataConKey : unliftedSimpleRepDataConKeys)
- = map mkPreludeDataConUnique [74..86]
+ = map mkPreludeDataConUnique [74..88]
unliftedRepDataConKeys = vecRepDataConKey :
tupleRepDataConKey :
@@ -2034,29 +2034,29 @@ unliftedRepDataConKeys = vecRepDataConKey :
-- See Note [Wiring in RuntimeRep] in TysWiredIn
-- VecCount
vecCountDataConKeys :: [Unique]
-vecCountDataConKeys = map mkPreludeDataConUnique [87..92]
+vecCountDataConKeys = map mkPreludeDataConUnique [89..94]
-- See Note [Wiring in RuntimeRep] in TysWiredIn
-- VecElem
vecElemDataConKeys :: [Unique]
-vecElemDataConKeys = map mkPreludeDataConUnique [93..102]
+vecElemDataConKeys = map mkPreludeDataConUnique [95..104]
-- Typeable things
kindRepTyConAppDataConKey, kindRepVarDataConKey, kindRepAppDataConKey,
kindRepFunDataConKey, kindRepTYPEDataConKey,
kindRepTypeLitSDataConKey, kindRepTypeLitDDataConKey
:: Unique
-kindRepTyConAppDataConKey = mkPreludeDataConUnique 103
-kindRepVarDataConKey = mkPreludeDataConUnique 104
-kindRepAppDataConKey = mkPreludeDataConUnique 105
-kindRepFunDataConKey = mkPreludeDataConUnique 106
-kindRepTYPEDataConKey = mkPreludeDataConUnique 107
-kindRepTypeLitSDataConKey = mkPreludeDataConUnique 108
-kindRepTypeLitDDataConKey = mkPreludeDataConUnique 109
+kindRepTyConAppDataConKey = mkPreludeDataConUnique 105
+kindRepVarDataConKey = mkPreludeDataConUnique 106
+kindRepAppDataConKey = mkPreludeDataConUnique 107
+kindRepFunDataConKey = mkPreludeDataConUnique 108
+kindRepTYPEDataConKey = mkPreludeDataConUnique 109
+kindRepTypeLitSDataConKey = mkPreludeDataConUnique 110
+kindRepTypeLitDDataConKey = mkPreludeDataConUnique 111
typeLitSymbolDataConKey, typeLitNatDataConKey :: Unique
-typeLitSymbolDataConKey = mkPreludeDataConUnique 110
-typeLitNatDataConKey = mkPreludeDataConUnique 111
+typeLitSymbolDataConKey = mkPreludeDataConUnique 112
+typeLitNatDataConKey = mkPreludeDataConUnique 113
---------------- Template Haskell -------------------
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 01c496a310..27c7318805 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -93,9 +93,11 @@ import GhcPrelude
import {-# SOURCE #-} TysWiredIn
( runtimeRepTy, unboxedTupleKind, liftedTypeKind
, vecRepDataConTyCon, tupleRepDataConTyCon
- , liftedRepDataConTy, unliftedRepDataConTy, intRepDataConTy, int8RepDataConTy
- , int16RepDataConTy, word16RepDataConTy
- , wordRepDataConTy, int64RepDataConTy, word8RepDataConTy, word64RepDataConTy
+ , liftedRepDataConTy, unliftedRepDataConTy
+ , intRepDataConTy
+ , int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy
+ , wordRepDataConTy
+ , word16RepDataConTy, word8RepDataConTy, word32RepDataConTy, word64RepDataConTy
, addrRepDataConTy
, floatRepDataConTy, doubleRepDataConTy
, vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy
@@ -549,10 +551,12 @@ primRepToRuntimeRep rep = case rep of
IntRep -> intRepDataConTy
Int8Rep -> int8RepDataConTy
Int16Rep -> int16RepDataConTy
- WordRep -> wordRepDataConTy
+ Int32Rep -> int32RepDataConTy
Int64Rep -> int64RepDataConTy
+ WordRep -> wordRepDataConTy
Word8Rep -> word8RepDataConTy
Word16Rep -> word16RepDataConTy
+ Word32Rep -> word32RepDataConTy
Word64Rep -> word64RepDataConTy
AddrRep -> addrRepDataConTy
FloatRep -> floatRepDataConTy
@@ -607,7 +611,7 @@ int16PrimTyCon = pcPrimTyCon0 int16PrimTyConName Int16Rep
int32PrimTy :: Type
int32PrimTy = mkTyConTy int32PrimTyCon
int32PrimTyCon :: TyCon
-int32PrimTyCon = pcPrimTyCon0 int32PrimTyConName IntRep
+int32PrimTyCon = pcPrimTyCon0 int32PrimTyConName Int32Rep
int64PrimTy :: Type
int64PrimTy = mkTyConTy int64PrimTyCon
@@ -632,7 +636,7 @@ word16PrimTyCon = pcPrimTyCon0 word16PrimTyConName Word16Rep
word32PrimTy :: Type
word32PrimTy = mkTyConTy word32PrimTyCon
word32PrimTyCon :: TyCon
-word32PrimTyCon = pcPrimTyCon0 word32PrimTyConName WordRep
+word32PrimTyCon = pcPrimTyCon0 word32PrimTyConName Word32Rep
word64PrimTy :: Type
word64PrimTy = mkTyConTy word64PrimTyCon
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 5638b49f5d..d902fc4235 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -108,9 +108,11 @@ module TysWiredIn (
vecRepDataConTyCon, tupleRepDataConTyCon, sumRepDataConTyCon,
- liftedRepDataConTy, unliftedRepDataConTy, intRepDataConTy, int8RepDataConTy,
- int16RepDataConTy, word16RepDataConTy,
- wordRepDataConTy, int64RepDataConTy, word8RepDataConTy, word64RepDataConTy,
+ liftedRepDataConTy, unliftedRepDataConTy,
+ intRepDataConTy,
+ int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy,
+ wordRepDataConTy,
+ word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy,
addrRepDataConTy,
floatRepDataConTy, doubleRepDataConTy,
@@ -440,19 +442,13 @@ sumRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "SumRep") s
runtimeRepSimpleDataConNames :: [Name]
runtimeRepSimpleDataConNames
= zipWith3Lazy mk_special_dc_name
- [ fsLit "LiftedRep"
- , fsLit "UnliftedRep"
+ [ fsLit "LiftedRep", fsLit "UnliftedRep"
, fsLit "IntRep"
+ , fsLit "Int8Rep", fsLit "Int16Rep", fsLit "Int32Rep", fsLit "Int64Rep"
, fsLit "WordRep"
- , fsLit "Int8Rep"
- , fsLit "Int16Rep"
- , fsLit "Int64Rep"
- , fsLit "Word8Rep"
- , fsLit "Word16Rep"
- , fsLit "Word64Rep"
+ , fsLit "Word8Rep", fsLit "Word16Rep", fsLit "Word32Rep", fsLit "Word64Rep"
, fsLit "AddrRep"
- , fsLit "FloatRep"
- , fsLit "DoubleRep"
+ , fsLit "FloatRep", fsLit "DoubleRep"
]
runtimeRepSimpleDataConKeys
runtimeRepSimpleDataCons
@@ -1198,8 +1194,14 @@ runtimeRepSimpleDataCons :: [DataCon]
liftedRepDataCon :: DataCon
runtimeRepSimpleDataCons@(liftedRepDataCon : _)
= zipWithLazy mk_runtime_rep_dc
- [ LiftedRep, UnliftedRep, IntRep, WordRep, Int8Rep, Int16Rep, Int64Rep
- , Word8Rep, Word16Rep, Word64Rep, AddrRep, FloatRep, DoubleRep ]
+ [ LiftedRep, UnliftedRep
+ , IntRep
+ , Int8Rep, Int16Rep, Int32Rep, Int64Rep
+ , WordRep
+ , Word8Rep, Word16Rep, Word32Rep, Word64Rep
+ , AddrRep
+ , FloatRep, DoubleRep
+ ]
runtimeRepSimpleDataConNames
where
mk_runtime_rep_dc primrep name
@@ -1207,13 +1209,20 @@ runtimeRepSimpleDataCons@(liftedRepDataCon : _)
-- See Note [Wiring in RuntimeRep]
liftedRepDataConTy, unliftedRepDataConTy,
- intRepDataConTy, int8RepDataConTy, int16RepDataConTy, wordRepDataConTy, int64RepDataConTy,
- word8RepDataConTy, word16RepDataConTy, word64RepDataConTy, addrRepDataConTy,
+ intRepDataConTy,
+ int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy,
+ wordRepDataConTy,
+ word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy,
+ addrRepDataConTy,
floatRepDataConTy, doubleRepDataConTy :: Type
[liftedRepDataConTy, unliftedRepDataConTy,
- intRepDataConTy, wordRepDataConTy, int8RepDataConTy, int16RepDataConTy, int64RepDataConTy,
- word8RepDataConTy, word16RepDataConTy, word64RepDataConTy,
- addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy]
+ intRepDataConTy,
+ int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy,
+ wordRepDataConTy,
+ word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy,
+ addrRepDataConTy,
+ floatRepDataConTy, doubleRepDataConTy
+ ]
= map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons
vecCountTyCon :: TyCon
diff --git a/compiler/prelude/TysWiredIn.hs-boot b/compiler/prelude/TysWiredIn.hs-boot
index 4e8ebba223..0a09be172f 100644
--- a/compiler/prelude/TysWiredIn.hs-boot
+++ b/compiler/prelude/TysWiredIn.hs-boot
@@ -19,10 +19,13 @@ runtimeRepTy :: Type
liftedRepDataConTyCon, vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon
-liftedRepDataConTy, unliftedRepDataConTy, intRepDataConTy, int8RepDataConTy,
- int16RepDataConTy, word16RepDataConTy,
- wordRepDataConTy, int64RepDataConTy, word8RepDataConTy, word64RepDataConTy,
- addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy :: Type
+liftedRepDataConTy, unliftedRepDataConTy,
+ intRepDataConTy,
+ int8RepDataConTy, int16RepDataConTy, int32RepDataConTy, int64RepDataConTy,
+ wordRepDataConTy,
+ word8RepDataConTy, word16RepDataConTy, word32RepDataConTy, word64RepDataConTy,
+ addrRepDataConTy,
+ floatRepDataConTy, doubleRepDataConTy :: Type
vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy,
vec64DataConTy :: Type
diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs
index d93d716b4b..2fd5753cf8 100644
--- a/compiler/simplStg/RepType.hs
+++ b/compiler/simplStg/RepType.hs
@@ -260,10 +260,12 @@ primRepSlot UnliftedRep = PtrSlot
primRepSlot IntRep = WordSlot
primRepSlot Int8Rep = WordSlot
primRepSlot Int16Rep = WordSlot
+primRepSlot Int32Rep = WordSlot
primRepSlot Int64Rep = Word64Slot
primRepSlot WordRep = WordSlot
primRepSlot Word8Rep = WordSlot
primRepSlot Word16Rep = WordSlot
+primRepSlot Word32Rep = WordSlot
primRepSlot Word64Rep = Word64Slot
primRepSlot AddrRep = WordSlot
primRepSlot FloatRep = FloatSlot
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index 54a57cfc45..8068a5f666 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -1403,12 +1403,14 @@ data PrimRep
| UnliftedRep -- ^ Unlifted pointer
| Int8Rep -- ^ Signed, 8-bit value
| Int16Rep -- ^ Signed, 16-bit value
- | IntRep -- ^ Signed, word-sized value
- | WordRep -- ^ Unsigned, word-sized value
+ | Int32Rep -- ^ Signed, 32-bit value
| Int64Rep -- ^ Signed, 64 bit value (with 32-bit words only)
+ | IntRep -- ^ Signed, word-sized value
| Word8Rep -- ^ Unsigned, 8 bit value
- | Word16Rep -- ^ Unsigned, 16 bit value
+ | Word16Rep -- ^ Unsigned, 16 bit value
+ | Word32Rep -- ^ Unsigned, 32 bit value
| Word64Rep -- ^ Unsigned, 64 bit value (with 32-bit words only)
+ | WordRep -- ^ Unsigned, word-sized value
| AddrRep -- ^ A pointer, but /not/ to a Haskell value (use '(Un)liftedRep')
| FloatRep
| DoubleRep
@@ -1455,9 +1457,11 @@ primRepSizeB dflags IntRep = wORD_SIZE dflags
primRepSizeB dflags WordRep = wORD_SIZE dflags
primRepSizeB _ Int8Rep = 1
primRepSizeB _ Int16Rep = 2
+primRepSizeB _ Int32Rep = 4
primRepSizeB _ Int64Rep = wORD64_SIZE
primRepSizeB _ Word8Rep = 1
primRepSizeB _ Word16Rep = 2
+primRepSizeB _ Word32Rep = 4
primRepSizeB _ Word64Rep = wORD64_SIZE
primRepSizeB _ FloatRep = fLOAT_SIZE
primRepSizeB dflags DoubleRep = dOUBLE_SIZE dflags
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index 035b65ff23..5734528458 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -651,6 +651,8 @@ instance Binary RuntimeRep where
put_ bh Word8Rep = putByte bh 13
put_ bh Int16Rep = putByte bh 14
put_ bh Word16Rep = putByte bh 15
+ put_ bh Int32Rep = putByte bh 16
+ put_ bh Word32Rep = putByte bh 17
#endif
get bh = do
@@ -673,6 +675,8 @@ instance Binary RuntimeRep where
13 -> pure Word8Rep
14 -> pure Int16Rep
15 -> pure Word16Rep
+ 16 -> pure Int32Rep
+ 17 -> pure Word32Rep
#endif
_ -> fail "Binary.putRuntimeRep: invalid tag"
diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 1775871034..5c087272fa 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -666,10 +666,12 @@ runtimeRepTypeRep r =
IntRep -> rep @'IntRep
Int8Rep -> rep @'Int8Rep
Int16Rep -> rep @'Int16Rep
+ Int32Rep -> rep @'Int32Rep
Int64Rep -> rep @'Int64Rep
WordRep -> rep @'WordRep
Word8Rep -> rep @'Word8Rep
Word16Rep -> rep @'Word16Rep
+ Word32Rep -> rep @'Word32Rep
Word64Rep -> rep @'Word64Rep
AddrRep -> rep @'AddrRep
FloatRep -> rep @'FloatRep
diff --git a/libraries/binary b/libraries/binary
-Subproject fcd9d3cb2a942c54347d28bcb80a1b46d2d7d67
+Subproject e26b50021c9fdc3d82cd6ed2ee2edb819c7d048
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 7d4e62c381..2fc4669ac5 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -396,10 +396,12 @@ data RuntimeRep = VecRep VecCount VecElem -- ^ a SIMD vector type
| IntRep -- ^ signed, word-sized value
| Int8Rep -- ^ signed, 8-bit value
| Int16Rep -- ^ signed, 16-bit value
+ | Int32Rep -- ^ signed, 32-bit value
| Int64Rep -- ^ signed, 64-bit value (on 32-bit only)
| WordRep -- ^ unsigned, word-sized value
| Word8Rep -- ^ unsigned, 8-bit value
| Word16Rep -- ^ unsigned, 16-bit value
+ | Word32Rep -- ^ unsigned, 32-bit value
| Word64Rep -- ^ unsigned, 64-bit value (on 32-bit only)
| AddrRep -- ^ A pointer, but /not/ to a Haskell value
| FloatRep -- ^ a 32-bit floating point number