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.

> b) the card marking stuff for Array#, both of which could easily change 
> between GHC versions.

Oh, I'm not arguing against the Array# versions at all.

Hmm, come to think of it, could they perhaps be written in Cmm (calling memcpy 
etc. internally) and imported using the (rather obscure) "prim" calling 
convention?

http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/ffi.html#ffi-prim

They wouldn't have to be true primops then, i.e., they wouldn't require 
extensions to the compiler itself. I don't know if this is feasible, though.

Roman



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

Reply via email to