[MLton-commit] r4194

Stephen Weeks MLton@mlton.org
Thu, 10 Nov 2005 15:37:18 -0800


Fixed bug -- disabled tuple reconstruction if the reconstructed tuple
has mutable fields.

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

U   mlton/trunk/mlton/ssa/shrink2.fun

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

Modified: mlton/trunk/mlton/ssa/shrink2.fun
===================================================================
--- mlton/trunk/mlton/ssa/shrink2.fun	2005-11-10 20:27:08 UTC (rev 4193)
+++ mlton/trunk/mlton/ssa/shrink2.fun	2005-11-10 23:37:14 UTC (rev 4194)
@@ -1202,12 +1202,19 @@
                 | Object {args, con} =>
                      let
                         val args = varInfos args
+                        val isMutable =
+                           case Type.dest ty of
+                              Type.Object {args, ...} => Prod.isMutable args
+                            | _ => Error.bug "strange Object type"
                      in
-                        if isSome con
-                           then
-                              construct (Value.Object {args = args, con = con},
-                                         fn () => Object {args = uses args,
-                                                          con = con})
+                        (* It would be nice to improve this code to do
+                         * reconstruction when isSome con, not just for
+                         * tuples.
+                         *)
+                        if isMutable orelse isSome con then
+                           construct (Value.Object {args = args, con = con},
+                                      fn () => Object {args = uses args,
+                                                       con = con})
                         else tuple args
                      end
                 | PrimApp {args, prim} =>