summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-12-03 18:54:54 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-03 08:12:29 -0500
commitd8dc0f96237fe6fe7081c04727c7c2573477e5cb (patch)
treedbc4e8d25cf5a085e979df98bacad5999bf78aee /compiler/GHC/Tc
parenteea96042f1e8682605ae68db10f2bcdd7dab923e (diff)
downloadhaskell-d8dc0f96237fe6fe7081c04727c7c2573477e5cb.tar.gz
Fix array and cleanup conversion primops (#19026)
The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Deriv/Generate.hs43
1 files changed, 22 insertions, 21 deletions
diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs
index 0f374700dd..7b97d7bf22 100644
--- a/compiler/GHC/Tc/Deriv/Generate.hs
+++ b/compiler/GHC/Tc/Deriv/Generate.hs
@@ -1496,9 +1496,9 @@ gfoldl_RDR, gunfold_RDR, toConstr_RDR, dataTypeOf_RDR, mkConstrTag_RDR,
eqAddr_RDR , ltAddr_RDR , geAddr_RDR , gtAddr_RDR , leAddr_RDR ,
eqFloat_RDR , ltFloat_RDR , geFloat_RDR , gtFloat_RDR , leFloat_RDR ,
eqDouble_RDR, ltDouble_RDR, geDouble_RDR, gtDouble_RDR, leDouble_RDR,
- extendWord8_RDR, extendInt8_RDR,
- extendWord16_RDR, extendInt16_RDR,
- extendWord32_RDR, extendInt32_RDR
+ word8ToWord_RDR , int8ToInt_RDR ,
+ word16ToWord_RDR, int16ToInt_RDR,
+ word32ToWord_RDR, int32ToInt_RDR
:: RdrName
gfoldl_RDR = varQual_RDR gENERICS (fsLit "gfoldl")
gunfold_RDR = varQual_RDR gENERICS (fsLit "gunfold")
@@ -1588,14 +1588,15 @@ leDouble_RDR = varQual_RDR gHC_PRIM (fsLit "<=##")
gtDouble_RDR = varQual_RDR gHC_PRIM (fsLit ">##" )
geDouble_RDR = varQual_RDR gHC_PRIM (fsLit ">=##")
-extendWord8_RDR = varQual_RDR gHC_PRIM (fsLit "extendWord8#")
-extendInt8_RDR = varQual_RDR gHC_PRIM (fsLit "extendInt8#")
+word8ToWord_RDR = varQual_RDR gHC_PRIM (fsLit "word8ToWord#")
+int8ToInt_RDR = varQual_RDR gHC_PRIM (fsLit "int8ToInt#")
-extendWord16_RDR = varQual_RDR gHC_PRIM (fsLit "extendWord16#")
-extendInt16_RDR = varQual_RDR gHC_PRIM (fsLit "extendInt16#")
+word16ToWord_RDR = varQual_RDR gHC_PRIM (fsLit "word16ToWord#")
+int16ToInt_RDR = varQual_RDR gHC_PRIM (fsLit "int16ToInt#")
+
+word32ToWord_RDR = varQual_RDR gHC_PRIM (fsLit "word32ToWord#")
+int32ToInt_RDR = varQual_RDR gHC_PRIM (fsLit "int32ToInt#")
-extendWord32_RDR = varQual_RDR gHC_PRIM (fsLit "extendWord32#")
-extendInt32_RDR = varQual_RDR gHC_PRIM (fsLit "extendInt32#")
{-
************************************************************************
@@ -2364,22 +2365,22 @@ boxConTbl =
, (doublePrimTy, nlHsApp (nlHsVar $ getRdrName doubleDataCon))
, (int8PrimTy,
nlHsApp (nlHsVar $ getRdrName intDataCon)
- . nlHsApp (nlHsVar extendInt8_RDR))
+ . nlHsApp (nlHsVar int8ToInt_RDR))
, (word8PrimTy,
nlHsApp (nlHsVar $ getRdrName wordDataCon)
- . nlHsApp (nlHsVar extendWord8_RDR))
+ . nlHsApp (nlHsVar word8ToWord_RDR))
, (int16PrimTy,
nlHsApp (nlHsVar $ getRdrName intDataCon)
- . nlHsApp (nlHsVar extendInt16_RDR))
+ . nlHsApp (nlHsVar int16ToInt_RDR))
, (word16PrimTy,
nlHsApp (nlHsVar $ getRdrName wordDataCon)
- . nlHsApp (nlHsVar extendWord16_RDR))
+ . nlHsApp (nlHsVar word16ToWord_RDR))
, (int32PrimTy,
nlHsApp (nlHsVar $ getRdrName intDataCon)
- . nlHsApp (nlHsVar extendInt32_RDR))
+ . nlHsApp (nlHsVar int32ToInt_RDR))
, (word32PrimTy,
nlHsApp (nlHsVar $ getRdrName wordDataCon)
- . nlHsApp (nlHsVar extendWord32_RDR))
+ . nlHsApp (nlHsVar word32ToWord_RDR))
]
@@ -2401,12 +2402,12 @@ postfixModTbl
primConvTbl :: [(Type, String)]
primConvTbl =
- [ (int8PrimTy, "narrowInt8#")
- , (word8PrimTy, "narrowWord8#")
- , (int16PrimTy, "narrowInt16#")
- , (word16PrimTy, "narrowWord16#")
- , (int32PrimTy, "narrowInt32#")
- , (word32PrimTy, "narrowWord32#")
+ [ (int8PrimTy, "intToInt8#")
+ , (word8PrimTy, "wordToWord8#")
+ , (int16PrimTy, "intToInt16#")
+ , (word16PrimTy, "wordToWord16#")
+ , (int32PrimTy, "intToInt32#")
+ , (word32PrimTy, "wordToWord32#")
]
litConTbl :: [(Type, LHsExpr GhcPs -> LHsExpr GhcPs)]