summaryrefslogtreecommitdiff
path: root/test/499-bce-phi-array-length
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-11-14 14:03:10 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2022-11-15 15:34:39 +0000
commite2d1a03f24c7a130a8e5ad1c9245abe781ddb1e8 (patch)
tree99f6b917cb3b3c1ee0d7513f8b1d5f66f3884723 /test/499-bce-phi-array-length
parent07c68601ddf623a699892ed0dd5ec87b7a05fd02 (diff)
ART: Change indentation to 4 spaces in run-test shards 95-99.
Created with for testName in \ `git grep -E '^ public static void main\(String\[\]' \ -- test/*<i>-*/src/Main.java | \ sed '-es/\/src\/Main.java:.*//'`; \ do \ find $testName/ -type f -name *.java | \ xargs sed -E '-es/^(( )+)/\1\1/' --in-place ; \ done with <i> manually set to 99 down to 95 (stopping when the change is getting large). Manually address many long lines and fix other style issues. Also fix indentation in two files where https://android-review.googlesource.com/2300941 just updated previously wrong indentation. Exclude changes to test/595-profile-saving/src/Main.java because of a conflict in internal. Test: testrunner.py --host --optimizing Test: buildbot-build.sh --target Change-Id: I02fe676f3983610c0cdda1134aee2476f71bc7ce
Diffstat (limited to 'test/499-bce-phi-array-length')
-rw-r--r--test/499-bce-phi-array-length/src/Main.java80
1 files changed, 40 insertions, 40 deletions
diff --git a/test/499-bce-phi-array-length/src/Main.java b/test/499-bce-phi-array-length/src/Main.java
index e917bc1f32..4e99771a4f 100644
--- a/test/499-bce-phi-array-length/src/Main.java
+++ b/test/499-bce-phi-array-length/src/Main.java
@@ -15,50 +15,50 @@
*/
public class Main {
- public static int foo(int start, int[] array) {
- int result = 0;
- // We will create HDeoptimize nodes for this first loop, and a phi
- // for the array length which will only be used within the loop.
- for (int i = start; i < 3; i++) {
- result += array[i];
- for (int j = 0; j < 2; ++j) {
- // The HBoundsCheck for this array access will be updated to access
- // the array length phi created for the deoptimization checks of the
- // first loop. This crashed the compiler which used to DCHECK an array
- // length in a bounds check cannot be a phi.
- result += array[j];
- }
+ public static int foo(int start, int[] array) {
+ int result = 0;
+ // We will create HDeoptimize nodes for this first loop, and a phi
+ // for the array length which will only be used within the loop.
+ for (int i = start; i < 3; i++) {
+ result += array[i];
+ for (int j = 0; j < 2; ++j) {
+ // The HBoundsCheck for this array access will be updated to access
+ // the array length phi created for the deoptimization checks of the
+ // first loop. This crashed the compiler which used to DCHECK an array
+ // length in a bounds check cannot be a phi.
+ result += array[j];
+ }
+ }
+ return result;
}
- return result;
- }
- public static int bar(int start, int[] array) {
- int result = 0;
- for (int i = start; i < 3; i++) {
- result += array[i];
- for (int j = 0; j < 2; ++j) {
- result += array[j];
- // The following operations would lead to BCE wanting to add another
- // deoptimization, but it crashed assuming the input of a `HBoundsCheck`
- // must be a `HArrayLength`.
- result += array[0];
- result += array[1];
- result += array[2];
- }
+ public static int bar(int start, int[] array) {
+ int result = 0;
+ for (int i = start; i < 3; i++) {
+ result += array[i];
+ for (int j = 0; j < 2; ++j) {
+ result += array[j];
+ // The following operations would lead to BCE wanting to add another
+ // deoptimization, but it crashed assuming the input of a `HBoundsCheck`
+ // must be a `HArrayLength`.
+ result += array[0];
+ result += array[1];
+ result += array[2];
+ }
+ }
+ return result;
}
- return result;
- }
- public static void main(String[] args) {
- int[] a = new int[] { 1, 2, 3, 4, 5 };
- int result = foo(1, a);
- if (result != 11) {
- throw new Error("Got " + result + ", expected " + 11);
- }
+ public static void main(String[] args) {
+ int[] a = new int[] { 1, 2, 3, 4, 5 };
+ int result = foo(1, a);
+ if (result != 11) {
+ throw new Error("Got " + result + ", expected " + 11);
+ }
- result = bar(1, a);
- if (result != 35) {
- throw new Error("Got " + result + ", expected " + 35);
+ result = bar(1, a);
+ if (result != 35) {
+ throw new Error("Got " + result + ", expected " + 35);
+ }
}
- }
}