summaryrefslogtreecommitdiff
path: root/rts/Linker.c
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 /rts/Linker.c
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 'rts/Linker.c')
-rw-r--r--rts/Linker.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 480dc2a967..a0ad90c6fe 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1194,6 +1194,8 @@ typedef struct _RtsSymbolVal {
SymI_HasProto(stg_casMutVarzh) \
SymI_HasProto(stg_newPinnedByteArrayzh) \
SymI_HasProto(stg_newAlignedPinnedByteArrayzh) \
+ SymI_HasProto(stg_shrinkMutableByteArrayzh) \
+ SymI_HasProto(stg_resizzeMutableByteArrayzh) \
SymI_HasProto(newSpark) \
SymI_HasProto(performGC) \
SymI_HasProto(performMajorGC) \