summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-08-21 10:37:39 +0200
committerBen Gamari <ben@smart-cactus.org>2015-08-21 12:10:06 +0200
commit9e8562ae02701270e2c1dfcee3279d862dc5b7b6 (patch)
treebff25f744173f13cfc94615c51152d0ddd6cfa4c /compiler/codeGen
parent0d0e651d789a9a1b62139a210f4b013fa5453cfa (diff)
downloadhaskell-9e8562ae02701270e2c1dfcee3279d862dc5b7b6.tar.gz
Implement getSizeofMutableByteArrayOp primop
Now since ByteArrays are mutable we need to be more explicit about when the size is queried. Test Plan: Add testcase and validate Reviewers: goldfire, hvr, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1139 GHC Trac Issues: #9447
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmPrim.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index d201eaf20b..7188c05e70 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -327,6 +327,11 @@ emitPrimOp dflags [res] SizeofByteArrayOp [arg]
emitPrimOp dflags [res] SizeofMutableByteArrayOp [arg]
= emitPrimOp dflags [res] SizeofByteArrayOp [arg]
+-- #define getSizzeofMutableByteArrayzh(r,a) \
+-- r = ((StgArrWords *)(a))->bytes
+emitPrimOp dflags [res] GetSizeofMutableByteArrayOp [arg]
+ = emitAssign (CmmLocal res) (cmmLoadIndexW dflags arg (fixedHdrSizeW dflags) (bWord dflags))
+
-- #define touchzh(o) /* nothing */
emitPrimOp _ res@[] TouchOp args@[_arg]