diff src/mono_reduce.sml @ 921:ae0110465421

Don't replace <sc> in blob returns; optimize more 'option' pattern matches; detect more opportunities for 'let' inlining
author Adam Chlipala <adamc@hcoop.net>
date Wed, 09 Sep 2009 08:00:45 -0400
parents 7accd4546cf9
children 0a156bbd205f
line wrap: on
line diff
--- a/src/mono_reduce.sml	Tue Sep 08 20:12:17 2009 -0400
+++ b/src/mono_reduce.sml	Wed Sep 09 08:00:45 2009 -0400
@@ -237,7 +237,9 @@
         end
 
       | (PNone _, ENone _) => Yes env
+      | (PNone _, ESome _) => No
       | (PSome (_, p), ESome (_, e)) => match (env, p, e)
+      | (PSome _, ENone _) => No
 
       | _ => Maybe
 
@@ -543,7 +545,7 @@
                                     val effs_b = summarize 0 b
 
                                     (*val () = Print.prefaces "Try"
-                                                            [("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan)),
+                                                            [(*("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan)),*)
                                                              ("e'", MonoPrint.p_exp env e'),
                                                              ("e'_eff", p_events effs_e'),
                                                              ("b", p_events effs_b)]*)
@@ -574,8 +576,12 @@
                                                     ("b", MonoPrint.p_exp (E.pushERel env x t NONE) b),
                                                     ("effs_e'", Print.p_list p_event effs_e'),
                                                     ("effs_b", Print.p_list p_event effs_b)];*)
-                                    if List.null effs_e' orelse (List.all (fn eff => eff <> Unsure) effs_e'
-                                                                 andalso verifyCompatible effs_b) then
+                                    if List.null effs_e'
+                                       orelse (List.all (fn eff => eff <> Unsure) effs_e'
+                                               andalso verifyCompatible effs_b)
+                                       orelse (case effs_b of
+                                                   UseRel :: effs => List.all verifyUnused effs
+                                                 | _ => false) then
                                         trySub ()
                                     else
                                         e