[MLton] Re: Cross compile on ARM successful

Matthew Fluet fluet at tti-c.org
Wed Jun 27 07:21:00 PDT 2007

Ryan Newton wrote:
> I cross compiled the MLton runtime for ARM-linux and it's currently 
> running fine on some embedded devices.  It was a bit tough because I had 
> to manually go through and do the steps in "add-cross" (the embedded 
> machines don't have gcc!) and I had to apply a few hacks to the code, 
> but it works fine.

Wow, that's awesome!  Please send any patches that you needed to apply; 
it would be great to make it easier for others to target ARM-linux.

> By the way, are there any incantations that can turn off all 
> optimizations in the compiler and simply maximize compilation speed?  
> Maybe most people simply use SML/nj for prototyping, but I'm now 
> dependent on the MLton FFI...

There is an undocumented compiler option:
   -opt-passes {default|minimal}
That should turn off a fair number of the compiler optimizations.

However, it should be noted that for most programs, the time in gcc with 
the C codegen is where a lot of the time takes, and on ARM, you're stuck 
using the C codegen.  And, for small programs, the time to type-check 
the whole program (including the Basis Library) can be a significant 
portion of compile time.  Unfortunately, you can't skip either of these 
phases of the compiler.

If you turn off the compiler optimizations, you end up sending even more 
code to gcc, which in turn slows things down further.  We had an 
experimental bytecode codegen, which was supposed to mitigate this sort 
of behavior: a very fast codegen (that could be combined with turning 
off compiler optimizations for fast compile times), but a somewhat 
slower runtime.

Unfortunately, the bytecode codegen wasn't used very much (certainly, no 
one has ever had anything good or bad to say about it), and it is 
currently broken after merging in the x86-64 changes.

More information about the MLton mailing list