[MLton] cvs commit: critical sections during thread switch

Stephen Weeks MLton@mlton.org
Sun, 4 Apr 2004 18:13:45 -0700


> > We would then need to check when switching to a thread that the
> > stronger condition holds
> >
> > 	stackTop (s) <= endOfStack (s) - maxFrameSize + topFrameSize (s)
> >
> > for the thread being switched to.   We could check this just like we
> > check ensureFree (bytesNeeded) for the thread being switched to.
> 
> Now I'm totally lost.  Did you mean the strong invariant:
> 
> 	stackTop (s) <= stackLimit (s)
> 		===
> 	stackTop (s) + 2 * maxFrameSize <= endOfStack (s)

Whoops.  Yes, I meant to check the stronger condition

 	stackTop (s) <= endOfStack (s) - 2 * maxFrameSize + topFrameSize (s)

when switching to a thread.  After all, that's what's need to make the
mutator assumption 

 	stackTop (s) + 2 * maxFrameSize <= endOfStack (s)

true after the top frame is popped.