[sledge] Optimize by inlining functors

Summary:
Inline functor applications, principally those involved in the
representation of (arithmetic) terms. This enables direct calls to
functions in the result of functor applications, instead of indirect
via an offset from the start of the module block resulting from the
functor appication. This also then enables further inlining
opportunities.

Reviewed By: jvillard

Differential Revision: D26338016

fbshipit-source-id: 27b770fa3
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 32c89e6b68
commit 5ea2f20cad

@ -11,7 +11,7 @@ include NSMap_intf
module Make (Key : sig
type t [@@deriving compare, sexp_of]
end) : S with type key = Key.t = struct
module M = Stdlib.Map.Make (Key)
module M = Stdlib.Map.Make [@inlined] (Key)
type key = Key.t
type 'a t = 'a M.t [@@deriving compare, equal]
@ -249,3 +249,4 @@ end) : S with type key = Key.t = struct
let sd = Iter.to_list (symmetric_diff ~eq x y) in
List.pp ~pre ~suf sep pp_diff_elt fs sd
end
[@@inline]

@ -11,7 +11,7 @@ include NSSet_intf
module Make (Elt : sig
type t [@@deriving compare, sexp_of]
end) : S with type elt = Elt.t = struct
module S = Stdlib.Set.Make (Elt)
module S = Stdlib.Set.Make [@inlined] (Elt)
type elt = Elt.t
type t = S.t [@@deriving compare, equal]
@ -138,3 +138,4 @@ end) : S with type elt = Elt.t = struct
if not (is_empty gain) then Format.fprintf fs "++ %a" pp gain
end
end
[@@inline]

@ -36,6 +36,7 @@ struct
let comparer = Ord.compare
end
[@@inlined]
module Counterfeit (Ord : sig
type t [@@deriving compare]
@ -46,6 +47,7 @@ struct
let comparer = Ord.compare
end
[@@inlined]
module Apply (F : sig
type ('a, 'compare_a) t [@@deriving compare]
@ -64,6 +66,7 @@ struct
let comparer = compare
end
[@@inlined]
module Apply1 (F : sig
type ('a, 'b, 'compare_a) t [@@deriving compare]
@ -84,3 +87,4 @@ struct
let comparer = compare
end
[@@inlined]

@ -8,7 +8,7 @@
include CCHashSet
module Make (E : ELEMENT) = struct
include CCHashSet.Make (E)
include CCHashSet.Make [@inlined] (E)
let update s e ~f =
let eo = find s e in

@ -12,7 +12,7 @@ open! NS0
include HashTable_intf
module Make (Key : HashedType) = struct
include CCHashtbl.Make (Key)
include CCHashtbl.Make [@inlined] (Key)
let create ?(size = 0) () = create size
let set tbl ~key ~data = replace tbl key data

@ -112,3 +112,4 @@ struct
let for_all m ~f = M.for_alli ~f:(fun ~key ~data -> f key data) m
let fold m s ~f = M.fold ~f:(fun ~key ~data -> f key data) m s
end
[@@inline]

@ -559,3 +559,4 @@ module Make (Opts : Domain_intf.Opts) (Dom : Domain_intf.Dom) = struct
| [] -> map
| _ -> Llair.Function.Map.add ~key ~data map )
end
[@@inlined]

@ -115,3 +115,4 @@ module Make (State_domain : State_domain_sig) = struct
let+ next = State_domain.apply_summary current summ in
(entry, next)
end
[@@inlined]

@ -399,4 +399,6 @@ struct
solve_for_mono Sum.empty c m p
| _ -> None )
end
[@@inline]
end
[@@inline]

@ -258,3 +258,4 @@ struct
let trms p = Iter.from_labelled_iter (iter_trms p)
end
end
[@@inline]

@ -76,3 +76,4 @@ module Make (Var : VAR) = struct
let apply sub v = Map.find v sub |> Option.value ~default:v
end
[@@inline]

Loading…
Cancel
Save