Re: Finalizers etcetera
On Wed, Oct 09, 2002 at 02:02:35PM +0100, Alastair Reid wrote: So are you saying that if a GC were to occur in the middle of a C-implemented Hugs primitive, it could be bad news? It's possible. It's something we never had to consider when writing the Hugs primitives so we never took care to protect against it. I thought you did. Every time you allocate a cell in Hugs, it's a potential GC, and Hugs is very careful that any heap pointers in use will be visible to the garbage collector. What hasn't been required is for the various data structures to be in a consistent state at that point, and Haskell finalizers might trip over those if run after GC. SimonM's patch ran them at a different point, though. ___ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi
Re: Finalizers etcetera
What hasn't been required is for the various data structures to be in a consistent state at that point, and Haskell finalizers might trip over those if run after GC. SimonM's patch ran them at a different point, though. It calls them in eval doesn't it? eval is called by nearly every primitive in Hugs. Most calls are benign since the calls are at the start of the primop before any data structures have been fiddled with. It's even possible that none have any problems. All I'm saying that we will have to look over the code before we know if there is a problem (while others are claiming that there couldn't possibly be a problem). What is definitely a problem is the issue of atomicity of user-written Haskell finalizers. -- Alastair ___ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi
Re: Finalizers etcetera
Simon Peyton-Jones [EMAIL PROTECTED] writes: You didn't respond to my proposal, perhaps because it didn't seem like one (I've changed a few words). I think I agree with your proposal as far as nhc98 is concerned. Regards, Malcolm ___ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi
Re: Finalizers etcetera
On Wed, Oct 09, 2002 at 04:09:07PM +0100, Alastair Reid wrote: What hasn't been required is for the various data structures to be in a consistent state at that point, and Haskell finalizers might trip over those if run after GC. SimonM's patch ran them at a different point, though. It calls them in eval doesn't it? eval is called by nearly every primitive in Hugs. Most calls are benign since the calls are at the start of the primop before any data structures have been fiddled with. It's even possible that none have any problems. All I'm saying that we will have to look over the code before we know if there is a problem (while others are claiming that there couldn't possibly be a problem). OK, so the problem is to find a place in Hugs that is passed frequently enough, but at which the internal data structures are consistent. How about the start of primPass (called to enter the continuation argument of = in the IO monad)? Seems like a safe place to do an IO action. (I don't know why the IO furniture is primitive, but since it's there ...) The top-level loop is presumably another safe place. ___ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi