summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-12-22 18:25:35 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-12-22 19:29:40 +0000
commitf070fa72d6ac97469faf45852c27430311ac05d8 (patch)
tree49f32fa8e764e7f775bf6f5ef9de72607d863074
parent29395e8982ee08036b81fd3eb7aef16bcbdf8ebc (diff)
Add a delay after baseline compilation in 2271-profile-inline-cache.
The test was flaky on gcstress when run with other tests concurrently. This change mitigates it unless we find a better solution. Bug: 317505124 Test: - 1. Limit the test on a single little core. 2. art/test/testrunner/testrunner.py --target --64 test-art-target-run-test-ndebug-prebuild-jit-no-relocate-ntrace-gcstress-checkjni-picimage-ndebuggable-no-jvmti-cdex-fast-2271-profile-inline-cache64 Change-Id: I05ee3b192e0115f548b5068ecd785370b61f5a7b
-rw-r--r--test/2271-profile-inline-cache/src/Main.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/2271-profile-inline-cache/src/Main.java b/test/2271-profile-inline-cache/src/Main.java
index 365875d05c..67a07a2871 100644
--- a/test/2271-profile-inline-cache/src/Main.java
+++ b/test/2271-profile-inline-cache/src/Main.java
@@ -42,6 +42,10 @@ public class Main {
// This method is below the inline cache threshold.
Method method1 = Main.class.getDeclaredMethod("$noinline$method1", Base.class);
ensureJitBaselineCompiled(method1);
+ // TODO(b/317505124): For unknown reasons, the method call does not record inline caches
+ // unless we wait for a while after compilation, especially when this test is run along
+ // with other tests concurrently on gcstress.
+ sleep(1000);
$noinline$method1(derived1);
for (int i = 0; i < 2998; i++) {
$noinline$method1(derived2);
@@ -51,6 +55,10 @@ public class Main {
// This method is right on the inline cache threshold.
Method method2 = Main.class.getDeclaredMethod("$noinline$method2", Base.class);
ensureJitBaselineCompiled(method2);
+ // TODO(b/317505124): For unknown reasons, the method call does not record inline caches
+ // unless we wait for a while after compilation, especially when this test is run along
+ // with other tests concurrently on gcstress.
+ sleep(1000);
$noinline$method2(derived1);
for (int i = 0; i < 2999; i++) {
$noinline$method2(derived2);
@@ -60,6 +68,10 @@ public class Main {
// This method is above the inline cache threshold.
Method method3 = Main.class.getDeclaredMethod("$noinline$method3", Base.class);
ensureJitBaselineCompiled(method3);
+ // TODO(b/317505124): For unknown reasons, the method call does not record inline caches
+ // unless we wait for a while after compilation, especially when this test is run along
+ // with other tests concurrently on gcstress.
+ sleep(1000);
for (int i = 0; i < 10000; i++) {
$noinline$method3(derived1);
}
@@ -71,6 +83,10 @@ public class Main {
// This method is above the JIT threshold.
Method method4 = Main.class.getDeclaredMethod("$noinline$method4", Base.class);
ensureJitBaselineCompiled(method4);
+ // TODO(b/317505124): For unknown reasons, the method call does not record inline caches
+ // unless we wait for a while after compilation, especially when this test is run along
+ // with other tests concurrently on gcstress.
+ sleep(1000);
$noinline$method4(derived1);
$noinline$method4(derived2);
ensureMethodJitCompiled(method4);
@@ -158,6 +174,13 @@ public class Main {
}
}
+ private static void sleep(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException ignored) {
+ }
+ }
+
private static class VMRuntime {
public static final int CODE_PATH_TYPE_PRIMARY_APK = 1 << 0;
private static final Method registerAppInfoMethod;