comparison src/mono_reduce.sml @ 2252:e843a04499d4

Revert to revision 2222.
author Ziv Scully <ziv@mit.edu>
date Mon, 21 Sep 2015 10:16:55 -0400
parents 25874084bf1f
children
comparison
equal deleted inserted replaced
2251:25874084bf1f 2252:e843a04499d4
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
388 foldl (fn ((x, n, _, e, _), absCounts) => 388 foldl (fn ((x, n, _, e, _), absCounts) =>
389 IM.insert (absCounts, n, countAbs E.empty e)) 389 IM.insert (absCounts, n, countAbs E.empty e))
390 absCounts vis) 390 absCounts vis)
391 | _ => (timpures, impures, absCounts) 391 | _ => (timpures, impures, absCounts)
392 end) 392 end)
393 (IS.empty, IS.empty, IM.empty) (#decls file) 393 (IS.empty, IS.empty, IM.empty) (#1 file)
394 394
395 val uses = U.File.fold {typ = fn (_, m) => m, 395 val uses = U.File.fold {typ = fn (_, m) => m,
396 exp = fn (e, m) => 396 exp = fn (e, m) =>
397 case e of 397 case e of
398 ENamed n => IM.insert (m, n, 1 + Option.getOpt (IM.find (m, n), 0)) 398 ENamed n => IM.insert (m, n, 1 + Option.getOpt (IM.find (m, n), 0))
404 exp = fn (_, n) => n + 1} 0 404 exp = fn (_, n) => n + 1} 0
405 405
406 val functionInside' = U.Typ.exists (fn c => case c of 406 val functionInside' = U.Typ.exists (fn c => case c of
407 TFun _ => true 407 TFun _ => true
408 | _ => false) 408 | _ => false)
409 409
410 fun functionInside t = 410 fun functionInside t =
411 case #1 t of 411 case #1 t of
412 TFun (t1, t2) => functionInside' t1 orelse functionInside t2 412 TFun (t1, t2) => functionInside' t1 orelse functionInside t2
413 | _ => functionInside' t 413 | _ => functionInside' t
414 414
518 | EReturnBlob {blob = NONE, mimeType = e2, ...} => summarize d e2 @ [Abort] 518 | EReturnBlob {blob = NONE, mimeType = e2, ...} => summarize d e2 @ [Abort]
519 | EReturnBlob {blob = SOME e1, mimeType = e2, ...} => summarize d e1 @ summarize d e2 @ [Abort] 519 | EReturnBlob {blob = SOME e1, mimeType = e2, ...} => summarize d e1 @ summarize d e2 @ [Abort]
520 | ERedirect (e, _) => summarize d e @ [Abort] 520 | ERedirect (e, _) => summarize d e @ [Abort]
521 521
522 | EWrite e => summarize d e @ [WritePage] 522 | EWrite e => summarize d e @ [WritePage]
523 523
524 | ESeq (e1, e2) => summarize d e1 @ summarize d e2 524 | ESeq (e1, e2) => summarize d e1 @ summarize d e2
525 | ELet (_, _, e1, e2) => summarize d e1 @ summarize (if d = ~1 then ~1 else d + 1) e2 525 | ELet (_, _, e1, e2) => summarize d e1 @ summarize (if d = ~1 then ~1 else d + 1) e2
526 526
527 | EClosure (_, es) => List.concat (map (summarize d) es) 527 | EClosure (_, es) => List.concat (map (summarize d) es)
528 528