[cost] Add a test (recursive dependency in class initializers)

Reviewed By: jvillard

Differential Revision: D20389989

fbshipit-source-id: a89d7c478
master
Sungkeun Cho 5 years ago committed by Facebook GitHub Bot
parent 769c221826
commit bc0c060bd4

@ -69,4 +69,27 @@ public class CollectionTest {
new_arr.put(1, 1);
for (int i = 0; i < new_arr.size(); i++) {}
}
static class Dummy {}
public enum MyEnumType {
/* The elements of enum is initialized in `<clinit>`. */
A(1);
public final int mValue;
private MyEnumType(int i) {
mValue = i;
}
/* This field is also initialized in `<clinit>`, in which `<init>` is called. */
private static Dummy s =
new Dummy() {
{
/* This loop is in `<init>` function. It needs the results of `<clinit>` in order to
get `MyEnumType.values()`. */
for (MyEnumType type : MyEnumType.values()) {}
}
};
}
}

@ -60,6 +60,9 @@ codetoanalyze/java/performance/CantHandle.java, CantHandle.square_root_FP(int):v
codetoanalyze/java/performance/CantHandle.java, CantHandle.square_root_FP(int):void, 2, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Assignment,Binary operation: ([0, +oo] + 1):signed32]
codetoanalyze/java/performance/CantHandle.java, CantHandle.square_root_variant_FP(int):void, 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Unbounded loop,Loop at line 25]
codetoanalyze/java/performance/CantHandle.java, CantHandle.square_root_variant_FP(int):void, 2, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Assignment,Binary operation: ([0, +oo] + 1):signed32]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest$MyEnumType$1.<init>(), 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Unbounded loop,Loop at line 91]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest$MyEnumType$1.<init>(), 4, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Assignment,Binary operation: ([0, +oo] + 1):signed32]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest$MyEnumType.<clinit>():void, 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Call to CollectionTest$MyEnumType$1.<init>(),Unbounded loop,Loop at line 91]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest.ensure_call(CollectionTest$MyCollection):void, 0, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 11 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},call to void CollectionTest.iterate_over_mycollection(CollectionTest$MyCollection),Loop at line 17]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest.iterate_over_call_quad(int,CollectionTest$MyCollection):void, 0, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 4 + 18 ⋅ list.length + 5 ⋅ list.length × list.length + 3 ⋅ (list.length + 1), O(list.length × list.length), degree = 2,{list.length + 1},Loop at line 48,{list.length},call to void CollectionTest.iterate_over_mycollection(CollectionTest$MyCollection),Loop at line 17,{list.length},Loop at line 48]
codetoanalyze/java/performance/CollectionTest.java, CollectionTest.iterate_over_mycollection(CollectionTest$MyCollection):void, 0, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 5 + 5 ⋅ list.length, O(list.length), degree = 1,{list.length},Loop at line 17]

Loading…
Cancel
Save