[starvation][whole-program] gate analysis of constructors

Summary: In whole-program mode, analysing a method requires analysing first all constructors of the same class.  This is not needed in normal mode, so gate that computation under `starvation_whole_program` for efficiency.

Reviewed By: artempyanykh

Differential Revision: D19393412

fbshipit-source-id: 2277e6b5e
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent 4322701ecf
commit c5a8f2e454

@ -329,21 +329,23 @@ let set_constructor_attributes tenv procname (astate : Domain.t) =
let set_initial_attributes tenv procname astate =
match procname with
| Procname.Java java_pname when Procname.Java.is_class_initializer java_pname ->
(* we are analyzing the class initializer, don't go through on-demand again *)
astate
| Procname.Java java_pname when Procname.Java.(is_constructor java_pname || is_static java_pname)
->
(* analyzing a constructor or static method, so we need the attributes established by the
class initializer *)
set_class_init_attributes procname astate
| Procname.Java _ ->
(* we are analyzing an instance method, so we need constructor-established attributes
which will include those by the class initializer *)
set_constructor_attributes tenv procname astate
| _ ->
astate
if not Config.starvation_whole_program then astate
else
match procname with
| Procname.Java java_pname when Procname.Java.is_class_initializer java_pname ->
(* we are analyzing the class initializer, don't go through on-demand again *)
astate
| Procname.Java java_pname
when Procname.Java.(is_constructor java_pname || is_static java_pname) ->
(* analyzing a constructor or static method, so we need the attributes established by the
class initializer *)
set_class_init_attributes procname astate
| Procname.Java _ ->
(* we are analyzing an instance method, so we need constructor-established attributes
which will include those by the class initializer *)
set_constructor_attributes tenv procname astate
| _ ->
astate
let analyze_procedure {Callbacks.exe_env; summary} =

Loading…
Cancel
Save