Move to do/while loop to ensure optimized compilation.
Honor the comment in the loop, which was made stalled after:
https://android-review.googlesource.com/c/platform/art/+/1393188
Test: 638-checker-inline-cache-intrinsic
Bug: 112676029
Change-Id: I63e8c3e8e7a173e4f1bb5b1bfa3fbc46b13af0e7
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index 5d68b2c..c4edf19 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -266,7 +266,7 @@
// Update the code cache to make sure the JIT code does not get deleted.
// Note: this will apply to all JIT compilations.
code_cache->SetGarbageCollectCode(false);
- while (!code_cache->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) {
+ do {
// Sleep to yield to the compiler thread.
usleep(1000);
ScopedObjectAccess soa(self);
@@ -275,7 +275,7 @@
// method is compiled 'optimized' and not baseline (tests expect optimized
// compilation).
jit->CompileMethod(method, self, CompilationKind::kOptimized, /*prejit=*/ false);
- }
+ } while (!code_cache->ContainsPc(method->GetEntryPointFromQuickCompiledCode()));
}
extern "C" JNIEXPORT void JNICALL Java_Main_ensureMethodJitCompiled(JNIEnv*, jclass, jobject meth) {