Mercurial > urweb
comparison src/reduce.sml @ 1824:216e92b39fc1
Paranoid inlining prevention for FFI types at the Core level; less paranoid inlining promotion for passive values at the Mono level
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 19 Sep 2012 18:01:22 -0400 |
parents | 148203744882 |
children | e15234fbb163 |
comparison
equal
deleted
inserted
replaced
1823:66a58d8501e0 | 1824:216e92b39fc1 |
---|---|
244 | ECAbs _ => true | 244 | ECAbs _ => true |
245 | EKAbs _ => true | 245 | EKAbs _ => true |
246 | ERecord xes => List.all (passive o #2) xes | 246 | ERecord xes => List.all (passive o #2) xes |
247 | EField (e, _, _) => passive e | 247 | EField (e, _, _) => passive e |
248 | _ => false | 248 | _ => false |
249 | |
250 fun notFfi (t : con) = | |
251 case #1 t of | |
252 CFfi _ => false | |
253 | _ => true | |
249 | 254 |
250 fun kindConAndExp (namedC, namedE) = | 255 fun kindConAndExp (namedC, namedE) = |
251 let | 256 let |
252 fun kind env (all as (k, loc)) = | 257 fun kind env (all as (k, loc)) = |
253 case k of | 258 case k of |
791 let | 796 let |
792 val e1' = exp env e1 | 797 val e1' = exp env e1 |
793 | 798 |
794 val t = con env t | 799 val t = con env t |
795 in | 800 in |
796 if passive e1' orelse count e2 <= 1 orelse ESpecialize.functionInside t then | 801 if notFfi t andalso (passive e1' orelse count e2 <= 1 orelse ESpecialize.functionInside t) then |
797 exp (KnownE e1 :: env) e2 | 802 exp (KnownE e1 :: env) e2 |
798 else | 803 else |
799 (ELet (x, t, e1', exp (UnknownE :: env) e2), loc) | 804 (ELet (x, t, e1', exp (UnknownE :: env) e2), loc) |
800 end | 805 end |
801 | 806 |