another limit check bug

Stephen Weeks MLton@sourcelight.com
Mon, 26 Nov 2001 10:12:52 -0800


> But if we are in C code then a context-switch isn't going to happen.
> Is this just a matter of changing the check
> 	frontier + (b) > gcState.limit
> to
> 	frontier + bytes > gcState.stackLimi

I don't think so.

Ignoring the code, every thread that is paused will need to check for
some amount of free space when it resumes.  That amount can either be
embedded in the code or in the thread data structure.  If the amount
is fixed, then it can be embedded in the code.  However, if the amount
is variable, then it must be in the data structure, since two threads
can share the same code, right?

As to putting the while loop in GC_gc -- that is a separable issue,
and a bad idea I think.  Won't it cause problems by leaving around a C
stack frame for every thread?  We don't want that.  I propose to leave
the loop in the code, but have the limit check set and refer to a
per-thread data structure.  Then, the only runtime change is to add
another field to GC_thread.