Fix 570-checker-osr test for non-debuggable mode.
For non-debuggable mode, we need to create profiling info.
Bug: 28210356
Change-Id: I3c2e1f7a7b447d44ca12382fe5f5a93e3dc83cab
diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc
index ac2e0ce..2a5b2c9 100644
--- a/test/570-checker-osr/osr.cc
+++ b/test/570-checker-osr/osr.cc
@@ -89,35 +89,41 @@
class ProfilingInfoVisitor : public StackVisitor {
public:
- explicit ProfilingInfoVisitor(Thread* thread)
+ explicit ProfilingInfoVisitor(Thread* thread, const char* method_name)
SHARED_REQUIRES(Locks::mutator_lock_)
- : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames) {}
+ : StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
+ method_name_(method_name) {}
bool VisitFrame() SHARED_REQUIRES(Locks::mutator_lock_) {
ArtMethod* m = GetMethod();
std::string m_name(m->GetName());
- if ((m_name.compare("$noinline$inlineCache") == 0) ||
- (m_name.compare("$noinline$stackOverflow") == 0)) {
+ if (m_name.compare(method_name_) == 0) {
ProfilingInfo::Create(Thread::Current(), m, /* retry_allocation */ true);
return false;
}
return true;
}
+
+ const char* const method_name_;
};
-extern "C" JNIEXPORT void JNICALL Java_Main_ensureHasProfilingInfo(JNIEnv*, jclass) {
+extern "C" JNIEXPORT void JNICALL Java_Main_ensureHasProfilingInfo(JNIEnv* env,
+ jclass,
+ jstring method_name) {
if (!Runtime::Current()->UseJit()) {
return;
}
+ ScopedUtfChars chars(env, method_name);
+ CHECK(chars.c_str() != nullptr);
ScopedObjectAccess soa(Thread::Current());
- ProfilingInfoVisitor visitor(soa.Self());
+ ProfilingInfoVisitor visitor(soa.Self(), chars.c_str());
visitor.WalkStack();
}
class OsrCheckVisitor : public StackVisitor {
public:
- OsrCheckVisitor(Thread* thread, const char* const method_name)
+ OsrCheckVisitor(Thread* thread, const char* method_name)
SHARED_REQUIRES(Locks::mutator_lock_)
: StackVisitor(thread, nullptr, StackVisitor::StackWalkKind::kIncludeInlinedFrames),
method_name_(method_name) {}
diff --git a/test/570-checker-osr/src/Main.java b/test/570-checker-osr/src/Main.java
index ba839bf..e103d1b 100644
--- a/test/570-checker-osr/src/Main.java
+++ b/test/570-checker-osr/src/Main.java
@@ -124,7 +124,7 @@
return SubMain.class;
}
- ensureHasProfilingInfo();
+ ensureHasProfilingInfo("$noinline$inlineCache");
// Ensure that we have OSR code to jump to.
if (isSecondInvocation) {
@@ -167,7 +167,7 @@
}
// We need a ProfilingInfo object to populate the 'otherInlineCache' call.
- ensureHasProfilingInfo();
+ ensureHasProfilingInfo("$noinline$stackOverflow");
if (isSecondInvocation) {
// Ensure we have an OSR code and we jump to it.
@@ -188,6 +188,7 @@
assertIntEquals(12, $opt$inline$testRemoveSuspendCheck(12, 5));
// Since we cannot have a loop directly in this method, we need to force the OSR
// compilation from native code.
+ ensureHasProfilingInfo("$opt$noinline$testOsrInlineLoop");
ensureHasOsrCode("$opt$noinline$testOsrInlineLoop");
}
@@ -219,7 +220,7 @@
public static native boolean isInOsrCode(String methodName);
public static native boolean isInInterpreter(String methodName);
- public static native void ensureHasProfilingInfo();
+ public static native void ensureHasProfilingInfo(String methodName);
public static native void ensureHasOsrCode(String methodName);
public static boolean doThrow = false;