[MLton] Re: Cross compile on ARM successful

Ryan Newton rrnewton at gmail.com
Wed Jun 27 07:38:24 PDT 2007


> 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.

Yeah, the whole-program compiler with which I am targeting MLton also  
spends most of its time type checking.  (And in metaprogram  
evaluation.)  I just thought that MLton, with its copious  
optimizations, might be otherwise.

I had noted that the high constant overhead in compile time  
(compiling an empty program).  I assume this is because the compiler  
needs to do significant work on the 8K line basis library?  (It does  
not get eliminated as dead code until late in 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.

Yes, I notice that without optimization it spends much more time, not  
in gcc, but in "x86 codegen".  (-verbose 1 traces for a small program  
attached below.)  But then doing "-codegen c" becomes much *much*  
slower too.

> 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.

Yes, I had noticed that simply doing "-codegen bytecode" didn't work...

-Ryan

=============================================================
MLton MLTONVERSION (built Fri Jun 22 00:52:06 2007 on  
RyanMacbook17.local)
MLton starting
    Compile SML starting
       pre codegen starting
       pre codegen finished in 2.91 + 1.05 (27% GC)
       x86 code gen starting
       x86 code gen finished in 0.36 + 0.12 (25% GC)
    Compile SML finished in 3.27 + 1.17 (26% GC)
    Compile and Assemble starting
       gcc -std=gnu99 -c -I/usr/local/lib/mlton/self/include \
           -I/usr/local/lib/mlton/include -O1 -fno-strict-aliasing \
           -fomit-frame-pointer -w -I/opt/local/include -I/sw/include \
           -fno-strength-reduce -fschedule-insns -fschedule-insns2 \
           -malign-functions=5 -malign-jumps=2 -malign-loops=2 -o \
           /tmp/fileiySPPH.o /tmp/filehWLp27.1.c
       gcc -c -o /tmp/filejHKVSy.o /tmp/fileI7bTJD.0.S
       gcc -std=gnu99 -c -I/usr/local/lib/mlton/self/include \
           -I/usr/local/lib/mlton/include -O1 -fno-strict-aliasing \
           -fomit-frame-pointer -w -I/opt/local/include -I/sw/include \
           -fno-strength-reduce -fschedule-insns -fschedule-insns2 \
           -malign-functions=5 -malign-jumps=2 -malign-loops=2 -o \
           /tmp/fileh3vR8Q.o \
           /Users/newton/wavescript/src/generic/passes/mlton_bkend/ 
fftw.c
    Compile and Assemble finished in 0.30 + 0.00 (0% GC)
    Link starting
       gcc -o query.exe /tmp/fileiySPPH.o /tmp/filejHKVSy.o /tmp/ 
fileh3vR8Q.o \
           -L/usr/local/lib/mlton/self -lmlton -lgdtoa -lm -lgmp -L/ 
sw/lib \
           -lfftw3f
    Link finished in 0.12 + 0.00 (0% GC)
MLton finished in 3.70 + 1.17 (24% GC)


WITH -OPT-PASSES MINIMAL
=============================================================
MLton MLTONVERSION (built Fri Jun 22 00:52:06 2007 on  
RyanMacbook17.local)
MLton starting
    Compile SML starting
       pre codegen starting
       pre codegen finished in 2.94 + 1.16 (28% GC)
       x86 code gen starting
       x86 code gen finished in 2.00 + 0.42 (17% GC)
    Compile SML finished in 4.94 + 1.59 (24% GC)
    Compile and Assemble starting
       gcc -std=gnu99 -c -I/usr/local/lib/mlton/self/include \
           -I/usr/local/lib/mlton/include -O1 -fno-strict-aliasing \
           -fomit-frame-pointer -w -I/opt/local/include -I/sw/include \
           -fno-strength-reduce -fschedule-insns -fschedule-insns2 \
           -malign-functions=5 -malign-jumps=2 -malign-loops=2 -o \
           /tmp/fileJVJrjo.o /tmp/fileBeZWKC.5.c
       gcc -c -o /tmp/fileI65OkC.o /tmp/filePuiMf9.4.S
       gcc -c -o /tmp/fileGJ5RtW.o /tmp/filed3hdum.3.S
       gcc -c -o /tmp/filecYOHlF.o /tmp/file2gBhtO.2.S
       gcc -c -o /tmp/fileVVVPiq.o /tmp/filewauVHW.1.S
       gcc -c -o /tmp/file2cRuVO.o /tmp/file6Nt5vV.0.S
       gcc -std=gnu99 -c -I/usr/local/lib/mlton/self/include \
           -I/usr/local/lib/mlton/include -O1 -fno-strict-aliasing \
           -fomit-frame-pointer -w -I/opt/local/include -I/sw/include \
           -fno-strength-reduce -fschedule-insns -fschedule-insns2 \
           -malign-functions=5 -malign-jumps=2 -malign-loops=2 -o \
           /tmp/filewBdQ65.o \
           /Users/newton/wavescript/src/generic/passes/mlton_bkend/ 
fftw.c
    Compile and Assemble finished in 0.61 + 0.00 (0% GC)
    Link starting
       gcc -o query.exe /tmp/fileJVJrjo.o /tmp/fileI65OkC.o /tmp/ 
fileGJ5RtW.o \
           /tmp/filecYOHlF.o /tmp/fileVVVPiq.o /tmp/file2cRuVO.o \
           /tmp/filewBdQ65.o -L/usr/local/lib/mlton/self -lmlton - 
lgdtoa -lm \
           -lgmp -L/sw/lib -lfftw3f
    Link finished in 0.13 + 0.00 (0% GC)
MLton finished in 5.71 + 1.59 (22% GC)









More information about the MLton mailing list