[MLton] Shared libraries for MLton

Matthew Fluet fluet@cs.cornell.edu
Tue, 26 Jul 2005 12:20:51 -0400 (EDT)


> >>     o NOTE: The first garbage collection provokes a crash, the
> >>             error is probably to be found here.
> > 
> > That is unfortunate.
> 
> Indeed. Fixing it requires a bit more knowledge of the inner
> workings of MLton than I have at the moment, so I hope someone
> can point in the right direction.

As best I can make out, the problem is that the Thread_returnToC primitive 
does not leave the ML stack in a good state.  Apparently, we don't do as 
many assertions and don't make as many assumptions about the 
callFromCHandler thread as we do about the currentThread.  And, whatever 
bad state the callFromCHandler thread is in, it is fixed when transfering 
control to an _export-ed ML function before a GC occurs when the 
callFromCHandler thread as been switched to.