another limit check bug

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


> > 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 don't get this.  There aren't C stack frames per MLton thread.  I'm
> simply proposing adding:
> 
> 	s->currentThread->bytesNeeded = bytesRequested;
> 	do {
> ...
> 	} while (s->frontier + s->currentThread->bytesNeeded > s->limit);
> 
> to GC_gc, where ... is the entire body of what's currently in GC_gc;
> (including enter(s) and leave(s), which takes care of resetting limit when
> handlers are pending).  We'll enter C via a C call to GC_gc, and we'll
> leave C when GC_gc returns.

Ah, I understand.  I was worried about the C stack frame for the call
to GC_gc.  But I see that there will just be one, even when switching
threads.  In the new world, we won't trampoline from one limit check
loop to another when switching threads.  Sounds good.