On Tue, Jan 25, 2011 at 11:22 PM, Roman Leshchinskiy <[email protected]> 
wrote:
> On 25/01/2011, at 22:05, Daniel Peebles wrote:
>
>> Roman: I'm thinking that even in the absence of GC during foreign calls, it 
>> still seems worthwhile to provide the plain copying primitives, if only to 
>> save "user" code from having to know a) the structure of a (Byte)Array# and 
>> where the "data" lives vs. the metadata
>
> You don't have to know that. If you pass a ByteArray# to a foreign call, the 
> function you are calling gets a pointer to the actual data. That said, I'm 
> all for providing these operations somewhere in base, I just don't think they 
> have to be primops.

OK. So we can implement copyByteArray# by FFI importing memcpy and
using the automatic conversion of ByteArray#s into pointers in the
FFI. For MutableByteArray#s we need to use an unsafeCoerce# as well.

For Array# and MutableArray# we still need them to be primops.

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to