summaryrefslogtreecommitdiff
path: root/compiler/codeGen/StgCmmPrim.hs
diff options
context:
space:
mode:
authorDaniel Peebles <pumpkingod@gmail.com>2011-01-26 05:15:54 +0000
committerDaniel Peebles <pumpkingod@gmail.com>2011-01-26 05:15:54 +0000
commit971160abf8ce633fed23eb603cf9e0fb08d1746d (patch)
tree8c5796e6108c2f61bab4af4c93ad4afb89d30ab8 /compiler/codeGen/StgCmmPrim.hs
parent98ad599b6f333d8d13fc9571e24fbb8587f12a94 (diff)
downloadhaskell-971160abf8ce633fed23eb603cf9e0fb08d1746d.tar.gz
Add sizeof(Mutable)Array# primitives
Diffstat (limited to 'compiler/codeGen/StgCmmPrim.hs')
-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 8f688f023c..35fe035ba5 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -287,6 +287,11 @@ emitPrimOp [r] ReadArrayOp [obj,ix] = doReadPtrArrayOp r obj ix
emitPrimOp [r] IndexArrayOp [obj,ix] = doReadPtrArrayOp r obj ix
emitPrimOp [] WriteArrayOp [obj,ix,v] = doWritePtrArrayOp obj ix v
+emitPrimOp [res] SizeofArrayOp [arg]
+ = emit $ mkAssign (CmmLocal res) (cmmLoadIndexW arg fixedHdrSize bWord)
+emitPrimOp [res] SizeofMutableArrayOp [arg]
+ = emitPrimOp [res] SizeofArrayOp [arg]
+
-- IndexXXXoffAddr
emitPrimOp res IndexOffAddrOp_Char args = doIndexOffAddrOp (Just mo_u_8ToWord) b8 res args