# HG changeset patch # User Adam Chlipala # Date 1294960504 18000 # Node ID 802c179dac1f5e351e6d98b3286e7521f1a19163 # Parent e305ffee2b5bb2a5002fe3a846296861d2524289 alwaysInline .urp setting diff -r e305ffee2b5b -r 802c179dac1f src/compiler.sml --- a/src/compiler.sml Thu Jan 13 13:20:14 2011 -0500 +++ b/src/compiler.sml Thu Jan 13 18:15:04 2011 -0500 @@ -754,6 +754,7 @@ (case Int.fromString arg of NONE => ErrorMsg.error ("invalid min heap '" ^ arg ^ "'") | SOME n => minHeap := n) + | "alwaysInline" => Settings.addAlwaysInline arg | _ => ErrorMsg.error ("Unrecognized command '" ^ cmd ^ "'"); read () diff -r e305ffee2b5b -r 802c179dac1f src/mono_reduce.sml --- a/src/mono_reduce.sml Thu Jan 13 13:20:14 2011 -0500 +++ b/src/mono_reduce.sml Thu Jan 13 18:15:04 2011 -0500 @@ -374,12 +374,13 @@ TFun (t1, t2) => functionInside' t1 orelse functionInside t2 | _ => functionInside' t - fun mayInline (n, e, t) = + fun mayInline (n, e, t, s) = case IM.find (uses, n) of NONE => false | SOME count => count <= 1 orelse size e <= Settings.getMonoInline () orelse functionInside t + orelse Settings.checkAlwaysInline s fun summarize d (e, _) = let @@ -711,7 +712,7 @@ let val eo = case eo of NONE => NONE - | SOME e => if mayInline (n, e, t) then + | SOME e => if mayInline (n, e, t, s) then SOME e else NONE diff -r e305ffee2b5b -r 802c179dac1f src/settings.sig --- a/src/settings.sig Thu Jan 13 13:20:14 2011 -0500 +++ b/src/settings.sig Thu Jan 13 18:15:04 2011 -0500 @@ -215,4 +215,7 @@ val setMinHeap : int -> unit val getMinHeap : unit -> int + + val addAlwaysInline : string -> unit + val checkAlwaysInline : string -> bool end diff -r e305ffee2b5b -r 802c179dac1f src/settings.sml --- a/src/settings.sml Thu Jan 13 13:20:14 2011 -0500 +++ b/src/settings.sml Thu Jan 13 18:15:04 2011 -0500 @@ -539,4 +539,13 @@ fun setMinHeap n = if n >= 0 then minHeap := n else raise Fail "Trying to set negative minHeap" fun getMinHeap () = !minHeap +structure SS = BinarySetFn(struct + type ord_key = string + val compare = String.compare + end) + +val alwaysInline = ref SS.empty +fun addAlwaysInline s = alwaysInline := SS.add (!alwaysInline, s) +fun checkAlwaysInline s = SS.member (!alwaysInline, s) + end