Mercurial > urweb
comparison src/reduce.sml @ 1969:f463c773ed6a
Use neverInline in reduce
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 15 Feb 2014 10:06:18 -0500 |
parents | 32784d27b5bc |
children | 18e6fb487880 |
comparison
equal
deleted
inserted
replaced
1968:2c075e875a47 | 1969:f463c773ed6a |
---|---|
847 | 847 |
848 val size = CoreUtil.Exp.fold {kind = fn (_, n) => n, | 848 val size = CoreUtil.Exp.fold {kind = fn (_, n) => n, |
849 con = fn (_, n) => n, | 849 con = fn (_, n) => n, |
850 exp = fn (_, n) => n + 1} 0 | 850 exp = fn (_, n) => n + 1} 0 |
851 | 851 |
852 fun mayInline (polyC, n, t, e) = | 852 fun mayInline (polyC, n, t, e, s) = |
853 let | 853 let |
854 fun isPolicy t = | 854 fun isPolicy t = |
855 case #1 t of | 855 case #1 t of |
856 CFfi ("Basis", "sql_policy") => true | 856 CFfi ("Basis", "sql_policy") => true |
857 | TFun (_, t) => isPolicy t | 857 | TFun (_, t) => isPolicy t |
858 | _ => false | 858 | _ => false |
859 in | 859 in |
860 not (Settings.checkNeverInline s) andalso | |
860 case IM.find (uses, n) of | 861 case IM.find (uses, n) of |
861 NONE => false | 862 NONE => false |
862 | SOME count => count <= 1 | 863 | SOME count => count <= 1 |
863 orelse (case #1 e of | 864 orelse (case #1 e of |
864 ERecord _ => true | 865 ERecord _ => true |
905 val e = exp (namedC, namedE) [] e | 906 val e = exp (namedC, namedE) [] e |
906 in | 907 in |
907 ((DVal (x, n, t, e, s), loc), | 908 ((DVal (x, n, t, e, s), loc), |
908 (polyC, | 909 (polyC, |
909 namedC, | 910 namedC, |
910 if mayInline (polyC, n, t, e) then | 911 if mayInline (polyC, n, t, e, s) then |
911 IM.insert (namedE, n, e) | 912 IM.insert (namedE, n, e) |
912 else | 913 else |
913 namedE)) | 914 namedE)) |
914 end | 915 end |
915 | DValRec vis => | 916 | DValRec vis => |