aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mono_inline.sml
blob: d23419f33c00ffe2779e0fa9b1f3b3a32f352061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
structure MonoInline = struct

fun inlineFull file =
    let
        val oldInline = Settings.getMonoInline ()
        val oldFull = !MonoReduce.fullMode
    in
        (Settings.setMonoInline (case Int.maxInt of
                                     NONE => 1000000
                                   | SOME n => n);
         MonoReduce.fullMode := true;
         let
             val file = MonoReduce.reduce file
             val file = MonoOpt.optimize file
             val file = Fuse.fuse file
             val file = MonoOpt.optimize file
             val file = MonoShake.shake file
         in
             file
         end before
         (MonoReduce.fullMode := oldFull;
          Settings.setMonoInline oldInline))
        handle ex => (Settings.setMonoInline oldInline;
                      MonoReduce.fullMode := oldFull;
                      raise ex)
    end

end