Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
920:7accd4546cf9 | 921:ae0110465421 |
---|---|
235 in | 235 in |
236 consider (xps, env) | 236 consider (xps, env) |
237 end | 237 end |
238 | 238 |
239 | (PNone _, ENone _) => Yes env | 239 | (PNone _, ENone _) => Yes env |
240 | (PNone _, ESome _) => No | |
240 | (PSome (_, p), ESome (_, e)) => match (env, p, e) | 241 | (PSome (_, p), ESome (_, e)) => match (env, p, e) |
242 | (PSome _, ENone _) => No | |
241 | 243 |
242 | _ => Maybe | 244 | _ => Maybe |
243 | 245 |
244 datatype event = | 246 datatype event = |
245 WritePage | 247 WritePage |
541 val effs_e' = summarize 0 e' | 543 val effs_e' = summarize 0 e' |
542 val effs_e' = List.filter (fn x => x <> UseRel) effs_e' | 544 val effs_e' = List.filter (fn x => x <> UseRel) effs_e' |
543 val effs_b = summarize 0 b | 545 val effs_b = summarize 0 b |
544 | 546 |
545 (*val () = Print.prefaces "Try" | 547 (*val () = Print.prefaces "Try" |
546 [("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan)), | 548 [(*("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan)),*) |
547 ("e'", MonoPrint.p_exp env e'), | 549 ("e'", MonoPrint.p_exp env e'), |
548 ("e'_eff", p_events effs_e'), | 550 ("e'_eff", p_events effs_e'), |
549 ("b", p_events effs_b)]*) | 551 ("b", p_events effs_b)]*) |
550 | 552 |
551 fun does eff = List.exists (fn eff' => eff' = eff) effs_e' | 553 fun does eff = List.exists (fn eff' => eff' = eff) effs_e' |
572 (*Print.prefaces "verifyCompatible" | 574 (*Print.prefaces "verifyCompatible" |
573 [("e'", MonoPrint.p_exp env e'), | 575 [("e'", MonoPrint.p_exp env e'), |
574 ("b", MonoPrint.p_exp (E.pushERel env x t NONE) b), | 576 ("b", MonoPrint.p_exp (E.pushERel env x t NONE) b), |
575 ("effs_e'", Print.p_list p_event effs_e'), | 577 ("effs_e'", Print.p_list p_event effs_e'), |
576 ("effs_b", Print.p_list p_event effs_b)];*) | 578 ("effs_b", Print.p_list p_event effs_b)];*) |
577 if List.null effs_e' orelse (List.all (fn eff => eff <> Unsure) effs_e' | 579 if List.null effs_e' |
578 andalso verifyCompatible effs_b) then | 580 orelse (List.all (fn eff => eff <> Unsure) effs_e' |
581 andalso verifyCompatible effs_b) | |
582 orelse (case effs_b of | |
583 UseRel :: effs => List.all verifyUnused effs | |
584 | _ => false) then | |
579 trySub () | 585 trySub () |
580 else | 586 else |
581 e | 587 e |
582 end | 588 end |
583 else | 589 else |