diff options
author | 2015-06-24 10:38:27 +0100 | |
---|---|---|
committer | 2015-06-24 15:07:50 +0100 | |
commit | a09ff9c11f07863ac57e6120a824f0d20dfaa284 (patch) | |
tree | d2ddb2da513544e2f64fba6c0e20dbdefe8cc8b2 /test/513-array-deopt/src/Main.java | |
parent | 582195dfcee32586b71b0ed00a973cfc7d7b8b57 (diff) |
BCE: Narrow instead of unconditionnaly overwrite the range.
bug:21862741
Change-Id: Ic1c2d6fa64255623f87af33a297c459cc9080d3c
Diffstat (limited to 'test/513-array-deopt/src/Main.java')
-rw-r--r-- | test/513-array-deopt/src/Main.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/513-array-deopt/src/Main.java b/test/513-array-deopt/src/Main.java index a0ae4c3556..5ee4d550f8 100644 --- a/test/513-array-deopt/src/Main.java +++ b/test/513-array-deopt/src/Main.java @@ -19,19 +19,36 @@ public class Main { a[0] = 0; a[1] = 0; a[2] = 0; - // Up to this point, we record that the lower bound is 2. + // Up to this point, we record that the lower bound (inclusive) is 3. // The next instruction will record that the lower bound is 5. // The deoptimization code used to assume the lower bound has - // to be check it will add for the deoptimization (here, it - // would be 2). + // to be the one it will add for the deoptimization check (here, it + // would be 3). return new int[a.length - 5]; } + public static int[] foo(int[] a) { + a[0] = 0; + a[1] = 0; + a[2] = 0; + // Up to this point, we record that the lower bound (inclusive) is 3. + // The next instruction will record that the lower bound is 1. + // The deoptimization code used to assume the lower bound has + // to be the one it will add for the deoptimization check (here, it + // would be 3). + return new int[a.length - 1]; + } + public static void main(String[] args) { int[] a = new int[5]; - a = bar(a); - if (a.length != 0) { - throw new Error("Expected 0, got " + a.length); + int[] result = bar(a); + if (result.length != 0) { + throw new Error("Expected 0, got " + result.length); + } + + result = foo(a); + if (result.length != 4) { + throw new Error("Expected 5, got " + result.length); } } } |