summaryrefslogtreecommitdiffstats
path: root/test/449-checker-bce/src/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/449-checker-bce/src/Main.java')
-rw-r--r--test/449-checker-bce/src/Main.java148
1 files changed, 5 insertions, 143 deletions
diff --git a/test/449-checker-bce/src/Main.java b/test/449-checker-bce/src/Main.java
index 17039a3492..30aa870acb 100644
--- a/test/449-checker-bce/src/Main.java
+++ b/test/449-checker-bce/src/Main.java
@@ -108,147 +108,29 @@ public class Main {
}
- // CHECK-START: void Main.constantIndexing1(int[]) BCE (before)
+ // CHECK-START: void Main.constantIndexing(int[]) BCE (before)
// CHECK: BoundsCheck
// CHECK: ArraySet
// CHECK: BoundsCheck
// CHECK: ArraySet
-
- // CHECK-START: void Main.constantIndexing1(int[]) BCE (after)
- // CHECK-NOT: Deoptimize
// CHECK: BoundsCheck
// CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- static void constantIndexing1(int[] array) {
- array[5] = 1;
- array[4] = 1;
- }
-
-
- // CHECK-START: void Main.constantIndexing2(int[]) BCE (before)
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
+ // CHECK-START: void Main.constantIndexing(int[]) BCE (after)
// CHECK: BoundsCheck
// CHECK: ArraySet
-
- // CHECK-START: void Main.constantIndexing2(int[]) BCE (after)
- // CHECK: LessThanOrEqual
- // CHECK: Deoptimize
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
// CHECK-NOT: BoundsCheck
// CHECK: ArraySet
// CHECK: BoundsCheck
// CHECK: ArraySet
- static void constantIndexing2(int[] array) {
- array[1] = 1;
- array[2] = 1;
- array[3] = 1;
+ static void constantIndexing(int[] array) {
+ array[5] = 1;
array[4] = 1;
- array[-1] = 1;
- }
-
-
- // CHECK-START: int[] Main.constantIndexing3(int[], int[], boolean) BCE (before)
- // CHECK: BoundsCheck
- // CHECK: ArrayGet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArrayGet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArrayGet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArrayGet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
-
- // CHECK-START: int[] Main.constantIndexing3(int[], int[], boolean) BCE (after)
- // CHECK: LessThanOrEqual
- // CHECK: Deoptimize
- // CHECK-NOT: BoundsCheck
- // CHECK: ArrayGet
- // CHECK: LessThanOrEqual
- // CHECK: Deoptimize
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArrayGet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArrayGet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArrayGet
- // CHECK-NOT: BoundsCheck
- // CHECK: ArraySet
-
- static int[] constantIndexing3(int[] array1, int[] array2, boolean copy) {
- if (!copy) {
- return array1;
- }
- array2[0] = array1[0];
- array2[1] = array1[1];
- array2[2] = array1[2];
- array2[3] = array1[3];
- return array2;
- }
-
-
- // CHECK-START: void Main.constantIndexing4(int[]) BCE (before)
- // CHECK: BoundsCheck
- // CHECK: ArraySet
-
- // CHECK-START: void Main.constantIndexing4(int[]) BCE (after)
- // CHECK-NOT: LessThanOrEqual
- // CHECK: BoundsCheck
- // CHECK: ArraySet
-
- // There is only one array access. It's not beneficial
- // to create a compare with deoptimization instruction.
- static void constantIndexing4(int[] array) {
- array[0] = 1;
+ array[6] = 1;
}
- // CHECK-START: void Main.constantIndexing5(int[]) BCE (before)
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
-
- // CHECK-START: void Main.constantIndexing5(int[]) BCE (after)
- // CHECK-NOT: Deoptimize
- // CHECK: BoundsCheck
- // CHECK: ArraySet
- // CHECK: BoundsCheck
- // CHECK: ArraySet
-
- static void constantIndexing5(int[] array) {
- // We don't apply the deoptimization for very large constant index
- // since it's likely to be an anomaly and will throw AIOOBE.
- array[Integer.MAX_VALUE - 1000] = 1;
- array[Integer.MAX_VALUE - 999] = 1;
- array[Integer.MAX_VALUE - 998] = 1;
- }
-
// CHECK-START: void Main.loopPattern1(int[]) BCE (before)
// CHECK: BoundsCheck
// CHECK: ArraySet
@@ -597,21 +479,6 @@ public class Main {
}
- static int foo() {
- try {
- // This will cause AIOOBE.
- constantIndexing2(new int[3]);
- } catch (ArrayIndexOutOfBoundsException e) {
- return 99;
- }
- return 0;
- }
-
-
- // Make sure this method is compiled with optimizing.
- // CHECK-START: void Main.main(java.lang.String[]) register (after)
- // CHECK: ParallelMove
-
public static void main(String[] args) {
sieve(20);
@@ -640,10 +507,5 @@ public class Main {
if (!isPyramid(array)) {
System.out.println("pyramid3 failed!");
}
-
- // Make sure this value is kept after deoptimization.
- int i = 1;
- System.out.println(foo() + i);
}
-
}