Mercurial > urweb
comparison src/mono_reduce.sml @ 2110:9e9c915f554c
A new MonoReduce optimization for lifting 'let' out of field projection; JavaScript compilation for exponentiation
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 01 Feb 2015 12:29:14 -0500 |
parents | 0d48cfb59b29 |
children | ec1614fb97bb |
comparison
equal
deleted
inserted
replaced
2109:f42fea631c1d | 2110:9e9c915f554c |
---|---|
816 e | 816 e |
817 else | 817 else |
818 search pes | 818 search pes |
819 end | 819 end |
820 | 820 |
821 | EField ((ERecord xes, _), x) => | 821 | EField (e1, x) => |
822 (case List.find (fn (x', _, _) => x' = x) xes of | 822 let |
823 SOME (_, e, _) => #1 e | 823 fun yankLets (e : exp) = |
824 | NONE => e) | 824 case #1 e of |
825 ELet (x, t, e1, e2) => (ELet (x, t, e1, yankLets e2), #2 e) | |
826 | ERecord xes => | |
827 (case List.find (fn (x', _, _) => x' = x) xes of | |
828 SOME (_, e, _) => e | |
829 | NONE => (EField (e, x), #2 e)) | |
830 | _ => (EField (e, x), #2 e) | |
831 in | |
832 #1 (yankLets e1) | |
833 end | |
825 | 834 |
826 | ELet (x1, t1, (ELet (x2, t2, e1, b1), loc), b2) => | 835 | ELet (x1, t1, (ELet (x2, t2, e1, b1), loc), b2) => |
827 let | 836 let |
828 val e' = (ELet (x2, t2, e1, | 837 val e' = (ELet (x2, t2, e1, |
829 (ELet (x1, t1, b1, | 838 (ELet (x1, t1, b1, |