summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm/Prim.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-03-15 16:03:21 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-22 09:22:29 -0400
commite82d32d6654ef708d580e3ed6f0cc1130daa6cb9 (patch)
tree8407e051d52b4676be3a8b57d3e44b6333fbcde6 /compiler/GHC/StgToCmm/Prim.hs
parent2907949c169a0764676da8e5a4516c705f36932a (diff)
downloadhaskell-e82d32d6654ef708d580e3ed6f0cc1130daa6cb9.tar.gz
compiler: Introduce mutableByteArrayContents# primop
As noted in #19540, a number of users within and outside of GHC rely on unsafeCoerceUnlifted to work around the fact that this was missing
Diffstat (limited to 'compiler/GHC/StgToCmm/Prim.hs')
-rw-r--r--compiler/GHC/StgToCmm/Prim.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs
index b10462a10b..484863d37a 100644
--- a/compiler/GHC/StgToCmm/Prim.hs
+++ b/compiler/GHC/StgToCmm/Prim.hs
@@ -335,6 +335,10 @@ emitPrimOp dflags primop = case primop of
ByteArrayContents_Char -> \[arg] -> opIntoRegs $ \[res] ->
emitAssign (CmmLocal res) (cmmOffsetB platform arg (arrWordsHdrSize profile))
+-- #define mutableByteArrayContentszh(r,a) r = BYTE_ARR_CTS(a)
+ MutableByteArrayContents_Char -> \[arg] -> opIntoRegs $ \[res] ->
+ emitAssign (CmmLocal res) (cmmOffsetB platform arg (arrWordsHdrSize profile))
+
-- #define stableNameToIntzh(r,s) (r = ((StgStableName *)s)->sn)
StableNameToIntOp -> \[arg] -> opIntoRegs $ \[res] ->
emitAssign (CmmLocal res) (cmmLoadIndexW platform arg (fixedHdrSizeW profile) (bWord platform))