Mercurial > urweb
changeset 1393:802c179dac1f
alwaysInline .urp setting
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 13 Jan 2011 18:15:04 -0500 |
parents | e305ffee2b5b |
children | d328983dc5a6 |
files | src/compiler.sml src/mono_reduce.sml src/settings.sig src/settings.sml |
diffstat | 4 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 ()
--- 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
--- 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
--- 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