# HG changeset patch # User Adam Chlipala # Date 1252497645 14400 # Node ID ae0110465421ce57457977e90a0006bcad43f3d5 # Parent 7accd4546cf92dc64fdcd3268688fad50243ab4a Don't replace in blob returns; optimize more 'option' pattern matches; detect more opportunities for 'let' inlining diff -r 7accd4546cf9 -r ae0110465421 src/c/urweb.c --- a/src/c/urweb.c Tue Sep 08 20:12:17 2009 -0400 +++ b/src/c/urweb.c Wed Sep 09 08:00:45 2009 -0400 @@ -346,6 +346,7 @@ void *get_header_data; buf outHeaders, page, heap, script; + int returning_blob; input *inputs, *subinputs, *cur_container; size_t n_subinputs, used_subinputs; @@ -386,6 +387,7 @@ buf_init(&ctx->outHeaders, 0); buf_init(&ctx->page, 0); + ctx->returning_blob = 0; buf_init(&ctx->heap, 0); buf_init(&ctx->script, 1); ctx->script.start[0] = 0; @@ -458,6 +460,7 @@ buf_reset(&ctx->script); ctx->script.start[0] = 0; buf_reset(&ctx->page); + ctx->returning_blob = 0; buf_reset(&ctx->heap); ctx->regions = NULL; ctx->cleanup_front = ctx->cleanup; @@ -2549,7 +2552,7 @@ ctx->transactionals[i].free(ctx->transactionals[i].data); // Splice script data into appropriate part of page - if (ctx->script_header[0] == 0) + if (ctx->returning_blob || ctx->script_header[0] == 0) ; else if (buf_used(&ctx->script) == 0) { size_t len = strlen(ctx->script_header); @@ -2776,6 +2779,7 @@ cleanup *cl; int len; + ctx->returning_blob = 1; buf_reset(&ctx->outHeaders); buf_reset(&ctx->page); diff -r 7accd4546cf9 -r ae0110465421 src/mono_reduce.sml --- 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