[MLton] compilation loop

Matthew Fluet fluet@cs.cornell.edu
Thu, 26 Feb 2004 08:13:33 -0500 (EST)


> When I try to compile Hamlet and Model-elimination with my flattener, they
> seem to idle in an infinite loop. Any ideas what I should be on the look
> out for?

Certainly run with -verbose 3, which will show you which pass is being run
when it stops.  After that, play around with Trace.trace:

   val trace: string * ('a -> Layout.t) * ('b -> Layout.t) ->
              ('a -> 'b) ->
              ('a -> 'b)

Use that to wrap some functions that you think might be problematic.
You'll need to build mlton via  make nj-mlton  because tracing depends on
Assert.debug, which is set to false when building via mlton.

Finally, try to compile hamlet with:

mlton -trace "Func1,Func2,Func3" hamlet.sml

where Func1, Func2, etc. are the strings you used to name the traced
functions.

You might also try Control.diagnostics:

      val diagnostics: ((Layout.t -> unit) -> unit) -> unit

With that, you can log info for a specific compiler pass.  Try compiling
with

mlton -keep-diag flatten hamlet.sml

That should produce hamlet.flatten.diag which has the info you've logged.
The logging uses the regular TextIO output, so it should be flushed fairly
regularly and you can inspect the file while the compile is going.