[MLton] MLton calling convention and closure conversion
skaller
skaller at users.sourceforge.net
Tue Jan 23 13:07:15 PST 2007
On Tue, 2007-01-23 at 10:17 -0800, Stephen Weeks wrote:
> A possibly even bigger problem is space safety. How do you reclaim
> the space used by a variable-sized object allocated on a stack frame
> when the object is dead but the frame is live, and buried somewhere on
> the stack?
You can't and don't need to: the real question is how you
decide what to put on the stack rather than the heap.
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: this can be done
by checking the function return type for pointers or
closures. This might be harder in ML: Felix doesn't
allow functions to have side effects so the return value
is the only way (besides cheating with C hacks) a pointer
to the stack frame can escape. This doesn't stack all
stackable function stack frames, but it is enough to
allow Felix to trash other FPLs when presented with simple
recursive math functions -- provided the stack is big
enough of course. The ridiculously small stacks provided
by Linux are a good reason to avoid the stack ;(
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
More information about the MLton
mailing list