[MLton-commit] r5003

Stephen Weeks sweeks at mlton.org
Thu Dec 28 14:26:36 PST 2006


Added internal control keepDefUse, which the elaborator uses to avoid
recording def-use information if it won't be used.  This saves some
memory during elaboration.


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

U   mlton/trunk/mlton/control/control-flags.sig
U   mlton/trunk/mlton/control/control-flags.sml
U   mlton/trunk/mlton/elaborate/elaborate-env.fun
U   mlton/trunk/mlton/main/main.fun

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

Modified: mlton/trunk/mlton/control/control-flags.sig
===================================================================
--- mlton/trunk/mlton/control/control-flags.sig	2006-12-28 20:29:24 UTC (rev 5002)
+++ mlton/trunk/mlton/control/control-flags.sig	2006-12-28 22:26:34 UTC (rev 5003)
@@ -152,9 +152,12 @@
 
       val inlineIntoMain: bool ref
 
-      (* The input file on the command line, minus path and extension *)
+      (* The input file on the command line, minus path and extension. *)
       val inputFile: File.t ref
 
+      (* Whether or not the elaborator keeps def-use information. *)
+      val keepDefUse: bool ref
+         
       (* Keep dot files for whatever SSA files are produced. *)
       val keepDot: bool ref
 

Modified: mlton/trunk/mlton/control/control-flags.sml
===================================================================
--- mlton/trunk/mlton/control/control-flags.sml	2006-12-28 20:29:24 UTC (rev 5002)
+++ mlton/trunk/mlton/control/control-flags.sml	2006-12-28 22:26:34 UTC (rev 5003)
@@ -706,6 +706,10 @@
                         default = false,
                         toString = Bool.toString}
 
+val keepDefUse = control {name = "keep def use",
+                          default = true,
+                          toString = Bool.toString}
+
 val keepDot = control {name = "keep dot",
                        default = false,
                        toString = Bool.toString}

Modified: mlton/trunk/mlton/elaborate/elaborate-env.fun
===================================================================
--- mlton/trunk/mlton/elaborate/elaborate-env.fun	2006-12-28 20:29:24 UTC (rev 5002)
+++ mlton/trunk/mlton/elaborate/elaborate-env.fun	2006-12-28 22:26:34 UTC (rev 5003)
@@ -1154,9 +1154,13 @@
       fun newUses (T {defUses, ...}, class, def) =
          let
             val u = Uses.new ()
-            val _ = List.push (defUses, {class = class,
-                                         def = def,
-                                         uses = u})
+            val _ =
+               if !Control.keepDefUse then
+                  List.push (defUses, {class = class,
+                                       def = def,
+                                       uses = u})
+               else
+                  ()
          in
             u
          end

Modified: mlton/trunk/mlton/main/main.fun
===================================================================
--- mlton/trunk/mlton/main/main.fun	2006-12-28 20:29:24 UTC (rev 5002)
+++ mlton/trunk/mlton/main/main.fun	2006-12-28 22:26:34 UTC (rev 5003)
@@ -675,10 +675,11 @@
          if !keepDot andalso List.isEmpty (!keepPasses)
             then keepSSA := true
          else ()
-      val keepDefUse = 
-         isSome (!showDefUse)
-         orelse (Control.Elaborate.enabled Control.Elaborate.warnUnused)
-         orelse (Control.Elaborate.default Control.Elaborate.warnUnused)
+      val () =
+         keepDefUse
+         := (isSome (!showDefUse)
+             orelse (Control.Elaborate.enabled Control.Elaborate.warnUnused)
+             orelse (Control.Elaborate.default Control.Elaborate.warnUnused))
       val warnMatch =
           (Control.Elaborate.enabled Control.Elaborate.nonexhaustiveMatch)
           orelse (Control.Elaborate.enabled Control.Elaborate.redundantMatch)
@@ -688,7 +689,7 @@
                   Control.Elaborate.DiagEIW.Ignore)
       val _ = elaborateOnly := (stop = Place.TypeCheck
                                 andalso not (warnMatch)
-                                andalso not (keepDefUse))
+                                andalso not (!keepDefUse))
       val _ =
          if !codegen = Bytecode andalso !profile <> ProfileNone
             then usage (concat ["bytecode doesn't support profiling\n"])




More information about the MLton-commit mailing list