#8296: Patch: new primops for byte range copies ByteArray# <-> Addr#
-------------------------------------+------------------------------------
Reporter: duncan | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Changes (by thoughtpolice):
* status: patch => closed
* resolution: => fixed
Comment:
Merged.
{{{
commit f11289f65e77b9e3178b08f5ca4472762c77c42e
Author: Duncan Coutts
Date: Fri Sep 13 09:19:24 2013 +0100
New primops for byte range copies ByteArray# <-> Addr#
We have primops for copying ranges of bytes between ByteArray#s:
* ByteArray# -> MutableByteArray#
* MutableByteArray# -> MutableByteArray#
This extends it with three further cases:
* Addr# -> MutableByteArray#
* ByteArray# -> Addr#
* MutableByteArray# -> Addr#
One use case for these is copying between ForeignPtr-based
representations and in-heap arrays (like Text, UArray etc).
The implementation is essentially the same as for the existing
primops, and shares the memcpy stuff in the code generators.
Defficiencies / future directions: none of these primops (existing
or the new ones) let one take advantage of knowing that ByteArray#s
are word-aligned in memory. Though it is unclear that any of the
code generators would make use of this information unless the size
to copy is also known at compile time.
Signed-off-by: Austin Seipp
}}}
Duncan, I also had to fix the actual primops in
bb532682aa47c30dfd49039c5ab282352d38dac0, since they claimed to work over
`ST RealWorld`, but instead should work over `ST s`
{{{
commit bb532682aa47c30dfd49039c5ab282352d38dac0
Author: Austin Seipp
Date: Sun Sep 15 15:15:17 2013 -0500
Fix the type signatures of new copy primops.
They claimed to work over 'ST RealWorld', when instead they should be
parameterized in the state type. This fixes the cgrun070.
Signed-off-by: Austin Seipp
}}}
--
Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8296#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler