changeset 2214:edd634b889d0

Add mono_inline.sml (which was left out of last commit).
author Ziv Scully <ziv@mit.edu>
date Tue, 14 Oct 2014 18:07:09 -0400
parents 365727ff68f4
children 639e62ca2530
files src/mono_inline.sml
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mono_inline.sml	Tue Oct 14 18:07:09 2014 -0400
@@ -0,0 +1,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