[MLton] space safety for structures

Daniel C. Wang danwang@CS.Princeton.EDU
Fri, 02 Jul 2004 18:02:26 -0400


Stephen Weeks wrote:
{stuff deleted}
> What I'm wondering is how do separate-compilation systems deal with
> this problem, if they do, or do they just use a weaker notion of space
> safety than we do?  This question comes to mind because it seems like
> part of the reason that MLton is so slow in compiling HOL is that it
> is doing whole-program liveness analysis and completely decomposing
> structures, hence achieving a very aggressive notion of space safety.

Perhaps, I'm missing something, but this is my model of how seperate 
compilation works.

fun S () = let
  val l = <big object>
  val x = <small object>
in {x=x,l=l}
end

fun T () = let
  val _ = <long computation>
in () end

fun U Sx = let
  val _ = <use of S.x not S. l>
in () end


S, T, and U can all be compile seperately

fun main () =
  val {x=Sl,l=Sx} = S ()
  val _ = T ()
  val _ = U Sx
in ()
end

Here its clear that l is dead at runtime after we execute the effects 
associated with S. Anyway, this is my model about how it should work.