On 25/01/2011 21:30, Roman Leshchinskiy wrote:
On 25/01/2011, at 20:57, Johan Tibell wrote:

On Tue, Jan 25, 2011 at 9:47 PM, Roman
Leshchinskiy<[email protected]>  wrote:
On 25/01/2011, at 20:26, Johan Tibell wrote: AFAIK, the GC never
runs during foreign calls. This, combine with the fact that GHC
can pass ByteArray# directly to FFI calls, should make memcpy
safe even for unpinned byte arrays. At least that's how I
understand it.

I thought it did, but I might very well be misstaken. Perhaps
Simon could explain. Simon, is the GC allowed to run during
"unsafe" foreign calls? If no, should we be relying on this
behavior?

My understanding is that the GC needs to "stop the world" before it
can run. That is, all capabilities (i.e., hardware threads) have to
synchronise, then the GC runs and then program execution resumes.
This synchronisation can only happen on allocation; in particular, it
can't happen inside a foreign call unless it calls back into Haskell.
Simon, is that correct?

Correct, and that is unlikely to change in the future.

Cheers,
        Simon


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

Reply via email to