[MLton] MLton calling convention and closure conversion

skaller skaller at users.sourceforge.net
Tue Jan 23 14:14:39 PST 2007


On Tue, 2007-01-23 at 13:26 -0800, Stephen Weeks wrote:
> > Felix puts function stack frames on the stack if it can prove that
> > on exit from the functions there can't be any pointers into the
> > stack frame:
> 
> That is necessary but not sufficient, at least for the notion of space
> safety that we aim for in MLton.  We would not find it acceptable to
> put a large object on the stack, call some function, use the object,
> then drop the final pointer to the object while remaining in the inner
> function, and not have the object be collectable.  In our opinion,
> that is a space leak.

I would agree, and there is no hard and fast rule I can think 
of to properly choose when to stack and when not.

> > The ridiculously small stacks provided by Linux are a good reason to
> > avoid the stack ;(
> 
> Linux's small stacks aren't relevant for MLton.  We use our own
> resizable heap-allocated stack.

Ah yes, I remember that now: it's one of the coolest features
of MLton! And why I eagerly await 64 bit version to see if
it can actually beat Felix fibre context switch times.
[Felix can do 500K/sec at least .. probably limited by 
calls to malloc and STL map used for GC root tracking
rather than the actual context switches]

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net



More information about the MLton mailing list