[MLton] globals and GC

Jake Donham jdonham at cs.cmu.edu
Sun Mar 4 17:04:44 PST 2007


Hi,

I'm trying to understand how globals work in MLton. Do I understand
correctly that mutable data may be allocated into globals? I see that
in backend.fun, constants are put in globals, and also all the
variables of the main function--looks like earlier passes hoist global
refs into the main function. Is that right?

Why are the constants reallocated and copied into the heap on startup?
Would it not be possible to keep them in a separate area which is not
traced?

This is another area where special treatment is needed for the
realtime bound in the Cheng-Blelloch collector--the global roots have
to be swapped in bounded time to shut down the collector. Their
solution is to keep two sets of globals and swap a base pointer.

Thanks,

Jake



More information about the MLton mailing list