[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
master
Nikos Gorogiannis 3 years ago committed by Facebook GitHub Bot
parent aa85648512
commit a1381565f1

@ -336,7 +336,7 @@ let get_run_method_from_runnable tenv runnable =
let get_returned_executor tenv callee actuals = let get_returned_executor tenv callee actuals =
let type_check = let type_check =
lazy lazy
( AnalysisCallbacks.proc_resolve_attributes callee ( Attributes.load callee
|> Option.exists ~f:(fun (attrs : ProcAttributes.t) -> |> Option.exists ~f:(fun (attrs : ProcAttributes.t) ->
match attrs.ret_type.Typ.desc with match attrs.ret_type.Typ.desc with
| Tstruct tname | Typ.Tptr ({desc= Tstruct tname}, _) -> | Tstruct tname | Typ.Tptr ({desc= Tstruct tname}, _) ->

@ -627,7 +627,7 @@ let fold_reportable_summaries analyze_ondemand tenv clazz ~init ~f =
|> Option.value_map ~default:[] ~f:(fun tstruct -> tstruct.Struct.methods) |> Option.value_map ~default:[] ~f:(fun tstruct -> tstruct.Struct.methods)
in in
let f acc mthd = let f acc mthd =
AnalysisCallbacks.proc_resolve_attributes mthd Attributes.load mthd
|> Option.value_map ~default:acc ~f:(fun other_attrs -> |> Option.value_map ~default:acc ~f:(fun other_attrs ->
if should_report other_attrs then if should_report other_attrs then
analyze_ondemand mthd 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 *) [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 let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lock other_pname
other_pair report_map = other_pair report_map =
if if is_private pattrs || Attributes.load other_pname |> Option.exists ~f:is_private then report_map
is_private pattrs
|| AnalysisCallbacks.proc_resolve_attributes other_pname |> Option.exists ~f:is_private
then report_map
else else
let open Domain in let open Domain in
let pname = ProcAttributes.get_proc_name pattrs in let pname = ProcAttributes.get_proc_name pattrs in

Loading…
Cancel
Save