comparison src/mono_opt.sml @ 1445:6e6f1643c4e9

To generate server-side source JavaScript, try both the old and new strategies; remove an unsound optimization from MonoOpt and make MonoReduce work harder to compensate
author Adam Chlipala <adam@chlipala.net>
date Mon, 28 Mar 2011 10:37:49 -0400
parents 02fc16faecf3
children 36f7d1debb37
comparison
equal deleted inserted replaced
1444:0fc7b676b88b 1445:6e6f1643c4e9
355 map (fn (p, e) => (p, doBody e)) pes, 355 map (fn (p, e) => (p, doBody e)) pes,
356 {disc = disc, 356 {disc = disc,
357 result = ran}), loc) 357 result = ran}), loc)
358 end 358 end
359 359
360 | ECase (discE, pes, {disc, result = (TFun (dom, ran), loc)}) =>
361 let
362 fun doBody (p, e) =
363 let
364 val pb = MonoEnv.patBindsN p
365 in
366 (EApp (MonoEnv.liftExpInExp pb e, (ERel pb, loc)), loc)
367 end
368 in
369 EAbs ("x", dom, ran,
370 (optExp (ECase (MonoEnv.liftExpInExp 0 discE,
371 map (fn (p, e) => (p, doBody (p, e))) pes,
372 {disc = disc,
373 result = ran}), loc), loc))
374 end
375
376 | EWrite (EQuery {exps, tables, state, query, 360 | EWrite (EQuery {exps, tables, state, query,
377 initial = (EPrim (Prim.String ""), _), 361 initial = (EPrim (Prim.String ""), _),
378 body = (EStrcat ((EPrim (Prim.String s), _), 362 body = (EStrcat ((EPrim (Prim.String s), _),
379 (EStrcat ((ERel 0, _), 363 (EStrcat ((ERel 0, _),
380 e'), _)), _)}, loc) => 364 e'), _)), _)}, loc) =>