<huge_val.h> and more

Stephen Weeks sweeks@research.nj.nec.com
Fri, 26 Mar 1999 19:07:54 -0500


> Next i ran into some asm problems and gave up for now.  Maybe i should
> read the documentation.  Okay, i just looked at the web page under
> requirements and see MLton runs on X86 machines under Linux.
 
Yes.  Although MLton generates C, I think it would be quite a bit of
work to port to a new architecture.

> PPS - One of the reasons i down-loaded MLton is to study your comment
> 
>     The heap and stack are automatically resized. 

The heap and stack resizing in MLton is quite simple.  The heap
resizing is based on three parameters, minLive, maxLive, and
liveRatio.  The GC attempts to keep the ratio of the semispace size to
the amount of liveData at around liveRatio.  If the ratio is ever
smaller than minLive, it shrinks the heap, and if it is ever larger
than maxLive, then it grows the heap.  For details, see include/gc.h
and src/runtime/gc.c. 

The stack resizing is even simpler.  There is a stack limit check on
entry to each function.  If there is not enough room for the
function's stack frame, then the stack size is doubled.  The stack
size is halved if at any GC less than one quarter of the stack is
being used.  That's it.