# HG changeset patch # User Adam Chlipala # Date 1290974771 18000 # Node ID d596c7002ad87d634808a6d1f7feaff606ac53da # Parent 0d8bd8ae841728140ac17add10a43b2da78c9172 More accurate/conservative leaky type detection in CjrPrint diff -r 0d8bd8ae8417 -r d596c7002ad8 src/cjr_print.sml --- a/src/cjr_print.sml Fri Nov 26 11:57:04 2010 -0500 +++ b/src/cjr_print.sml Sun Nov 28 15:06:11 2010 -0500 @@ -525,6 +525,10 @@ | _ => raise Fail "CjrPrint: getPargs" +val notLeakies = SS.fromList ["int", "float", "char", "time", "bool", "unit", "client", "channel", + "xhtml", "page", "xbody", "css_class"] +val notLeakies' = SS.fromList ["blob"] + fun notLeaky env allowHeapAllocated = let fun nl ok (t, _) = @@ -548,9 +552,9 @@ NONE => true | SOME t => nl ok' t) cons end) - | TFfi ("Basis", "string") => false - | TFfi ("Basis", "blob") => allowHeapAllocated - | TFfi _ => true + | TFfi ("Basis", t) => SS.member (notLeakies, t) + orelse (allowHeapAllocated andalso SS.member (notLeakies', t)) + | TFfi _ => false | TOption t => allowHeapAllocated andalso nl ok t | TList (t, _) => allowHeapAllocated andalso nl ok t in