Reviewed By: ezgicicek Differential Revision: D13175881 fbshipit-source-id: 7718bdf0dmaster
parent
2ebbf554e5
commit
85bab87d16
@ -0,0 +1,40 @@
|
||||
(*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*)
|
||||
|
||||
open! IStd
|
||||
module BasicCost = CostDomain.BasicCost
|
||||
|
||||
type model = BufferOverrunDomain.Mem.t -> BasicCost.t
|
||||
|
||||
module Collections = struct
|
||||
let eval_collection_length coll_exp inferbo_mem =
|
||||
let upper_bound =
|
||||
let itv =
|
||||
BufferOverrunModels.Collection.eval_collection_length coll_exp inferbo_mem
|
||||
|> BufferOverrunDomain.Val.get_itv
|
||||
in
|
||||
match itv with Bottom -> Bounds.Bound.PInf | NonBottom itv_pure -> Itv.ItvPure.ub itv_pure
|
||||
in
|
||||
Bounds.NonNegativeBound.of_bound upper_bound
|
||||
|
||||
|
||||
let n_log_n b =
|
||||
let n = BasicCost.of_non_negative_bound b in
|
||||
let log_n = BasicCost.of_non_negative_bound ~degree_kind:Polynomials.DegreeKind.Log b in
|
||||
BasicCost.mult n log_n
|
||||
|
||||
|
||||
let sort coll_exp inferbo_mem =
|
||||
let length = eval_collection_length coll_exp inferbo_mem in
|
||||
n_log_n length
|
||||
end
|
||||
|
||||
module Call = struct
|
||||
let dispatch : (unit, model) ProcnameDispatcher.Call.dispatcher =
|
||||
let open ProcnameDispatcher.Call in
|
||||
make_dispatcher [-"java.util.Collections" &:: "sort" $ capt_exp $--> Collections.sort]
|
||||
end
|
@ -1 +1 @@
|
||||
{"top":{"current":1,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":3,"previous":2},{"degree":100,"current":1,"previous":1},{"degree":200,"current":0,"previous":1}]}
|
||||
{"top":{"current":1,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":3,"previous":2},{"degree":100,"current":1,"previous":2},{"degree":101,"current":2,"previous":0},{"degree":200,"current":0,"previous":2}]}
|
@ -0,0 +1 @@
|
||||
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f6(java.util.ArrayList):void, 0
|
@ -1,2 +1,3 @@
|
||||
INFINITE_EXECUTION_TIME_CALL, no_bucket, src/DiffExample.java, DiffExample.f1(int):void, 0
|
||||
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f4(int):int, 0
|
||||
PERFORMANCE_VARIATION, no_bucket, src/DiffExample.java, DiffExample.f5(java.util.ArrayList):void, 0
|
||||
|
Loading…
Reference in new issue