summaryrefslogtreecommitdiff
path: root/includes/stg/MiscClosures.h
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-08-16 09:49:30 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2014-08-16 16:01:35 +0200
commit246436f13739593d2a211ceb830393338118ca4d (patch)
tree90630d9ece70e613ae9f9aa6ccd4b95fa69545bf /includes/stg/MiscClosures.h
parentd39c434a9518b7376857be88503055ecb7d0fe1f (diff)
downloadhaskell-246436f13739593d2a211ceb830393338118ca4d.tar.gz
Implement {resize,shrink}MutableByteArray# primops
The two new primops with the type-signatures resizeMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, MutableByteArray# s #) shrinkMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> State# s allow to resize MutableByteArray#s in-place (when possible), and are useful for algorithms where memory is temporarily over-allocated. The motivating use-case is for implementing integer backends, where the final target size of the result is either N or N+1, and only known after the operation has been performed. A future commit will implement a stateful variant of the `sizeofMutableByteArray#` operation (see #9447 for details), since now the size of a `MutableByteArray#` may change over its lifetime (i.e before it gets frozen or GCed). Test Plan: ./validate --slow Reviewers: ezyang, austin, simonmar Reviewed By: austin, simonmar Differential Revision: https://phabricator.haskell.org/D133
Diffstat (limited to 'includes/stg/MiscClosures.h')
-rw-r--r--includes/stg/MiscClosures.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index ee5a119aa1..d2b933deb0 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -347,6 +347,8 @@ RTS_FUN_DECL(stg_casArrayzh);
RTS_FUN_DECL(stg_newByteArrayzh);
RTS_FUN_DECL(stg_newPinnedByteArrayzh);
RTS_FUN_DECL(stg_newAlignedPinnedByteArrayzh);
+RTS_FUN_DECL(stg_shrinkMutableByteArrayzh);
+RTS_FUN_DECL(stg_resizzeMutableByteArrayzh);
RTS_FUN_DECL(stg_casIntArrayzh);
RTS_FUN_DECL(stg_newArrayzh);
RTS_FUN_DECL(stg_newArrayArrayzh);