From 65c25cff233b40b02a2591bd31c5ebeb27ed7226 Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Mon, 28 Oct 2019 03:31:15 -0700 Subject: [PATCH] [inferbo] Forget size alias when size changed in model Summary: It should forget size aliases if the size is changed. Reviewed By: ezgicicek Differential Revision: D18083697 fbshipit-source-id: 8b97e0676 --- .../src/bufferoverrun/bufferOverrunDomain.ml | 45 ++++++++++++++++++- .../src/bufferoverrun/bufferOverrunModels.ml | 38 ++++++++-------- infer/src/bufferoverrun/itv.ml | 4 ++ infer/src/bufferoverrun/itv.mli | 6 +-- .../java/bufferoverrun/ArrayListTest.java | 19 ++++++++ .../java/bufferoverrun/issues.exp | 1 + .../java/performance/ArrayListTest.java | 14 ++++++ .../codetoanalyze/java/performance/issues.exp | 30 +++++++------ 8 files changed, 120 insertions(+), 37 deletions(-) diff --git a/infer/src/bufferoverrun/bufferOverrunDomain.ml b/infer/src/bufferoverrun/bufferOverrunDomain.ml index b261e2433..e9154fb27 100644 --- a/infer/src/bufferoverrun/bufferOverrunDomain.ml +++ b/infer/src/bufferoverrun/bufferOverrunDomain.ml @@ -1009,6 +1009,16 @@ module AliasTarget = struct IteratorOffset {alias_typ; l; i= IntLit.(add i minus_one); java_tmp} | _ -> x + + + let incr_or_not_size_alias loc x = + match x with + | Size {l; i} when Loc.equal l loc -> + Size {alias_typ= Le; l; i; java_tmp= None} + | IteratorOffset {l; i; java_tmp} when Loc.equal l loc -> + IteratorOffset {alias_typ= Le; l; i; java_tmp} + | _ -> + x end module AliasMap = struct @@ -1110,6 +1120,19 @@ module AliasMap = struct let incr_size_alias loc = map (AliasTarget.incr_size_alias loc) + let incr_or_not_size_alias loc = map (AliasTarget.incr_or_not_size_alias loc) + + let forget_size_alias arr_locs x = + let not_in_arr_locs _k v = + match v with + | AliasTarget.Size {l} | AliasTarget.IteratorOffset {l} -> + not (PowLoc.mem l arr_locs) + | _ -> + true + in + filter not_in_arr_locs x + + let store_n ~prev loc id n x = match find_id id prev with | Some (AliasTarget.Size {alias_typ; l; i}) -> @@ -1222,9 +1245,16 @@ module Alias = struct a + let update_size_alias locs a ~f = PowLoc.fold f locs a + let incr_size_alias : PowLoc.t -> t -> t = - let incr_size_alias1 loc a = lift_map (AliasMap.incr_size_alias loc) a in - fun locs a -> PowLoc.fold incr_size_alias1 locs a + fun locs a -> + update_size_alias locs a ~f:(fun loc acc -> lift_map (AliasMap.incr_size_alias loc) acc) + + + let incr_or_not_size_alias : PowLoc.t -> t -> t = + fun locs a -> + update_size_alias locs a ~f:(fun loc acc -> lift_map (AliasMap.incr_or_not_size_alias loc) acc) let add_empty_size_alias : Loc.t -> PowLoc.t -> t -> t = @@ -1266,6 +1296,9 @@ module Alias = struct let remove_temp : Ident.t -> t -> t = fun temp -> lift_map (AliasMap.remove (AliasMap.Key.of_id temp)) + + + let forget_size_alias arr_locs = lift_map (AliasMap.forget_size_alias arr_locs) end module CoreVal = struct @@ -1799,6 +1832,8 @@ module MemReach = struct let incr_size_alias locs m = {m with alias= Alias.incr_size_alias locs m.alias} + let incr_or_not_size_alias locs m = {m with alias= Alias.incr_or_not_size_alias locs m.alias} + let add_iterator_offset_alias id m = let arr_locs = let add_arr l v acc = if Itv.is_zero (Val.array_sizeof v) then PowLoc.add l acc else acc in @@ -2024,6 +2059,8 @@ module MemReach = struct {m with stack_locs; mem_pure} + let forget_size_alias arr_locs m = {m with alias= Alias.forget_size_alias arr_locs m.alias} + let init_param_relation : Loc.t -> t -> t = fun loc -> lift_relation (Relation.init_param loc) let init_array_relation : @@ -2196,6 +2233,8 @@ module Mem = struct let incr_size_alias locs = map ~f:(MemReach.incr_size_alias locs) + let incr_or_not_size_alias locs = map ~f:(MemReach.incr_or_not_size_alias locs) + let add_iterator_offset_alias : Ident.t -> t -> t = fun id -> map ~f:(MemReach.add_iterator_offset_alias id) @@ -2306,6 +2345,8 @@ module Mem = struct fun ~formals -> map ~f:(MemReach.forget_unreachable_locs ~formals) + let forget_size_alias arr_locs = map ~f:(MemReach.forget_size_alias arr_locs) + let[@warning "-32"] init_param_relation : Loc.t -> t -> t = fun loc -> map ~f:(MemReach.init_param_relation loc) diff --git a/infer/src/bufferoverrun/bufferOverrunModels.ml b/infer/src/bufferoverrun/bufferOverrunModels.ml index 7b7a90f52..da41cd111 100644 --- a/infer/src/bufferoverrun/bufferOverrunModels.ml +++ b/infer/src/bufferoverrun/bufferOverrunModels.ml @@ -844,36 +844,39 @@ module Collection = struct let change_size_by ~size_f coll_id {location} ~ret:_ mem = - Dom.Mem.transform_mem - ~f:(Dom.Val.transform_array_length location ~f:size_f) - (get_collection_internal_array_locs coll_id mem) - mem + let arr_locs = get_collection_internal_array_locs coll_id mem in + let mem = Dom.Mem.forget_size_alias arr_locs mem in + Dom.Mem.transform_mem ~f:(Dom.Val.transform_array_length location ~f:size_f) arr_locs mem - let add coll_id = - let exec {location} ~ret:_ mem = - let arr_locs = get_collection_internal_array_locs coll_id mem in - Dom.Mem.transform_mem ~f:(Dom.Val.transform_array_length location ~f:Itv.incr) arr_locs mem - |> Dom.Mem.incr_size_alias arr_locs - in - {exec; check= no_check} + let change_size_by_incr coll_id {location} ~ret:_ mem = + let arr_locs = get_collection_internal_array_locs coll_id mem in + Dom.Mem.transform_mem ~f:(Dom.Val.transform_array_length location ~f:Itv.incr) arr_locs mem + |> Dom.Mem.incr_size_alias arr_locs + let change_size_by_incr_or_not coll_id {location} ~ret:_ mem = + let arr_locs = get_collection_internal_array_locs coll_id mem in + Dom.Mem.transform_mem + ~f:(Dom.Val.transform_array_length location ~f:(Itv.plus Itv.zero_one)) + arr_locs mem + |> Dom.Mem.incr_or_not_size_alias arr_locs + + + let add coll_id = {exec= change_size_by_incr coll_id; check= no_check} + let singleton_collection = let exec env ~ret:((id, _) as ret) mem = let {exec= new_exec; check= _} = new_collection in let mem = new_exec env ~ret mem in - change_size_by ~size_f:Itv.incr id ~ret env mem + change_size_by_incr id ~ret env mem in {exec; check= no_check} (** increase the size by [0, 1] because put replaces the value rather than add a new one when the key is found in the map *) - let put coll_id = - let zero_one = Itv.set_lb_zero Itv.one in - {exec= change_size_by ~size_f:(Itv.plus zero_one) coll_id; check= no_check} - + let put coll_id = {exec= change_size_by_incr_or_not coll_id; check= no_check} (* The return value is set by [set_itv_updated_by_addition] in order to be sure that it can be used as a control variable value in the cost checker. *) @@ -982,8 +985,7 @@ module Collection = struct let add_at_index (coll_id : Ident.t) index_exp = - { exec= change_size_by ~size_f:Itv.incr coll_id - ; check= check_index ~last_included:true coll_id index_exp } + {exec= change_size_by_incr coll_id; check= check_index ~last_included:true coll_id index_exp} let remove_at_index coll_id index_exp = diff --git a/infer/src/bufferoverrun/itv.ml b/infer/src/bufferoverrun/itv.ml index 45fc0a896..6980abaa6 100644 --- a/infer/src/bufferoverrun/itv.ml +++ b/infer/src/bufferoverrun/itv.ml @@ -139,6 +139,8 @@ module ItvPure = struct let zero = of_bound Bound.zero + let zero_one = (Bound.zero, Bound.one) + let get_iterator_itv = set_lb_zero let true_sem = one @@ -522,6 +524,8 @@ let unknown_bool = NonBottom ItvPure.unknown_bool let zero = NonBottom ItvPure.zero +let zero_one = NonBottom ItvPure.zero_one + let of_bool = function | Boolean.Bottom -> bot diff --git a/infer/src/bufferoverrun/itv.mli b/infer/src/bufferoverrun/itv.mli index 6b24aa78f..3165d4604 100644 --- a/infer/src/bufferoverrun/itv.mli +++ b/infer/src/bufferoverrun/itv.mli @@ -120,9 +120,6 @@ val m1_255 : t val nat : t (** [0, +oo] *) -val one : t -(** 1 *) - val pos : t (** [1, +oo] *) @@ -132,6 +129,9 @@ val top : t val zero : t (** 0 *) +val zero_one : t +(** [0, 1] *) + val unknown_bool : t (** [0, 1] *) diff --git a/infer/tests/codetoanalyze/java/bufferoverrun/ArrayListTest.java b/infer/tests/codetoanalyze/java/bufferoverrun/ArrayListTest.java index 0b5adf34d..447342d20 100644 --- a/infer/tests/codetoanalyze/java/bufferoverrun/ArrayListTest.java +++ b/infer/tests/codetoanalyze/java/bufferoverrun/ArrayListTest.java @@ -140,4 +140,23 @@ class ArrayListTest { } // a.size should be [0, b.size] int j = b.get(a.size()); } + + void add_and_remove_ok(ArrayList a) { + ArrayList b = new ArrayList(); + b.add(0); + for (Integer i : a) { + b.add(0); + b.remove(0); + } // b.size is one here + int j = b.get(0); + } + + void add_and_remove_bad(ArrayList a) { + ArrayList b = new ArrayList(); + for (Integer i : a) { + b.add(0); + b.remove(0); + } // b.size is zero here + int j = b.get(0); + } } diff --git a/infer/tests/codetoanalyze/java/bufferoverrun/issues.exp b/infer/tests/codetoanalyze/java/bufferoverrun/issues.exp index df9f7fedf..464aaa77d 100644 --- a/infer/tests/codetoanalyze/java/bufferoverrun/issues.exp +++ b/infer/tests/codetoanalyze/java/bufferoverrun/issues.exp @@ -7,6 +7,7 @@ codetoanalyze/java/bufferoverrun/Array.java, codetoanalyze.java.bufferoverrun.Ar codetoanalyze/java/bufferoverrun/Array.java, codetoanalyze.java.bufferoverrun.Array.null_pruning2_Bad():void, 4, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 10 Size: 5] codetoanalyze/java/bufferoverrun/Array.java, codetoanalyze.java.bufferoverrun.Array.null_pruning2_Good_FP():void, 4, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 10 Size: 5] codetoanalyze/java/bufferoverrun/Array.java, codetoanalyze.java.bufferoverrun.Array.prune_assign_exp_Bad():void, 4, BUFFER_OVERRUN_L2, no_bucket, ERROR, [,Call,Assignment,Assignment,Assignment,Assignment,,Array declaration,Array access: Offset: [0, 4] Size: 3] +codetoanalyze/java/bufferoverrun/ArrayListTest.java, ArrayListTest.add_and_remove_bad(java.util.ArrayList):void, 6, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 0 Size: 0] codetoanalyze/java/bufferoverrun/ArrayListTest.java, ArrayListTest.add_in_loop_bad():void, 5, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 6 Size: 5] codetoanalyze/java/bufferoverrun/ArrayListTest.java, ArrayListTest.add_in_loop_by_param2_bad(java.util.ArrayList):void, 7, BUFFER_OVERRUN_L2, no_bucket, ERROR, [,Array declaration,Assignment,,Assignment,Array declaration,Array access: Offset: [0, b.length] Size: b.length] codetoanalyze/java/bufferoverrun/ArrayListTest.java, ArrayListTest.add_in_loop_by_param_bad(java.util.ArrayList):void, 5, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Assignment,Array declaration,Assignment,,Parameter `b.elements[*]`,Assignment,Array declaration,Array access: Offset: b.length + 1 Size: b.length] diff --git a/infer/tests/codetoanalyze/java/performance/ArrayListTest.java b/infer/tests/codetoanalyze/java/performance/ArrayListTest.java index 6d3c9324c..8756eee10 100644 --- a/infer/tests/codetoanalyze/java/performance/ArrayListTest.java +++ b/infer/tests/codetoanalyze/java/performance/ArrayListTest.java @@ -6,6 +6,7 @@ */ import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; public class ArrayListTest { @@ -292,6 +293,19 @@ public class ArrayListTest { } } } + + public static HashMap init_with_put_linear(ArrayList a) { + HashMap m = new HashMap<>(); + for (Integer i : a) { + m.put(i, i); + } + return m; + } + + public static void call_init_with_put_linear(ArrayList a) { + HashMap m = init_with_put_linear(a); + for (HashMap.Entry e : m.entrySet()) {} + } } class LexicographicComparator implements java.util.Comparator { diff --git a/infer/tests/codetoanalyze/java/performance/issues.exp b/infer/tests/codetoanalyze/java/performance/issues.exp index 3fb843a6b..84efd78c4 100644 --- a/infer/tests/codetoanalyze/java/performance/issues.exp +++ b/infer/tests/codetoanalyze/java/performance/issues.exp @@ -29,23 +29,25 @@ codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_remov codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_remove_overrun_bad():void, 3, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Through,Array access: Offset: 1 Size: 1] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_set_overrun_bad():void, 3, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Through,Array access: Offset: 1 Size: 1] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.arraylist_set_underrun_bad():void, 2, BUFFER_OVERRUN_L1, no_bucket, ERROR, [,Array declaration,Array access: Offset: 0 Size: 0] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.boolean_control_var_linear():void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 19 ⋅ this.arr.length + 4 ⋅ (this.arr.length + 1), O(this.arr.length), degree = 1,{this.arr.length + 1},Loop at line 289,{this.arr.length},Loop at line 289] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.boolean_control_var_linear():void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 19 ⋅ this.arr.length + 4 ⋅ (this.arr.length + 1), O(this.arr.length), degree = 1,{this.arr.length + 1},Loop at line 290,{this.arr.length},Loop at line 290] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.call_init_with_put_linear(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 13 + 16 ⋅ (a.length + 1), O(a.length), degree = 1,{a.length + 1},call to HashMap ArrayListTest.init_with_put_linear(ArrayList),Loop at line 299] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.call_sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + list.length × log(list.length), O(list.length × log(list.length)), degree = 1 + 1⋅log,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to Collections.sort,{list.length},call to void ArrayListTest.sortArrayList(ArrayList),Modeled call to Collections.sort] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), O((l.length + list.length)), degree = 1,{l.length + list.length + 1},Loop at line 239,{l.length + list.length},Loop at line 239] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all_sym(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), O((l.length + list.length)), degree = 1,{l.length + list.length + 1},Loop at line 246,{l.length + list.length},Loop at line 246] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_linear(java.util.ArrayList):void, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 6 + 5 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 221,{list.length},Loop at line 221] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_modify(java.util.ArrayList):void, 8, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 18 + 5 ⋅ (list.length + 4) + 3 ⋅ (list.length + 5), O(list.length), degree = 1,{list.length + 5},Loop at line 232,{list.length + 4},Loop at line 232] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), O((l.length + list.length)), degree = 1,{l.length + list.length + 1},Loop at line 240,{l.length + list.length},Loop at line 240] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_add_all_sym(java.util.ArrayList,java.util.ArrayList):void, 4, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 10 + 5 ⋅ (l.length + list.length) + 3 ⋅ (l.length + list.length + 1), O((l.length + list.length)), degree = 1,{l.length + list.length + 1},Loop at line 247,{l.length + list.length},Loop at line 247] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_linear(java.util.ArrayList):void, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 6 + 5 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 222,{list.length},Loop at line 222] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.constructor_modify(java.util.ArrayList):void, 8, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 18 + 5 ⋅ (list.length + 4) + 3 ⋅ (list.length + 5), O(list.length), degree = 1,{list.length + 5},Loop at line 233,{list.length + 4},Loop at line 233] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.empty_list_constant(int):void, 3, CONDITION_ALWAYS_FALSE, no_bucket, WARNING, [Here] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 5 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},Loop at line 14] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist_shortcut_FP(java.util.ArrayList):boolean, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 11 ⋅ list.length + 2 ⋅ list.length × (11-max(10, list.elements)) + 3 ⋅ (list.length + 1) × (11-max(10, list.elements)), O(list.length × (-list.elements + 11)), degree = 2,{11-max(10, list.elements)},Loop at line 187,{list.length + 1},Loop at line 187,{11-max(10, list.elements)},Loop at line 187,{list.length},Loop at line 187] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist_with_inner(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 7 + 14 ⋅ (list1.length + 1), O(list1.length), degree = 1,{list1.length + 1},Loop at line 178] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_local_arraylist(java.util.ArrayList):void, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 7 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},Loop at line 19] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_while_has_next(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 10 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 170,{list.length},Loop at line 170] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_with_iterator(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 8 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 164,{list.length},Loop at line 164] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.json_array_constructor_linear(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 6 + 5 ⋅ arr.length + 3 ⋅ (arr.length + 1), O(arr.length), degree = 1,{arr.length + 1},Loop at line 266,{arr.length},Loop at line 266] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.linear(int,java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 9 ⋅ (-i + a.length + 1), O((-i + a.length)), degree = 1,{-i + a.length + 1},Loop at line 273] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.init_with_put_linear(java.util.ArrayList):java.util.HashMap, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 7 + 16 ⋅ (a.length + 1), O(a.length), degree = 1,{a.length + 1},Loop at line 299] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 5 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},Loop at line 15] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist_shortcut_FP(java.util.ArrayList):boolean, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 11 ⋅ list.length + 2 ⋅ list.length × (11-max(10, list.elements)) + 3 ⋅ (list.length + 1) × (11-max(10, list.elements)), O(list.length × (-list.elements + 11)), degree = 2,{11-max(10, list.elements)},Loop at line 188,{list.length + 1},Loop at line 188,{11-max(10, list.elements)},Loop at line 188,{list.length},Loop at line 188] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_arraylist_with_inner(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 7 + 14 ⋅ (list1.length + 1), O(list1.length), degree = 1,{list1.length + 1},Loop at line 179] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_over_local_arraylist(java.util.ArrayList):void, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 7 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},Loop at line 20] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_while_has_next(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 10 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 171,{list.length},Loop at line 171] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.iterate_with_iterator(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 8 ⋅ list.length + 3 ⋅ (list.length + 1), O(list.length), degree = 1,{list.length + 1},Loop at line 165,{list.length},Loop at line 165] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.json_array_constructor_linear(java.util.ArrayList):void, 3, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 6 + 5 ⋅ arr.length + 3 ⋅ (arr.length + 1), O(arr.length), degree = 1,{arr.length + 1},Loop at line 267,{arr.length},Loop at line 267] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.linear(int,java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 9 ⋅ (-i + a.length + 1), O((-i + a.length)), degree = 1,{-i + a.length + 1},Loop at line 274] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.max_linear(java.util.ArrayList):Person, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 8 + people.length, O(people.length), degree = 1,{people.length},Modeled call to Collections.max] -codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.remove_string_from_list(java.lang.String):boolean, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 5 + 12 ⋅ this.list.length + 3 ⋅ (this.list.length + 1), O(this.list.length), degree = 1,{this.list.length + 1},Loop at line 210,{this.list.length},Loop at line 210] +codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.remove_string_from_list(java.lang.String):boolean, 2, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 5 + 12 ⋅ this.list.length + 3 ⋅ (this.list.length + 1), O(this.list.length), degree = 1,{this.list.length + 1},Loop at line 211,{this.list.length},Loop at line 211] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sortArrayList(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + list.length × log(list.length), O(list.length × log(list.length)), degree = 1 + 1⋅log,{list.length},Modeled call to Collections.sort,{list.length},Modeled call to Collections.sort] codetoanalyze/java/performance/ArrayListTest.java, ArrayListTest.sort_comparator_nlogn(java.util.ArrayList):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 8 + people.length × log(people.length), O(people.length × log(people.length)), degree = 1 + 1⋅log,{people.length},Modeled call to Collections.sort,{people.length},Modeled call to Collections.sort] codetoanalyze/java/performance/Break.java, codetoanalyze.java.performance.Break.break_constant(int):int, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 10 + 7 ⋅ p, O(p), degree = 1,{p},call to int Break.break_loop(int,int),Loop at line 12]