Fix 624-checker-stringops for PIC.
Do not rely on the const-string "x" to be non-throwing;
just pull the "x" out of the loop to make it irrelevant.
(The non-PIC test was "lucky" because "x" is a boot image
string and HLoadString/kBootImageAddress in non-throwing.
In PIC mode, the HLoadString/kBssEntry is throwing; the
"is in boot image" optimization for HLoadClass has not been
implemented for HLoadString.)
Test: testrunner.py --host -t 624
Test: testrunner.py --host --pictest -t 624
Change-Id: Iff5cfb1276af0e4896707f19a18e6053afd87a77
diff --git a/test/624-checker-stringops/src/Main.java b/test/624-checker-stringops/src/Main.java
index 75b782e..63da4f5 100644
--- a/test/624-checker-stringops/src/Main.java
+++ b/test/624-checker-stringops/src/Main.java
@@ -232,8 +232,9 @@
/// CHECK-NOT: InvokeVirtual intrinsic:StringStringIndexOfAfter
static int bufferDeadLoop() {
StringBuffer b = new StringBuffer();
+ String x = "x";
for (int i = 0; i < 10; i++) {
- int d = b.toString().indexOf("x", 1);
+ int d = b.toString().indexOf(x, 1);
}
return b.length();
}
@@ -252,8 +253,9 @@
/// CHECK-NOT: InvokeVirtual intrinsic:StringStringIndexOfAfter
static int builderDeadLoop() {
StringBuilder b = new StringBuilder();
+ String x = "x";
for (int i = 0; i < 10; i++) {
- int d = b.toString().indexOf("x", 1);
+ int d = b.toString().indexOf(x, 1);
}
return b.length();
}