[MLton-commit] r6248

Matthew Fluet fluet at mlton.org
Sun Dec 9 11:56:15 PST 2007


Don't constant fold to very large constants
----------------------------------------------------------------------

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

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

Modified: mlton/trunk/mlton/atoms/prim.fun
===================================================================
--- mlton/trunk/mlton/atoms/prim.fun	2007-12-09 19:49:43 UTC (rev 6247)
+++ mlton/trunk/mlton/atoms/prim.fun	2007-12-09 19:56:15 UTC (rev 6248)
@@ -1567,8 +1567,17 @@
                          intInf (IntInf.~>>
                                  (i1, Word.fromIntInf (WordX.toIntInf w2)))
                     | IntInf_lshift =>
-                         intInf (IntInf.<<
-                                 (i1, Word.fromIntInf (WordX.toIntInf w2)))
+                         let
+                            val maxShift =
+                               WordX.lshift
+                               (WordX.one WordSize.shiftArg,
+                                WordX.fromIntInf (128, WordSize.shiftArg))
+                         in
+                            if WordX.lt (w2, maxShift, {signed = false})
+                               then intInf (IntInf.<< 
+                                            (i1, Word.fromIntInf (WordX.toIntInf w2)))
+                            else Unknown
+                         end
                     | _ => Unknown)
              | (_, [Const (IntInf i1), _]) =>
                   (case p of




More information about the MLton-commit mailing list