[cost] Suppress reports on Java access methods

Reviewed By: ngorogiannis

Differential Revision: D15696182

fbshipit-source-id: 2f84789a7
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent d3cf79a095
commit 99bc7363bf

@ -1005,6 +1005,10 @@ module Procname = struct
is_c_function name
let is_java_access_method pname =
match pname with Java java_pname -> Java.is_access_method java_pname | _ -> false
let is_objc_method procname =
match procname with ObjC_Cpp name -> ObjC_Cpp.is_objc_method name | _ -> false

@ -519,6 +519,8 @@ being the name of the struct, [None] means the parameter is of some other type.
val parameter_of_name : t -> Name.t -> Parameter.t
val is_java_access_method : t -> bool
val is_objc_method : t -> bool
(** Hash tables with proc names as keys. *)

@ -342,7 +342,7 @@ module JsonCostsPrinter = MakeJsonListPrinter (struct
let to_string {loc; proc_name; cost_opt} =
match cost_opt with
| Some {post} ->
| Some {post} when not (Typ.Procname.is_java_access_method proc_name) ->
let basic_operation_cost = CostDomain.get_operation_cost post in
let degree_with_term = CostDomain.BasicCost.get_degree_with_term basic_operation_cost in
let hum =
@ -367,7 +367,7 @@ module JsonCostsPrinter = MakeJsonListPrinter (struct
; hum }
in
Some (Jsonbug_j.string_of_cost_item cost_item)
| None ->
| _ ->
None
end)

@ -762,6 +762,8 @@ module Check = struct
let check_and_report WorstCaseCost.{costs; reports} proc_desc summary =
let pname = Procdesc.get_proc_name proc_desc in
if not (Typ.Procname.is_java_access_method pname) then (
CostDomain.CostKindMap.iter2 ReportConfig.as_map reports
~f:(fun kind ReportConfig.{name; threshold} -> function
| ThresholdReports.Threshold _ ->
@ -771,7 +773,7 @@ module Check = struct
~threshold:(Option.value_exn threshold) ~kind ) ;
CostDomain.CostKindMap.iter2 ReportConfig.as_map costs
~f:(fun _kind ReportConfig.{name; top_and_bottom} cost ->
if top_and_bottom then report_top_and_bottom proc_desc summary ~name ~cost )
if top_and_bottom then report_top_and_bottom proc_desc summary ~name ~cost ) )
end
type bound_map = BasicCost.t Node.IdMap.t

@ -1 +1 @@
{"top":{"current":4,"previous":2},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":7,"previous":7},{"degree":100,"current":2,"previous":4},{"degree":101,"current":4,"previous":0},{"degree":200,"current":3,"previous":4}]}
{"top":{"current":4,"previous":2},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":7,"previous":6},{"degree":100,"current":2,"previous":4},{"degree":101,"current":4,"previous":0},{"degree":200,"current":2,"previous":4}]}

@ -1,5 +1,4 @@
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample$1.toString():java.lang.String, 0, [Updated Cost is 16 + 13 ⋅ this.this$0.z + 5 ⋅ this.this$0.z × this.this$0.z (degree is 2),{this.this$0.z},call to void DiffExample.f8(int),call to int DiffExample.f4(int),Loop at line 57,{this.this$0.z},call to void DiffExample.f8(int),Loop at line 79]
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.access$000(int):void, 0, [Updated Cost is 7 + 13 ⋅ x0 + 5 ⋅ x0 × x0 (degree is 2),{x0},call to void DiffExample.f8(int),call to int DiffExample.f4(int),Loop at line 57,{x0},call to void DiffExample.f8(int),Loop at line 79]
INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f1(int):void, 0, [Unbounded loop,Loop at line 38]
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f4(int):int, 0, [Updated Cost is 6 + 5 ⋅ k (degree is 1),{k},Loop at line 57]
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f5(java.util.ArrayList):void, 0, [Updated Cost is 2 + list.length × log(list.length) (degree is 1 + 1⋅log),{list.length},Modeled call to Collections.sort,{list.length},Modeled call to Collections.sort]

Loading…
Cancel
Save