summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-03-13 19:42:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-17 05:05:10 -0400
commitcb61371e3260e07be724a04b72a935133f66b514 (patch)
tree456e4f3fa84ab7f8fa94ed66f717f6ea949899f8 /compiler
parent3f2291e47b8e00f1312c9be31484ceddd1289212 (diff)
downloadhaskell-cb61371e3260e07be724a04b72a935133f66b514.tar.gz
ghc-heap: Introduce closureSize
This function allows the user to compute the (non-transitive) size of a heap object in words. The "closure" in the name is admittedly confusing but we are stuck with this nomenclature at this point.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/prelude/primops.txt.pp7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 94de07f8e5..6a1be8a486 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -3208,6 +3208,13 @@ primop UnpackClosureOp "unpackClosure#" GenPrimOp
with
out_of_line = True
+primop ClosureSizeOp "closureSize#" GenPrimOp
+ a -> Int#
+ { {\tt closureSize\# closure} returns the size of the given closure in
+ machine words. }
+ with
+ out_of_line = True
+
primop GetApStackValOp "getApStackVal#" GenPrimOp
a -> Int# -> (# Int#, b #)
with