#5556: Support pin-changing on ByteArray#s
---------------------------------+------------------------------------------
Reporter: pumpkin | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.2.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by rl):
Thinking about this a bit more, I think I suggested to have separate types
for pinned and unpinned !ByteArrays, with `pin` and `unpin` as primitives.
I don't really see how `isPinned` would ever be useful except for checking
if an array is pinned and creating a pinned copy if it isn't. It makes
more sense to just provide a primop which does that. Incidentally, if we
had `ByteArray` and `PinnedByteArray` then the latter could just be a
`ForeignPtr` in compilers which don't support pinning. But GHC could be
cleverer, of course. We'd probably want `pin` and `unpin` to copy for very
small arrays and not copy for larger ones (but the threshold would be much
lower than what GHC uses for deciding whether to pin a !ByteArray by
default).
I'm not a big friend of `withPinned`. It seems horribly dangerous, even
more so that `withForeignPtr`.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5556#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs