[MLton] More on Parallel Runtime

Florian Weimer fw at deneb.enyo.de
Tue Oct 23 13:53:45 PDT 2007


* Henry Cejtin:

> 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.

It's also possible to read from a special page once in a while, mark
that page PROT_NOTE once you want to reach a safepoint, and deal with
the SIGSEGV signal appropriately.  Of course, this is only a good idea
if safe points are very rare (but they really should be anyway).



More information about the MLton mailing list