comparison src/reduce.sml @ 1240:beb67ff4c8a0

'also' policies and policy reduction; calendar in good shape
author Adam Chlipala <adamc@hcoop.net>
date Thu, 15 Apr 2010 10:00:30 -0400
parents c316ca3c9ec6
children 56bd4a4f6e66
comparison
equal deleted inserted replaced
1239:30f789d5e2ad 1240:beb67ff4c8a0
666 val size = CoreUtil.Exp.fold {kind = fn (_, n) => n, 666 val size = CoreUtil.Exp.fold {kind = fn (_, n) => n,
667 con = fn (_, n) => n, 667 con = fn (_, n) => n,
668 exp = fn (_, n) => n + 1} 0 668 exp = fn (_, n) => n + 1} 0
669 669
670 fun mayInline (polyC, n, t, e) = 670 fun mayInline (polyC, n, t, e) =
671 case IM.find (uses, n) of 671 let
672 NONE => false 672 fun isPolicy t =
673 | SOME count => count <= 1 673 case #1 t of
674 orelse (case #1 e of 674 CFfi ("Basis", "sql_policy") => true
675 ERecord _ => true 675 | TFun (_, t) => isPolicy t
676 | _ => false) 676 | _ => false
677 orelse isPoly polyC t 677 in
678 orelse size e <= Settings.getCoreInline () 678 case IM.find (uses, n) of
679 NONE => false
680 | SOME count => count <= 1
681 orelse (case #1 e of
682 ERecord _ => true
683 | _ => false)
684 orelse isPolicy t
685 orelse isPoly polyC t
686 orelse size e <= Settings.getCoreInline ()
687 end
679 688
680 fun doDecl (d as (_, loc), st as (polyC, namedC, namedE)) = 689 fun doDecl (d as (_, loc), st as (polyC, namedC, namedE)) =
681 case #1 d of 690 case #1 d of
682 DCon (x, n, k, c) => 691 DCon (x, n, k, c) =>
683 let 692 let