Revert "Revert "Tweak inlining heuristics.""
This reverts commit b17d1ccff0ac26fc22df671907ba2b4f4c656ce4.
Change-Id: I26f6f8702a448c3da12662cbc6bc0f6e562bc40b
diff --git a/test/449-checker-bce/src/Main.java b/test/449-checker-bce/src/Main.java
index 6e7ba40..3e6d1f4 100644
--- a/test/449-checker-bce/src/Main.java
+++ b/test/449-checker-bce/src/Main.java
@@ -127,7 +127,7 @@
}
- /// CHECK-START: void Main.constantIndexing2(int[]) BCE (before)
+ /// CHECK-START: void Main.$opt$noinline$constantIndexing2(int[]) BCE (before)
/// CHECK: BoundsCheck
/// CHECK: ArraySet
/// CHECK: BoundsCheck
@@ -137,7 +137,7 @@
/// CHECK: BoundsCheck
/// CHECK: ArraySet
- /// CHECK-START: void Main.constantIndexing2(int[]) BCE (after)
+ /// CHECK-START: void Main.$opt$noinline$constantIndexing2(int[]) BCE (after)
/// CHECK: LessThanOrEqual
/// CHECK: Deoptimize
/// CHECK-NOT: BoundsCheck
@@ -151,12 +151,15 @@
/// CHECK: BoundsCheck
/// CHECK: ArraySet
- static void constantIndexing2(int[] array) {
+ static void $opt$noinline$constantIndexing2(int[] array) {
array[1] = 1;
array[2] = 1;
array[3] = 1;
array[4] = 1;
array[-1] = 1;
+ if (array[1] == 1) {
+ throw new Error("");
+ }
}
@@ -655,10 +658,10 @@
try {
assertIsManaged();
// This will cause AIOOBE.
- constantIndexing2(new int[3]);
+ $opt$noinline$constantIndexing2(new int[3]);
} catch (ArrayIndexOutOfBoundsException e) {
assertIsManaged(); // This is to ensure that single-frame deoptimization works.
- // Will need to be updated if constantIndexing2 is inlined.
+ // Will need to be updated if $opt$noinline$constantIndexing2 is inlined.
try {
// This will cause AIOOBE.
constantIndexingForward6(new int[3]);
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 375a3fc..4f89e91 100644
--- a/test/466-get-live-vreg/get_live_vreg_jni.cc
+++ b/test/466-get-live-vreg/get_live_vreg_jni.cc
@@ -40,15 +40,17 @@
uint32_t value = 0;
CHECK(GetVReg(m, 0, kIntVReg, &value));
CHECK_EQ(value, 42u);
- } else if (m_name.compare("testIntervalHole") == 0) {
+ } else if (m_name.compare("$opt$noinline$testIntervalHole") == 0) {
+ uint32_t number_of_dex_registers = m->GetCodeItem()->registers_size_;
+ uint32_t dex_register_of_first_parameter = number_of_dex_registers - 2;
found_method_ = true;
uint32_t value = 0;
if (GetCurrentQuickFrame() != nullptr &&
GetCurrentOatQuickMethodHeader()->IsOptimized() &&
!Runtime::Current()->IsDebuggable()) {
- CHECK_EQ(GetVReg(m, 0, kIntVReg, &value), false);
+ CHECK_EQ(GetVReg(m, dex_register_of_first_parameter, kIntVReg, &value), false);
} else {
- CHECK(GetVReg(m, 0, kIntVReg, &value));
+ CHECK(GetVReg(m, dex_register_of_first_parameter, kIntVReg, &value));
CHECK_EQ(value, 1u);
}
}
diff --git a/test/466-get-live-vreg/src/Main.java b/test/466-get-live-vreg/src/Main.java
index d036a24..1903260 100644
--- a/test/466-get-live-vreg/src/Main.java
+++ b/test/466-get-live-vreg/src/Main.java
@@ -31,7 +31,7 @@
}
}
- static void testIntervalHole(int arg, boolean test) {
+ static void $opt$noinline$testIntervalHole(int arg, boolean test) {
// Move the argument to callee save to ensure it is in
// a readable register.
moveArgToCalleeSave();
@@ -44,6 +44,9 @@
// The environment use of `arg` should not make it live.
doStaticNativeCallLiveVreg();
}
+ if (staticField1 == 2) {
+ throw new Error("");
+ }
}
static native void doStaticNativeCallLiveVreg();
@@ -67,7 +70,7 @@
static void testWrapperIntervalHole(int arg, boolean test) {
try {
Thread.sleep(0);
- testIntervalHole(arg, test);
+ $opt$noinline$testIntervalHole(arg, test);
} catch (Exception e) {
throw new Error(e);
}
diff --git a/test/476-checker-ctor-memory-barrier/src/Main.java b/test/476-checker-ctor-memory-barrier/src/Main.java
index 41bec05..c2a2a10 100644
--- a/test/476-checker-ctor-memory-barrier/src/Main.java
+++ b/test/476-checker-ctor-memory-barrier/src/Main.java
@@ -25,13 +25,14 @@
class ClassWithFinals {
public final int x;
public ClassWithFinals obj;
+ public static boolean doThrow = false;
/// CHECK-START: void ClassWithFinals.<init>(boolean) register (after)
/// CHECK: MemoryBarrier kind:StoreStore
/// CHECK-NEXT: ReturnVoid
public ClassWithFinals(boolean cond) {
x = 0;
- if (cond) {
+ if (doThrow) {
// avoid inlining
throw new RuntimeException();
}