Mercurial > urweb
comparison src/especialize.sml @ 1848:e15234fbb163
Basis.tryRpc
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 16 Apr 2013 10:55:48 -0400 |
parents | 148203744882 |
children | 52043ad66ce7 |
comparison
equal
deleted
inserted
replaced
1847:8958b580d026 | 1848:e15234fbb163 |
---|---|
1 (* Copyright (c) 2008-2012, Adam Chlipala | 1 (* Copyright (c) 2008-2013, Adam Chlipala |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
203 | ECutMulti (e1, _, _) => ca depth e1 | 203 | ECutMulti (e1, _, _) => ca depth e1 |
204 | ECase (e1, pes, _) => foldl (fn ((p, e), d) => Int.min (ca (depth + E.patBindsN p) e, d)) (ca depth e1) pes | 204 | ECase (e1, pes, _) => foldl (fn ((p, e), d) => Int.min (ca (depth + E.patBindsN p) e, d)) (ca depth e1) pes |
205 | EWrite e1 => ca depth e1 | 205 | EWrite e1 => ca depth e1 |
206 | EClosure (_, es) => foldl (fn (e, d) => Int.min (ca depth e, d)) maxInt es | 206 | EClosure (_, es) => foldl (fn (e, d) => Int.min (ca depth e, d)) maxInt es |
207 | ELet (_, _, e1, e2) => Int.min (ca depth e1, ca (depth + 1) e2) | 207 | ELet (_, _, e1, e2) => Int.min (ca depth e1, ca (depth + 1) e2) |
208 | EServerCall (_, es, _) => foldl (fn (e, d) => Int.min (ca depth e, d)) maxInt es | 208 | EServerCall (_, es, _, _) => foldl (fn (e, d) => Int.min (ca depth e, d)) maxInt es |
209 | 209 |
210 fun enterAbs depth e = | 210 fun enterAbs depth e = |
211 case #1 e of | 211 case #1 e of |
212 EAbs (_, _, _, e1) => enterAbs (depth + 1) e1 | 212 EAbs (_, _, _, e1) => enterAbs (depth + 1) e1 |
213 | _ => ca depth e | 213 | _ => ca depth e |
346 val (e1, st) = exp (env, e1, st) | 346 val (e1, st) = exp (env, e1, st) |
347 val (e2, st) = exp ((x, t) :: env, e2, st) | 347 val (e2, st) = exp ((x, t) :: env, e2, st) |
348 in | 348 in |
349 ((ELet (x, t, e1, e2), loc), st) | 349 ((ELet (x, t, e1, e2), loc), st) |
350 end | 350 end |
351 | EServerCall (n, es, t) => | 351 | EServerCall (n, es, t, fm) => |
352 let | 352 let |
353 val (es, st) = ListUtil.foldlMap (fn (e, st) => exp (env, e, st)) st es | 353 val (es, st) = ListUtil.foldlMap (fn (e, st) => exp (env, e, st)) st es |
354 in | 354 in |
355 ((EServerCall (n, es, t), loc), st) | 355 ((EServerCall (n, es, t, fm), loc), st) |
356 end | 356 end |
357 in | 357 in |
358 case getApp e of | 358 case getApp e of |
359 NONE => default () | 359 NONE => default () |
360 | SOME (f, xs) => | 360 | SOME (f, xs) => |