From 567fa3f9555d269a5f9c4010c9b5a7adf304bcee Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Fri, 23 Jul 2021 02:29:12 -0700 Subject: [PATCH] [attrs] look at capture DB only -- cost Summary: `AnalysisCallbacks.proc_resolve_attributes` introduces non-determinism because it first looks for the attributes in a (procdesc in a) summary and if it doesn't find it then returns the value in the attribute column 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 in some cases. The plan is to eliminate these calls one by one, replacing with `Attributes.load` which only looks at the capture DB attribute column. Reviewed By: skcho Differential Revision: D29816458 fbshipit-source-id: 681c55f4c --- infer/src/cost/cost.ml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/infer/src/cost/cost.ml b/infer/src/cost/cost.ml index 11829ba75..a281bf691 100644 --- a/infer/src/cost/cost.ml +++ b/infer/src/cost/cost.ml @@ -435,9 +435,7 @@ let checker ({InterproceduralAnalysis.proc_desc; exe_env; analyze_dependency} as let* _cost_summary, inferbo_summary, _ = get_summary_common callee_pname in inferbo_summary in - let get_formals callee_pname = - AnalysisCallbacks.proc_resolve_attributes callee_pname >>| Pvar.get_pvar_formals - in + let get_formals callee_pname = Attributes.load callee_pname >>| Pvar.get_pvar_formals in let instr_cfg = InstrCFG.from_pdesc proc_desc in let extras = { inferbo_invariant_map @@ -447,7 +445,7 @@ let checker ({InterproceduralAnalysis.proc_desc; exe_env; analyze_dependency} as ; get_summary ; get_formals ; get_proc_desc= AnalysisCallbacks.get_proc_desc - ; proc_resolve_attributes= AnalysisCallbacks.proc_resolve_attributes } + ; proc_resolve_attributes= Attributes.load } in AnalysisCallbacks.html_debug_new_node_session (NodeCFG.start_node node_cfg) ~pp_name:(fun f -> F.pp_print_string f "cost(worst-case)")