[absint] simplify `AbstractInterpreter.Make` functor by hiding `Scheduler` parameter

Summary:
At one point I thought we'd want to have lots of different schedulers for things like exploring loops in different orders, but that hasn't materialized.
Let's make the common use-case simpler by hiding the `Scheduler` parameter inside the `AbstractInterpreter` module.
We can always expose `MakeWithScheduler` later if we want to.

Reviewed By: jberdine

Differential Revision: D4508095

fbshipit-source-id: 726e051
master
Sam Blackshear 8 years ago committed by Facebook Github Bot
parent fb14d31bb7
commit 4627bb6f48

@ -93,11 +93,7 @@ let add_abstraction_instructions pdesc =
module BackwardCfg = ProcCfg.OneInstrPerNode(ProcCfg.Backward(ProcCfg.Exceptional)) module BackwardCfg = ProcCfg.OneInstrPerNode(ProcCfg.Backward(ProcCfg.Exceptional))
module LivenessAnalysis = module LivenessAnalysis = AbstractInterpreter.Make (BackwardCfg) (Liveness.TransferFunctions)
AbstractInterpreter.Make
(BackwardCfg)
(Scheduler.ReversePostorder)
(Liveness.TransferFunctions)
module VarDomain = AbstractDomain.FiniteSet(Var.Set) module VarDomain = AbstractDomain.FiniteSet(Var.Set)
@ -254,10 +250,7 @@ let add_nullify_instrs pdesc tenv liveness_inv_map =
module ExceptionalOneInstrPerNodeCfg = ProcCfg.OneInstrPerNode(ProcCfg.Exceptional) module ExceptionalOneInstrPerNodeCfg = ProcCfg.OneInstrPerNode(ProcCfg.Exceptional)
module CopyProp = module CopyProp =
AbstractInterpreter.Make AbstractInterpreter.Make (ExceptionalOneInstrPerNodeCfg) (CopyPropagation.TransferFunctions)
(ExceptionalOneInstrPerNodeCfg)
(Scheduler.ReversePostorder)
(CopyPropagation.TransferFunctions)
let do_copy_propagation pdesc tenv = let do_copy_propagation pdesc tenv =
let proc_cfg = ExceptionalOneInstrPerNodeCfg.from_pdesc pdesc in let proc_cfg = ExceptionalOneInstrPerNodeCfg.from_pdesc pdesc in

@ -271,11 +271,7 @@ struct
output_mem output_mem
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Normal) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Normal)
(Scheduler.ReversePostorder)
(TransferFunctions)
module Interprocedural = AbstractInterpreter.Interprocedural (Summary) module Interprocedural = AbstractInterpreter.Interprocedural (Summary)
module CFG = Analyzer.TransferFunctions.CFG module CFG = Analyzer.TransferFunctions.CFG

@ -184,6 +184,8 @@ module Interprocedural (Summ : Summary.S) = struct
Summ.read_summary proc_desc proc_name Summ.read_summary proc_desc proc_name
end end
module MakeWithScheduler (C : ProcCfg.S) (S : Scheduler.Make) (T : TransferFunctions.Make) =
module Make (C : ProcCfg.S) (S : Scheduler.Make) (T : TransferFunctions.Make) =
MakeNoCFG (S (C)) (T (C)) MakeNoCFG (S (C)) (T (C))
module Make (C : ProcCfg.S) (T : TransferFunctions.Make) =
MakeWithScheduler (C) (Scheduler.ReversePostorder) (T)

@ -57,7 +57,6 @@ module MakeNoCFG
transfer functions from a CFG *) transfer functions from a CFG *)
module Make module Make
(CFG : ProcCfg.S) (CFG : ProcCfg.S)
(MakeScheduler : Scheduler.Make)
(MakeTransferFunctions : TransferFunctions.Make) : (MakeTransferFunctions : TransferFunctions.Make) :
S with module TransferFunctions = MakeTransferFunctions(CFG) S with module TransferFunctions = MakeTransferFunctions(CFG)

@ -149,11 +149,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
astate astate
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Exceptional) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(TransferFunctions)
let loaded_stacktraces = let loaded_stacktraces =
(* Load all stacktraces defined in either Config.stacktrace or (* Load all stacktraces defined in either Config.stacktrace or

@ -80,11 +80,7 @@ module Make (Spec : Spec) : S = struct
Domain.empty Domain.empty
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Exceptional) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(TransferFunctions)
let checker { Callbacks.proc_desc; proc_name; tenv; } = let checker { Callbacks.proc_desc; proc_name; tenv; } =
let nodes = Procdesc.get_nodes proc_desc in let nodes = Procdesc.get_nodes proc_desc in

@ -103,11 +103,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
astate astate
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Normal) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Normal)
(Scheduler.ReversePostorder)
(TransferFunctions)
module Interprocedural = AbstractInterpreter.Interprocedural (Summary) module Interprocedural = AbstractInterpreter.Interprocedural (Summary)

@ -440,11 +440,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
astate astate
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Normal) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Normal)
(Scheduler.ReversePostorder)
(TransferFunctions)
module Interprocedural = AbstractInterpreter.Interprocedural (Summary) module Interprocedural = AbstractInterpreter.Interprocedural (Summary)

@ -43,6 +43,4 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
astate astate
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Exceptional) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Exceptional) (Scheduler.ReversePostorder) (TransferFunctions)

@ -327,11 +327,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
astate astate
end end
module Analyzer = module Analyzer = AbstractInterpreter.Make (ProcCfg.Exceptional) (TransferFunctions)
AbstractInterpreter.Make
(ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(TransferFunctions)
module Interprocedural = struct module Interprocedural = struct
include AbstractInterpreter.Interprocedural(Summary) include AbstractInterpreter.Interprocedural(Summary)

@ -55,7 +55,4 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
end end
module Analyzer = module Analyzer =
AbstractInterpreter.Make AbstractInterpreter.Make (ProcCfg.Backward(ProcCfg.Exceptional)) (TransferFunctions)
(ProcCfg.Backward(ProcCfg.Exceptional))
(Scheduler.ReversePostorder)
(TransferFunctions)

@ -483,10 +483,7 @@ module Make (TaintSpecification : TaintSpec.S) = struct
astate astate
end end
module Analyzer = AbstractInterpreter.Make module Analyzer = AbstractInterpreter.Make (ProcCfg.Exceptional) (TransferFunctions)
(ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(TransferFunctions)
let make_summary formal_map access_tree = let make_summary formal_map access_tree =
let access_tree' = let access_tree' =

@ -11,9 +11,9 @@ open! IStd
module F = Format module F = Format
module TestInterpreter = AnalyzerTester.Make module TestInterpreter =
AnalyzerTester.Make
(ProcCfg.Exceptional) (ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(BoundedCallTree.TransferFunctions) (BoundedCallTree.TransferFunctions)
let mock_get_proc_desc _ = None let mock_get_proc_desc _ = None

@ -48,10 +48,7 @@ module MockTaintAnalysis = TaintAnalysis.Make(struct
let handle_unknown_call _ _ _ = [] let handle_unknown_call _ _ _ = []
end) end)
module TestInterpreter = AnalyzerTester.Make module TestInterpreter = AnalyzerTester.Make (ProcCfg.Normal) (MockTaintAnalysis.TransferFunctions)
(ProcCfg.Normal)
(Scheduler.ReversePostorder)
(MockTaintAnalysis.TransferFunctions)
let tests = let tests =
let open OUnit2 in let open OUnit2 in

@ -58,12 +58,10 @@ end
module NormalTestInterpreter = AnalyzerTester.Make module NormalTestInterpreter = AnalyzerTester.Make
(ProcCfg.Normal) (ProcCfg.Normal)
(Scheduler.ReversePostorder)
(PathCountTransferFunctions) (PathCountTransferFunctions)
module ExceptionalTestInterpreter = AnalyzerTester.Make module ExceptionalTestInterpreter = AnalyzerTester.Make
(ProcCfg.Exceptional) (ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(PathCountTransferFunctions) (PathCountTransferFunctions)
let tests = let tests =

@ -11,10 +11,7 @@ open! IStd
module F = Format module F = Format
module TestInterpreter = AnalyzerTester.Make module TestInterpreter = AnalyzerTester.Make (ProcCfg.Exceptional) (AddressTaken.TransferFunctions)
(ProcCfg.Exceptional)
(Scheduler.ReversePostorder)
(AddressTaken.TransferFunctions)
let tests = let tests =
let open OUnit2 in let open OUnit2 in

@ -155,14 +155,11 @@ module StructuredSil = struct
call_unknown None arg_strs call_unknown None arg_strs
end end
module Make module Make (CFG : ProcCfg.S with type node = Procdesc.Node.t) (T : TransferFunctions.Make) = struct
(CFG : ProcCfg.S with type node = Procdesc.Node.t)
(S : Scheduler.Make)
(T : TransferFunctions.Make) = struct
open StructuredSil open StructuredSil
module I = AbstractInterpreter.Make (CFG) (S) (T) module I = AbstractInterpreter.Make (CFG) (T)
module M = I.InvariantMap module M = I.InvariantMap
type assert_map = string M.t type assert_map = string M.t

@ -11,10 +11,8 @@ open! IStd
module F = Format module F = Format
module TestInterpreter = AnalyzerTester.Make module TestInterpreter =
(ProcCfg.Exceptional) AnalyzerTester.Make (ProcCfg.Exceptional) (CopyPropagation.TransferFunctions)
(Scheduler.ReversePostorder)
(CopyPropagation.TransferFunctions)
let tests = let tests =
let open OUnit2 in let open OUnit2 in

@ -11,10 +11,8 @@ open! IStd
module F = Format module F = Format
module TestInterpreter = AnalyzerTester.Make module TestInterpreter =
(ProcCfg.Backward(ProcCfg.Normal)) AnalyzerTester.Make (ProcCfg.Backward(ProcCfg.Normal)) (Liveness.TransferFunctions)
(Scheduler.ReversePostorder)
(Liveness.TransferFunctions)
let tests = let tests =
let open OUnit2 in let open OUnit2 in

Loading…
Cancel
Save