[MLton-commit] r6770

Matthew Fluet fluet at mlton.org
Tue Aug 19 15:16:50 PDT 2008


Controls to disable globalize and shrink optimizations during closure convert.
----------------------------------------------------------------------

U   mlton/trunk/mlton/closure-convert/closure-convert.fun
U   mlton/trunk/mlton/control/control-flags.sig
U   mlton/trunk/mlton/control/control-flags.sml
U   mlton/trunk/mlton/main/main.fun

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/closure-convert/closure-convert.fun
===================================================================
--- mlton/trunk/mlton/closure-convert/closure-convert.fun	2008-08-19 22:16:41 UTC (rev 6769)
+++ mlton/trunk/mlton/closure-convert/closure-convert.fun	2008-08-19 22:16:46 UTC (rev 6770)
@@ -405,10 +405,12 @@
                                in {frees = frees, recs = recs}
                                end}
       val _ =
-         Control.trace (Control.Pass, "globalize")
-         Globalize.globalize {program = program,
-                              lambdaFree = LambdaInfo.frees o lambdaInfo,
-                              varGlobal = #isGlobal o varInfo}
+         if !Control.closureConvertGlobalize
+            then Control.trace (Control.Pass, "globalize")
+                 Globalize.globalize {program = program,
+                                      lambdaFree = LambdaInfo.frees o lambdaInfo,
+                                      varGlobal = #isGlobal o varInfo}
+         else ()
       local
          fun removeGlobal v = Vector.keepAll (v, not o isGlobal)
          val _ =
@@ -737,7 +739,10 @@
              ; NONE)
             handle Yes ts => SOME ts
          end
-      val shrinkFunction = Ssa.shrinkFunction {globals = Vector.new0 ()}
+      val shrinkFunction =
+         if !Control.closureConvertShrink
+            then Ssa.shrinkFunction {globals = Vector.new0 ()}
+         else fn f => f
       fun addFunc (ac, {args, body, isMain, mayInline, name, returns}) =
          let
             val (start, blocks) =

Modified: mlton/trunk/mlton/control/control-flags.sig
===================================================================
--- mlton/trunk/mlton/control/control-flags.sig	2008-08-19 22:16:41 UTC (rev 6769)
+++ mlton/trunk/mlton/control/control-flags.sig	2008-08-19 22:16:46 UTC (rev 6770)
@@ -35,6 +35,9 @@
 
       val chunk: chunk ref
 
+      val closureConvertGlobalize: bool ref
+      val closureConvertShrink: bool ref
+
       structure Codegen:
          sig
             datatype t =

Modified: mlton/trunk/mlton/control/control-flags.sml
===================================================================
--- mlton/trunk/mlton/control/control-flags.sml	2008-08-19 22:16:41 UTC (rev 6769)
+++ mlton/trunk/mlton/control/control-flags.sml	2008-08-19 22:16:46 UTC (rev 6770)
@@ -54,6 +54,14 @@
                      default = Coalesce {limit = 4096},
                      toString = Chunk.toString}
 
+val closureConvertGlobalize = control {name = "closureConvertGlobalize",
+                                       default = true,
+                                       toString = Bool.toString}
+
+val closureConvertShrink = control {name = "closureConvertShrink",
+                                    default = true,
+                                    toString = Bool.toString}
+
 structure Codegen =
    struct
       datatype t =

Modified: mlton/trunk/mlton/main/main.fun
===================================================================
--- mlton/trunk/mlton/main/main.fun	2008-08-19 22:16:41 UTC (rev 6769)
+++ mlton/trunk/mlton/main/main.fun	2008-08-19 22:16:46 UTC (rev 6770)
@@ -246,6 +246,12 @@
                                                  end
                                             else usage ()
                                       end))),
+       (Expert, "closure-convert-globalize", " {true|false}",
+        "whether to globalize during closure conversion",
+        Bool (fn b => (closureConvertGlobalize := b))),
+       (Expert, "closure-convert-shrink", " {true|false}",
+        "whether to shrink during closure conversion",
+        Bool (fn b => (closureConvertShrink := b))),
        (Normal, "codegen",
         concat [" {",
                 String.concatWith




More information about the MLton-commit mailing list