summaryrefslogtreecommitdiff
path: root/compiler/GHC/CoreToByteCode.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-13 19:17:24 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-15 21:58:27 -0400
commitae146b536445d20ef9983ff0e38ce1beaec6f321 (patch)
tree81eb8030843639c9c99b24065cc39e022195ab25 /compiler/GHC/CoreToByteCode.hs
parentcf10becdff4f8dba9bfa35326a1a338dccdd2b20 (diff)
downloadhaskell-ae146b536445d20ef9983ff0e38ce1beaec6f321.tar.gz
compiler/ByteCode: Make LocalLabel a newtype
Diffstat (limited to 'compiler/GHC/CoreToByteCode.hs')
-rw-r--r--compiler/GHC/CoreToByteCode.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/CoreToByteCode.hs b/compiler/GHC/CoreToByteCode.hs
index 284be0ce08..25503fa7c3 100644
--- a/compiler/GHC/CoreToByteCode.hs
+++ b/compiler/GHC/CoreToByteCode.hs
@@ -74,6 +74,7 @@ import GHC.Unit.Module
import Control.Exception
import Data.Array
+import Data.Coerce (coerce)
import Data.ByteString (ByteString)
import Data.Map (Map)
import Data.IntMap (IntMap)
@@ -2032,17 +2033,17 @@ recordFFIBc :: RemotePtr C_ffi_cif -> BcM ()
recordFFIBc a
= BcM $ \st -> return (st{ffis = FFIInfo a : ffis st}, ())
-getLabelBc :: BcM Word16
+getLabelBc :: BcM LocalLabel
getLabelBc
= BcM $ \st -> do let nl = nextlabel st
when (nl == maxBound) $
panic "getLabelBc: Ran out of labels"
- return (st{nextlabel = nl + 1}, nl)
+ return (st{nextlabel = nl + 1}, LocalLabel nl)
-getLabelsBc :: Word16 -> BcM [Word16]
+getLabelsBc :: Word16 -> BcM [LocalLabel]
getLabelsBc n
= BcM $ \st -> let ctr = nextlabel st
- in return (st{nextlabel = ctr+n}, [ctr .. ctr+n-1])
+ in return (st{nextlabel = ctr+n}, coerce [ctr .. ctr+n-1])
getCCArray :: BcM (Array BreakIndex (RemotePtr CostCentre))
getCCArray = BcM $ \st ->