the last bug

Stephen Weeks MLton@sourcelight.com
Tue, 3 Jul 2001 22:22:41 -0700


> I'm  confused  about  why  critical regions keep GCs from happening.  

They don't.

> I would
> think that critical regions are about stopping context switches.

Right.  But the way that a context switch happens is that the signal handler
runs, and the way the signal handler runs is that gcState.limit is set to
gcState.base so that at the next limit check, the GC is entered.  The GC then
notices that it wasn't entered to free up space, so it runs a signal handler.
The problem was that the GC used to check if the ML code was in a critical
section, and if so, not run the signal handler.  But that caused the loop.  But
the new invariant guarantees that we won't even enter the GC (for the purpose of
running a signal handler) if we are in a critical section.

Anyways, it works on the one program that was causing the seg fault earlier.
I'm making up a release right now and you can take a look and play around with
it.