[MLton-commit] r6771

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


Share ApplyResult.Bool objects in primApply.
----------------------------------------------------------------------

U   mlton/trunk/mlton/atoms/prim.fun

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

Modified: mlton/trunk/mlton/atoms/prim.fun
===================================================================
--- mlton/trunk/mlton/atoms/prim.fun	2008-08-19 22:16:46 UTC (rev 6770)
+++ mlton/trunk/mlton/atoms/prim.fun	2008-08-19 22:16:57 UTC (rev 6771)
@@ -1458,6 +1458,7 @@
 structure ApplyResult =
    struct
       type 'a prim = 'a t
+      val layoutPrim = layout
 
       datatype ('a, 'b) t =
          Apply of 'a prim * 'b list
@@ -1467,11 +1468,6 @@
        | Unknown
        | Var of 'b
 
-      val truee = Bool true
-      val falsee = Bool false
-
-      val layoutPrim = layout
-
       fun layout layoutX ar =
          let
             open Layout
@@ -1520,6 +1516,8 @@
       datatype z = datatype t
       datatype z = datatype Const.t
       val bool = ApplyResult.Bool
+      val f = bool false
+      val t = bool true
       fun seqIndexConst i =
          ApplyResult.Const
          (Const.word (WordX.fromIntInf (i, WordSize.seqIndex ())))
@@ -1543,7 +1541,6 @@
       val null = ApplyResult.Const Const.null
       fun word (w: WordX.t): ('a, 'b) ApplyResult.t =
          ApplyResult.Const (Const.word w)
-      val f = ApplyResult.falsee
       fun iio (f, c1, c2) = intInf (f (c1, c2))
       fun wordS (f: WordX.t * WordX.t * {signed: bool} -> WordX.t,
                  (_: WordSize.t, sg),
@@ -1889,8 +1886,8 @@
                      then if Con.equals (c, c')
                              then if h
                                      then Unknown
-                                  else bool true
-                          else bool false
+                                  else t
+                          else f
                   else Unknown
              | (_, [Var x, Const (Word i)]) => varWord (x, i, true)
              | (_, [Const (Word i), Var x]) => varWord (x, i, false)
@@ -1932,8 +1929,6 @@
              | (_, [Var x, Var y]) =>
                   if varEquals (x, y)
                      then let
-                             val t = ApplyResult.truee
-                             val f = ApplyResult.falsee
                              datatype z = datatype ApplyResult.t
                           in
                              case p of




More information about the MLton-commit mailing list