diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/141-class-unload/expected.txt | 5 | ||||
| -rw-r--r-- | test/141-class-unload/src-ex/IntHolder.java | 4 | ||||
| -rw-r--r-- | test/141-class-unload/src/Main.java | 12 | ||||
| -rw-r--r-- | test/449-checker-bce/src/Main.java | 26 | ||||
| -rw-r--r-- | test/458-checker-instruction-simplification/src/Main.java | 174 | ||||
| -rw-r--r-- | test/466-get-live-vreg/get_live_vreg_jni.cc | 4 | ||||
| -rw-r--r-- | test/530-checker-loops/src/Main.java | 102 | ||||
| -rw-r--r-- | test/532-checker-nonnull-arrayset/expected.txt | 0 | ||||
| -rw-r--r-- | test/532-checker-nonnull-arrayset/info.txt | 1 | ||||
| -rw-r--r-- | test/532-checker-nonnull-arrayset/src/Main.java | 39 | ||||
| -rw-r--r-- | test/533-regression-debugphi/expected.txt | 0 | ||||
| -rw-r--r-- | test/533-regression-debugphi/info.txt | 2 | ||||
| -rw-r--r-- | test/533-regression-debugphi/smali/TestCase.smali | 72 | ||||
| -rw-r--r-- | test/533-regression-debugphi/src/Main.java | 22 | ||||
| -rw-r--r-- | test/534-checker-bce-deoptimization/expected.txt | 1 | ||||
| -rw-r--r-- | test/534-checker-bce-deoptimization/info.txt | 8 | ||||
| -rw-r--r-- | test/534-checker-bce-deoptimization/src/Main.java | 57 | ||||
| -rw-r--r-- | test/Android.run-test.mk | 70 |
18 files changed, 572 insertions, 27 deletions
diff --git a/test/141-class-unload/expected.txt b/test/141-class-unload/expected.txt index ff65a70b12..53d7abecaf 100644 --- a/test/141-class-unload/expected.txt +++ b/test/141-class-unload/expected.txt @@ -16,3 +16,8 @@ loader null false JNI_OnLoad called JNI_OnUnload called null +1 +2 +JNI_OnLoad called +class null false test +JNI_OnUnload called diff --git a/test/141-class-unload/src-ex/IntHolder.java b/test/141-class-unload/src-ex/IntHolder.java index e4aa6b8949..feff0d2ba1 100644 --- a/test/141-class-unload/src-ex/IntHolder.java +++ b/test/141-class-unload/src-ex/IntHolder.java @@ -36,4 +36,8 @@ public class IntHolder { } public static native void waitForCompilation(); + + public static Throwable generateStackTrace() { + return new Exception("test"); + } } diff --git a/test/141-class-unload/src/Main.java b/test/141-class-unload/src/Main.java index 105a2b981c..3cc43accbe 100644 --- a/test/141-class-unload/src/Main.java +++ b/test/141-class-unload/src/Main.java @@ -39,6 +39,8 @@ public class Main { testNoUnloadInstance(constructor); // Test JNI_OnLoad and JNI_OnUnload. testLoadAndUnloadLibrary(constructor); + // Test that stack traces keep the classes live. + testStackTrace(constructor); // Stress test to make sure we dont leak memory. stressTest(constructor); } catch (Exception e) { @@ -75,6 +77,16 @@ public class Main { System.out.println(loader.get()); } + private static void testStackTrace(Constructor constructor) throws Exception { + WeakReference<Class> klass = setUpUnloadClass(constructor); + Method stackTraceMethod = klass.get().getDeclaredMethod("generateStackTrace"); + Throwable throwable = (Throwable) stackTraceMethod.invoke(klass.get()); + stackTraceMethod = null; + Runtime.getRuntime().gc(); + boolean isNull = klass.get() == null; + System.out.println("class null " + isNull + " " + throwable.getMessage()); + } + private static void testLoadAndUnloadLibrary(Constructor constructor) throws Exception { WeakReference<ClassLoader> loader = setUpLoadLibrary(constructor); // No strong refernces to class loader, should get unloaded. diff --git a/test/449-checker-bce/src/Main.java b/test/449-checker-bce/src/Main.java index a746664160..f06c250dc7 100644 --- a/test/449-checker-bce/src/Main.java +++ b/test/449-checker-bce/src/Main.java @@ -249,6 +249,25 @@ public class Main { array[Integer.MAX_VALUE - 998] = 1; } + /// CHECK-START: void Main.constantIndexing6(int[]) BCE (before) + /// CHECK: BoundsCheck + /// CHECK: ArraySet + /// CHECK: BoundsCheck + /// CHECK: ArraySet + + /// CHECK-START: void Main.constantIndexing6(int[]) BCE (after) + /// CHECK: Deoptimize + + static void constantIndexing6(int[] array) { + array[3] = 1; + array[4] = 1; + } + + // A helper into which the actual throwing function should be inlined. + static void constantIndexingForward6(int[] array) { + constantIndexing6(array); + } + /// CHECK-START: void Main.loopPattern1(int[]) BCE (before) /// CHECK: BoundsCheck /// CHECK: ArraySet @@ -602,7 +621,12 @@ public class Main { // This will cause AIOOBE. constantIndexing2(new int[3]); } catch (ArrayIndexOutOfBoundsException e) { - return 99; + try { + // This will cause AIOOBE. + constantIndexingForward6(new int[3]); + } catch (ArrayIndexOutOfBoundsException e2) { + return 99; + } } return 0; } diff --git a/test/458-checker-instruction-simplification/src/Main.java b/test/458-checker-instruction-simplification/src/Main.java index a14200e7ce..c32d34aa6f 100644 --- a/test/458-checker-instruction-simplification/src/Main.java +++ b/test/458-checker-instruction-simplification/src/Main.java @@ -84,6 +84,172 @@ public class Main { return arg & -1; } + /// CHECK-START: int Main.UShr28And15(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const28:i\d+>> IntConstant 28 + /// CHECK-DAG: <<Const15:i\d+>> IntConstant 15 + /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Arg>>,<<Const28>>] + /// CHECK-DAG: <<And:i\d+>> And [<<UShr>>,<<Const15>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: int Main.UShr28And15(int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const28:i\d+>> IntConstant 28 + /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Arg>>,<<Const28>>] + /// CHECK-DAG: Return [<<UShr>>] + + /// CHECK-START: int Main.UShr28And15(int) instruction_simplifier (after) + /// CHECK-NOT: And + + public static int UShr28And15(int arg) { + return (arg >>> 28) & 15; + } + + /// CHECK-START: long Main.UShr60And15(long) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const60:i\d+>> IntConstant 60 + /// CHECK-DAG: <<Const15:j\d+>> LongConstant 15 + /// CHECK-DAG: <<UShr:j\d+>> UShr [<<Arg>>,<<Const60>>] + /// CHECK-DAG: <<And:j\d+>> And [<<UShr>>,<<Const15>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: long Main.UShr60And15(long) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const60:i\d+>> IntConstant 60 + /// CHECK-DAG: <<UShr:j\d+>> UShr [<<Arg>>,<<Const60>>] + /// CHECK-DAG: Return [<<UShr>>] + + /// CHECK-START: long Main.UShr60And15(long) instruction_simplifier (after) + /// CHECK-NOT: And + + public static long UShr60And15(long arg) { + return (arg >>> 60) & 15; + } + + /// CHECK-START: int Main.UShr28And7(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const28:i\d+>> IntConstant 28 + /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7 + /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Arg>>,<<Const28>>] + /// CHECK-DAG: <<And:i\d+>> And [<<UShr>>,<<Const7>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: int Main.UShr28And7(int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const28:i\d+>> IntConstant 28 + /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7 + /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Arg>>,<<Const28>>] + /// CHECK-DAG: <<And:i\d+>> And [<<UShr>>,<<Const7>>] + /// CHECK-DAG: Return [<<And>>] + + public static int UShr28And7(int arg) { + return (arg >>> 28) & 7; + } + + /// CHECK-START: long Main.UShr60And7(long) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const60:i\d+>> IntConstant 60 + /// CHECK-DAG: <<Const7:j\d+>> LongConstant 7 + /// CHECK-DAG: <<UShr:j\d+>> UShr [<<Arg>>,<<Const60>>] + /// CHECK-DAG: <<And:j\d+>> And [<<UShr>>,<<Const7>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: long Main.UShr60And7(long) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const60:i\d+>> IntConstant 60 + /// CHECK-DAG: <<Const7:j\d+>> LongConstant 7 + /// CHECK-DAG: <<UShr:j\d+>> UShr [<<Arg>>,<<Const60>>] + /// CHECK-DAG: <<And:j\d+>> And [<<UShr>>,<<Const7>>] + /// CHECK-DAG: Return [<<And>>] + + public static long UShr60And7(long arg) { + return (arg >>> 60) & 7; + } + + /// CHECK-START: int Main.Shr24And255(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const24:i\d+>> IntConstant 24 + /// CHECK-DAG: <<Const255:i\d+>> IntConstant 255 + /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Arg>>,<<Const24>>] + /// CHECK-DAG: <<And:i\d+>> And [<<Shr>>,<<Const255>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: int Main.Shr24And255(int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const24:i\d+>> IntConstant 24 + /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Arg>>,<<Const24>>] + /// CHECK-DAG: Return [<<UShr>>] + + /// CHECK-START: int Main.Shr24And255(int) instruction_simplifier (after) + /// CHECK-NOT: Shr + /// CHECK-NOT: And + + public static int Shr24And255(int arg) { + return (arg >> 24) & 255; + } + + /// CHECK-START: long Main.Shr56And255(long) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const56:i\d+>> IntConstant 56 + /// CHECK-DAG: <<Const255:j\d+>> LongConstant 255 + /// CHECK-DAG: <<Shr:j\d+>> Shr [<<Arg>>,<<Const56>>] + /// CHECK-DAG: <<And:j\d+>> And [<<Shr>>,<<Const255>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: long Main.Shr56And255(long) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const56:i\d+>> IntConstant 56 + /// CHECK-DAG: <<UShr:j\d+>> UShr [<<Arg>>,<<Const56>>] + /// CHECK-DAG: Return [<<UShr>>] + + /// CHECK-START: long Main.Shr56And255(long) instruction_simplifier (after) + /// CHECK-NOT: Shr + /// CHECK-NOT: And + + public static long Shr56And255(long arg) { + return (arg >> 56) & 255; + } + + /// CHECK-START: int Main.Shr24And127(int) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const24:i\d+>> IntConstant 24 + /// CHECK-DAG: <<Const127:i\d+>> IntConstant 127 + /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Arg>>,<<Const24>>] + /// CHECK-DAG: <<And:i\d+>> And [<<Shr>>,<<Const127>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: int Main.Shr24And127(int) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:i\d+>> ParameterValue + /// CHECK-DAG: <<Const24:i\d+>> IntConstant 24 + /// CHECK-DAG: <<Const127:i\d+>> IntConstant 127 + /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Arg>>,<<Const24>>] + /// CHECK-DAG: <<And:i\d+>> And [<<Shr>>,<<Const127>>] + /// CHECK-DAG: Return [<<And>>] + + public static int Shr24And127(int arg) { + return (arg >> 24) & 127; + } + + /// CHECK-START: long Main.Shr56And127(long) instruction_simplifier (before) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const56:i\d+>> IntConstant 56 + /// CHECK-DAG: <<Const127:j\d+>> LongConstant 127 + /// CHECK-DAG: <<Shr:j\d+>> Shr [<<Arg>>,<<Const56>>] + /// CHECK-DAG: <<And:j\d+>> And [<<Shr>>,<<Const127>>] + /// CHECK-DAG: Return [<<And>>] + + /// CHECK-START: long Main.Shr56And127(long) instruction_simplifier (after) + /// CHECK-DAG: <<Arg:j\d+>> ParameterValue + /// CHECK-DAG: <<Const56:i\d+>> IntConstant 56 + /// CHECK-DAG: <<Const127:j\d+>> LongConstant 127 + /// CHECK-DAG: <<Shr:j\d+>> Shr [<<Arg>>,<<Const56>>] + /// CHECK-DAG: <<And:j\d+>> And [<<Shr>>,<<Const127>>] + /// CHECK-DAG: Return [<<And>>] + + public static long Shr56And127(long arg) { + return (arg >> 56) & 127; + } + /// CHECK-START: long Main.Div1(long) instruction_simplifier (before) /// CHECK-DAG: <<Arg:j\d+>> ParameterValue /// CHECK-DAG: <<Const1:j\d+>> LongConstant 1 @@ -1109,5 +1275,13 @@ public class Main { assertFloatEquals(DivMP25(100.0f), -400.0f); assertDoubleEquals(DivMP25(150.0), -600.0); assertLongEquals(Shl1(100), 200); + assertIntEquals(UShr28And15(0xc1234567), 0xc); + assertLongEquals(UShr60And15(0xc123456787654321L), 0xcL); + assertIntEquals(UShr28And7(0xc1234567), 0x4); + assertLongEquals(UShr60And7(0xc123456787654321L), 0x4L); + assertIntEquals(Shr24And255(0xc1234567), 0xc1); + assertLongEquals(Shr56And255(0xc123456787654321L), 0xc1L); + assertIntEquals(Shr24And127(0xc1234567), 0x41); + assertLongEquals(Shr56And127(0xc123456787654321L), 0x41L); } } diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc index e3e00918f8..7e9a583faf 100644 --- a/test/466-get-live-vreg/get_live_vreg_jni.cc +++ b/test/466-get-live-vreg/get_live_vreg_jni.cc @@ -42,7 +42,9 @@ class TestVisitor : public StackVisitor { } else if (m_name.compare("testIntervalHole") == 0) { found_method_ = true; uint32_t value = 0; - if (GetCurrentQuickFrame() != nullptr && m->IsOptimized(sizeof(void*))) { + if (GetCurrentQuickFrame() != nullptr && + m->IsOptimized(sizeof(void*)) && + !Runtime::Current()->IsDebuggable()) { CHECK_EQ(GetVReg(m, 0, kIntVReg, &value), false); } else { CHECK(GetVReg(m, 0, kIntVReg, &value)); diff --git a/test/530-checker-loops/src/Main.java b/test/530-checker-loops/src/Main.java index 1c5b5d65b9..58c92f1ea4 100644 --- a/test/530-checker-loops/src/Main.java +++ b/test/530-checker-loops/src/Main.java @@ -22,7 +22,7 @@ public class Main { static int sResult; // - // Various sequence variables where bound checks can be removed from loop. + // Various sequence variables used in bound checks. // /// CHECK-START: int Main.linear(int[]) BCE (before) @@ -262,11 +262,11 @@ public class Main { return result; } - /// CHECK-START: int Main.linearForNE() BCE (before) + /// CHECK-START: int Main.linearForNEUp() BCE (before) /// CHECK-DAG: BoundsCheck - /// CHECK-START: int Main.linearForNE() BCE (after) + /// CHECK-START: int Main.linearForNEUp() BCE (after) /// CHECK-NOT: BoundsCheck - private static int linearForNE() { + private static int linearForNEUp() { int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int result = 0; for (int i = 0; i != 10; i++) { @@ -275,21 +275,47 @@ public class Main { return result; } - /// CHECK-START: int Main.linearDoWhile() BCE (before) + /// CHECK-START: int Main.linearForNEDown() BCE (before) /// CHECK-DAG: BoundsCheck - /// CHECK-START: int Main.linearDoWhile() BCE (after) + /// CHECK-START: int Main.linearForNEDown() BCE (after) + /// CHECK-NOT: BoundsCheck + private static int linearForNEDown() { + int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int result = 0; + for (int i = 9; i != -1; i--) { + result += x[i]; + } + return result; + } + + /// CHECK-START: int Main.linearDoWhileUp() BCE (before) /// CHECK-DAG: BoundsCheck - private static int linearDoWhile() { + /// CHECK-START: int Main.linearDoWhileUp() BCE (after) + /// CHECK-NOT: BoundsCheck + private static int linearDoWhileUp() { int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int result = 0; int i = 0; - // TODO: make this work do { result += x[i++]; } while (i < 10); return result; } + /// CHECK-START: int Main.linearDoWhileDown() BCE (before) + /// CHECK-DAG: BoundsCheck + /// CHECK-START: int Main.linearDoWhileDown() BCE (after) + /// CHECK-NOT: BoundsCheck + private static int linearDoWhileDown() { + int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int result = 0; + int i = 9; + do { + result += x[i--]; + } while (0 <= i); + return result; + } + /// CHECK-START: int Main.linearShort() BCE (before) /// CHECK-DAG: BoundsCheck /// CHECK-START: int Main.linearShort() BCE (after) @@ -471,23 +497,50 @@ public class Main { return result; } - // - // Cases that actually go out of bounds. These test cases - // ensure the exceptions are thrown at the right places. - // - + /// CHECK-START: void Main.lowerOOB(int[]) BCE (before) + /// CHECK-DAG: BoundsCheck + /// CHECK-START: void Main.lowerOOB(int[]) BCE (after) + /// CHECK-DAG: BoundsCheck private static void lowerOOB(int[] x) { for (int i = -1; i < x.length; i++) { sResult += x[i]; } } + /// CHECK-START: void Main.upperOOB(int[]) BCE (before) + /// CHECK-DAG: BoundsCheck + /// CHECK-START: void Main.upperOOB(int[]) BCE (after) + /// CHECK-DAG: BoundsCheck private static void upperOOB(int[] x) { for (int i = 0; i <= x.length; i++) { sResult += x[i]; } } + /// CHECK-START: void Main.doWhileUpOOB() BCE (before) + /// CHECK-DAG: BoundsCheck + /// CHECK-START: void Main.doWhileUpOOB() BCE (after) + /// CHECK-DAG: BoundsCheck + private static void doWhileUpOOB() { + int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int i = 0; + do { + sResult += x[i++]; + } while (i <= x.length); + } + + /// CHECK-START: void Main.doWhileDownOOB() BCE (before) + /// CHECK-DAG: BoundsCheck + /// CHECK-START: void Main.doWhileDownOOB() BCE (after) + /// CHECK-DAG: BoundsCheck + private static void doWhileDownOOB() { + int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int i = x.length - 1; + do { + sResult += x[i--]; + } while (-1 <= i); + } + // // Verifier. // @@ -550,8 +603,10 @@ public class Main { expectEquals(66, linearWithVeryLargeNegativeStride()); // Special forms. - expectEquals(55, linearForNE()); - expectEquals(55, linearDoWhile()); + expectEquals(55, linearForNEUp()); + expectEquals(55, linearForNEDown()); + expectEquals(55, linearDoWhileUp()); + expectEquals(55, linearDoWhileDown()); expectEquals(55, linearShort()); // Periodic adds (1, 3), one at the time. @@ -618,6 +673,23 @@ public class Main { } expectEquals(1055, sResult); + // Do while up goes OOB. + sResult = 0; + try { + doWhileUpOOB(); + } catch (ArrayIndexOutOfBoundsException e) { + sResult += 1000; + } + expectEquals(1055, sResult); + + // Do while down goes OOB. + sResult = 0; + try { + doWhileDownOOB(); + } catch (ArrayIndexOutOfBoundsException e) { + sResult += 1000; + } + expectEquals(1055, sResult); } private static void expectEquals(int expected, int result) { diff --git a/test/532-checker-nonnull-arrayset/expected.txt b/test/532-checker-nonnull-arrayset/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/532-checker-nonnull-arrayset/expected.txt diff --git a/test/532-checker-nonnull-arrayset/info.txt b/test/532-checker-nonnull-arrayset/info.txt new file mode 100644 index 0000000000..e1578c8f14 --- /dev/null +++ b/test/532-checker-nonnull-arrayset/info.txt @@ -0,0 +1 @@ +Test that we optimize ArraySet when the value is not null. diff --git a/test/532-checker-nonnull-arrayset/src/Main.java b/test/532-checker-nonnull-arrayset/src/Main.java new file mode 100644 index 0000000000..7d8fff46ba --- /dev/null +++ b/test/532-checker-nonnull-arrayset/src/Main.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + + // Check that we don't put a null check in the card marking code. + + /// CHECK-START: void Main.test() instruction_simplifier (before) + /// CHECK: ArraySet value_can_be_null:true + + /// CHECK-START: void Main.test() instruction_simplifier (after) + /// CHECK: ArraySet value_can_be_null:false + + /// CHECK-START-X86: void Main.test() disassembly (after) + /// CHECK: ArraySet value_can_be_null:false + /// CHECK-NOT: test + /// CHECK: ReturnVoid + public static void test() { + Object[] array = new Object[1]; + Object nonNull = array[0]; + nonNull.getClass(); // Ensure nonNull has an implicit null check. + array[0] = nonNull; + } + + public static void main(String[] args) {} +} diff --git a/test/533-regression-debugphi/expected.txt b/test/533-regression-debugphi/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/533-regression-debugphi/expected.txt diff --git a/test/533-regression-debugphi/info.txt b/test/533-regression-debugphi/info.txt new file mode 100644 index 0000000000..a4d4857035 --- /dev/null +++ b/test/533-regression-debugphi/info.txt @@ -0,0 +1,2 @@ +Test a regression where DeadPhiHandling would infinitely loop over +complicated phi dependencies. diff --git a/test/533-regression-debugphi/smali/TestCase.smali b/test/533-regression-debugphi/smali/TestCase.smali new file mode 100644 index 0000000000..1908e72c57 --- /dev/null +++ b/test/533-regression-debugphi/smali/TestCase.smali @@ -0,0 +1,72 @@ +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.class public LTestCase; +.super Ljava/lang/Object; + +# This is a reduced test case that used to trigger an infinite loop +# in the DeadPhiHandling phase of the optimizing compiler (only used +# with debuggable flag). +.method public static testCase(IILjava/lang/Object;)V + .registers 5 + const/4 v0, 0x0 + + :B4 + invoke-static {}, Ljava/lang/System;->nanoTime()J + goto :B7 + + :B7 + invoke-static {}, Ljava/lang/System;->nanoTime()J + if-nez p2, :Btmp + goto :B111 + + :Btmp + invoke-static {}, Ljava/lang/System;->nanoTime()J + if-nez p2, :B9 + goto :B110 + + :B13 + invoke-static {}, Ljava/lang/System;->nanoTime()J + add-int v0, p0, p1 + goto :B7 + + :B110 + invoke-static {}, Ljava/lang/System;->nanoTime()J + add-int v0, p0, p1 + goto :B111 + + :B111 + invoke-static {}, Ljava/lang/System;->nanoTime()J + goto :B4 + + :B9 + invoke-static {}, Ljava/lang/System;->nanoTime()J + if-nez p2, :B10 + + :B11 + invoke-static {}, Ljava/lang/System;->nanoTime()J + move v1, v0 + goto :B12 + + :B10 + invoke-static {}, Ljava/lang/System;->nanoTime()J + move-object v1, p2 + goto :B12 + + :B12 + invoke-static {}, Ljava/lang/System;->nanoTime()J + goto :B13 + + return-void +.end method diff --git a/test/533-regression-debugphi/src/Main.java b/test/533-regression-debugphi/src/Main.java new file mode 100644 index 0000000000..858770f508 --- /dev/null +++ b/test/533-regression-debugphi/src/Main.java @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + // Workaround for b/18051191. + class InnerClass {} + + public static void main(String[] args) {} +} diff --git a/test/534-checker-bce-deoptimization/expected.txt b/test/534-checker-bce-deoptimization/expected.txt new file mode 100644 index 0000000000..3823a29f3f --- /dev/null +++ b/test/534-checker-bce-deoptimization/expected.txt @@ -0,0 +1 @@ +finish diff --git a/test/534-checker-bce-deoptimization/info.txt b/test/534-checker-bce-deoptimization/info.txt new file mode 100644 index 0000000000..9f097d0ac7 --- /dev/null +++ b/test/534-checker-bce-deoptimization/info.txt @@ -0,0 +1,8 @@ +Checker test for testing the behavior of deoptimization generated by +bounds check elimination. + +The runtime used to trip on that test because it used to deopt the +whole stack, and the compiler was not preserving dex registers at +call sites. + +We fixed the bug by doing single frame deoptimization. diff --git a/test/534-checker-bce-deoptimization/src/Main.java b/test/534-checker-bce-deoptimization/src/Main.java new file mode 100644 index 0000000000..8cd20f677a --- /dev/null +++ b/test/534-checker-bce-deoptimization/src/Main.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + public static void main(String[] args) { + new Main().run(); + System.out.println("finish"); + } + + public void run() { + double a[][] = new double[200][201]; + double b[] = new double[200]; + int n = 100; + + foo1(a, n, b); + } + + void foo1(double a[][], int n, double b[]) { + double t; + int i,k; + + for (i = 0; i < n; i++) { + k = n - (i + 1); + b[k] /= a[k][k]; + t = -b[k]; + foo2(k + 1000, t, b); + } + } + + void foo2(int n, double c, double b[]) { + try { + foo3(n, c, b); + } catch (Exception e) { + } + } + + void foo3(int n, double c, double b[]) { + int i = 0; + for (i = 0; i < n; i++) { + b[i + 1] += c * b[i + 1]; + } + } +} + diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 4397ea4b52..e9153575f6 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -418,19 +418,70 @@ endif TEST_ART_BROKEN_DEFAULT_RUN_TESTS := -# Known broken tests for the arm64 optimizing compiler backend. -TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS := - -ifneq (,$(filter optimizing,$(COMPILER_TYPES))) - ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \ - optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ - $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS),64) +# Known broken tests for the mips32 optimizing compiler backend. +TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \ + 441-checker-inliner \ + 442-checker-constant-folding \ + 444-checker-nce \ + 445-checker-licm \ + 446-checker-inliner2 \ + 447-checker-inliner3 \ + 449-checker-bce \ + 450-checker-types \ + 455-checker-gvn \ + 458-checker-instruction-simplification \ + 462-checker-inlining-across-dex-files \ + 463-checker-boolean-simplifier \ + 464-checker-inline-sharpen-calls \ + 465-checker-clinit-gvn \ + 468-checker-bool-simplifier-regression \ + 473-checker-inliner-constants \ + 474-checker-boolean-input \ + 476-checker-ctor-memory-barrier \ + 477-checker-bound-type \ + 478-checker-clinit-check-pruning \ + 478-checker-inliner-nested-loop \ + 480-checker-dead-blocks \ + 482-checker-loop-back-edge-use \ + 484-checker-register-hints \ + 485-checker-dce-loop-update \ + 485-checker-dce-switch \ + 486-checker-must-do-null-check \ + 487-checker-inline-calls \ + 488-checker-inline-recursive-calls \ + 490-checker-inline \ + 492-checker-inline-invoke-interface \ + 493-checker-inline-invoke-interface \ + 494-checker-instanceof-tests \ + 495-checker-checkcast-tests \ + 496-checker-inlining-and-class-loader \ + 508-checker-disassembly \ + 510-checker-try-catch \ + 517-checker-builder-fallthrough \ + 521-checker-array-set-null \ + 522-checker-regression-monitor-exit \ + 523-checker-can-throw-regression \ + 525-checker-arrays-and-fields \ + 526-checker-caller-callee-regs \ + 529-checker-unresolved \ + 530-checker-loops \ + 530-checker-regression-reftype-final \ + 532-checker-nonnull-arrayset \ + +ifeq (mips,$(TARGET_ARCH)) + ifneq (,$(filter optimizing,$(COMPILER_TYPES))) + ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \ + optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ + $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \ + $(TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS),$(ALL_ADDRESS_SIZES)) + endif endif -TEST_ART_BROKEN_OPTIMIZING_ARM64_RUN_TESTS := +TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := # Known broken tests for the optimizing compiler. -TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS := +TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS := \ + 455-set-vreg \ ifneq (,$(filter optimizing,$(COMPILER_TYPES))) ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ @@ -451,7 +502,6 @@ TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS := # Tests that should fail when the optimizing compiler compiles them non-debuggable. TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS := \ 454-get-vreg \ - 455-set-vreg \ 457-regs \ ifneq (,$(filter optimizing,$(COMPILER_TYPES))) |