[MLton] More on Parallel Runtime

Henry Cejtin henry.cejtin at sbcglobal.net
Mon Oct 22 20:54:25 PDT 2007


I agree that it is tricky to place safe points at the correct frequency.
The only partial solution is, of course, to make the cost of the test as
cheap as possible so that they can be very frequent and still be cheap.
As an example, one could reserve a register for the bit, with the signal
handler/GC simply changing the saved register.  Then the test would simply
be to check a register for non-zero.  The branch prediction would be
basically perfect so that cost is really really small even if it is in
the middle of a very small very thight loop.

I don't remember what MLton does, but my point wasn't so much an argument
that this is a solved problem, but an observation that MLton already has
to put these kinds of tests in any way, so you can piggy back on them.
As an example, the test for signals having occured and for the heap being
out of space are arranged so that one test handles both.  (As you say,
this means you still need a test even in a non-allocating loop, but it does
make the common case cheaper.)



More information about the MLton mailing list