From 8521d7590ad540abb1d6baae65004cff718245db Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Thu, 4 Oct 2018 05:49:02 -0700 Subject: [PATCH] [starvation] allow propagation of order constraints to any class Summary: An order constraint (A,B) means we take lock A and before releasing it we perform B (whatever that is). Previously if a method call crossed class boundaries, we removed the callee's order constraints before integrating the callee's summary to that of the caller. The reasoning was that this may lead to reports blaming a caller for something they are very far from, plus a proliferation of reports with the same bad endpoint. The first reason still applies, but this is a general problem. It may be better to report and let developers deal with it. The second reason is moot, since in differential mode most of these reports are hidden. Reviewed By: jberdine Differential Revision: D10173200 fbshipit-source-id: 9afbf292c --- infer/src/concurrency/starvation.ml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvation.ml index e41dcce29..b7459e5eb 100644 --- a/infer/src/concurrency/starvation.ml +++ b/infer/src/concurrency/starvation.ml @@ -48,16 +48,6 @@ let lock_of_class class_id = AccessPath.of_id ident typ' -let is_call_to_superclass tenv ~caller ~callee = - match (caller, callee) with - | Typ.Procname.Java caller_method, Typ.Procname.Java callee_method -> - let caller_type = Typ.Procname.Java.get_class_type_name caller_method in - let callee_type = Typ.Procname.Java.get_class_type_name callee_method in - PatternMatch.is_subtype tenv caller_type callee_type - | _ -> - L.(die InternalError "Not supposed to run on non-Java code.") - - module TransferFunctions (CFG : ProcCfg.S) = struct module CFG = CFG module Domain = StarvationDomain @@ -116,15 +106,8 @@ module TransferFunctions (CFG : ProcCfg.S) = struct Domain.blocking_call ~caller ~callee sev loc astate | None -> Payload.read pdesc callee - |> Option.value_map ~default:astate ~f:(fun summary -> - (* if not calling a method in a superclass then set order to empty - to avoid blaming a caller in one class for deadlock/starvation - happening in the callee class *) - let summary = - if is_call_to_superclass tenv ~caller ~callee then summary - else {summary with Domain.order= Domain.OrderDomain.empty} - in - Domain.integrate_summary astate callee loc summary ) ) ) + |> Option.value_map ~default:astate ~f:(Domain.integrate_summary astate callee loc) ) + ) | _ -> astate