From a1381565f175be63588dac25bf76924fca705f0a Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Wed, 21 Jul 2021 03:03:40 -0700 Subject: [PATCH] [attrs] look at capture DB only -- starvation Summary: This call back introduces non-determinism because it first looks for the proc desc in a summary and if it doesn't find it then returns the one from the capture DB. The problem is: - the main factor affecting the existence of a summary on-disk is timing; - the two proc descs are generally different, as the one in the summary is preanalysed and the one in the capture DB is not; - this extends to the attributes included in the proc desc potentially. The plan is to eliminate these calls one by one using the CI for correctness. Reviewed By: skcho Differential Revision: D29793530 fbshipit-source-id: 6d9269cee --- infer/src/concurrency/StarvationModels.ml | 2 +- infer/src/concurrency/starvation.ml | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/infer/src/concurrency/StarvationModels.ml b/infer/src/concurrency/StarvationModels.ml index 017445a7e..8e0370368 100644 --- a/infer/src/concurrency/StarvationModels.ml +++ b/infer/src/concurrency/StarvationModels.ml @@ -336,7 +336,7 @@ let get_run_method_from_runnable tenv runnable = let get_returned_executor tenv callee actuals = let type_check = lazy - ( AnalysisCallbacks.proc_resolve_attributes callee + ( Attributes.load callee |> Option.exists ~f:(fun (attrs : ProcAttributes.t) -> match attrs.ret_type.Typ.desc with | Tstruct tname | Typ.Tptr ({desc= Tstruct tname}, _) -> diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvation.ml index c09b8b56c..d62740a6b 100644 --- a/infer/src/concurrency/starvation.ml +++ b/infer/src/concurrency/starvation.ml @@ -627,7 +627,7 @@ let fold_reportable_summaries analyze_ondemand tenv clazz ~init ~f = |> Option.value_map ~default:[] ~f:(fun tstruct -> tstruct.Struct.methods) in let f acc mthd = - AnalysisCallbacks.proc_resolve_attributes mthd + Attributes.load mthd |> Option.value_map ~default:acc ~f:(fun other_attrs -> if should_report other_attrs then analyze_ondemand mthd @@ -652,10 +652,7 @@ let is_private attrs = ProcAttributes.equal_access (ProcAttributes.get_access at [should_report_starvation] means [pair] is on the UI thread and not on a constructor *) let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lock other_pname other_pair report_map = - if - is_private pattrs - || AnalysisCallbacks.proc_resolve_attributes other_pname |> Option.exists ~f:is_private - then report_map + if is_private pattrs || Attributes.load other_pname |> Option.exists ~f:is_private then report_map else let open Domain in let pname = ProcAttributes.get_proc_name pattrs in