comparison src/especialize.sml @ 469:b393c2fc80f8

About to begin optimization of recursive transaction functions
author Adam Chlipala <adamc@hcoop.net>
date Thu, 06 Nov 2008 17:09:53 -0500
parents 787d4931fb07
children ffa18975e661
comparison
equal deleted inserted replaced
468:4efab85405be 469:b393c2fc80f8
108 case getApp e of 108 case getApp e of
109 NONE => (e, st) 109 NONE => (e, st)
110 | SOME (_, [], _) => (e, st) 110 | SOME (_, [], _) => (e, st)
111 | SOME (f, xs, xs') => 111 | SOME (f, xs, xs') =>
112 case IM.find (#funcs st, f) of 112 case IM.find (#funcs st, f) of
113 NONE => ((*print "SHOT DOWN!\n";*) (e, st)) 113 NONE => ((*print ("SHOT DOWN! " ^ Int.toString f ^ "\n");*) (e, st))
114 | SOME {name, args, body, typ, tag} => 114 | SOME {name, args, body, typ, tag} =>
115 case KM.find (args, xs) of 115 case KM.find (args, xs) of
116 SOME f' => ((*Print.prefaces "Pre-existing" [("e", CorePrint.p_exp CoreEnv.empty (e, ErrorMsg.dummySpan))];*) 116 SOME f' => ((*Print.prefaces "Pre-existing" [("e", CorePrint.p_exp CoreEnv.empty (e, ErrorMsg.dummySpan))];*)
117 (#1 (foldl (fn (e, arg) => (EApp (e, arg), ErrorMsg.dummySpan)) 117 (#1 (foldl (fn (e, arg) => (EApp (e, arg), ErrorMsg.dummySpan))
118 (ENamed f', ErrorMsg.dummySpan) xs'), 118 (ENamed f', ErrorMsg.dummySpan) xs'),
201 IM.insert (funcs, n, {name = x, 201 IM.insert (funcs, n, {name = x,
202 args = KM.empty, 202 args = KM.empty,
203 body = e, 203 body = e,
204 typ = c, 204 typ = c,
205 tag = tag}) 205 tag = tag})
206 | DVal (_, n, _, (ENamed n', _), _) =>
207 (case IM.find (funcs, n') of
208 NONE => funcs
209 | SOME v => IM.insert (funcs, n, v))
206 | _ => funcs 210 | _ => funcs
207 211
208 val (changed, ds) = 212 val (changed, ds) =
209 case #decls st of 213 case #decls st of
210 [] => (changed, [d']) 214 [] => (changed, [d'])