diff options
-rw-r--r-- | test/570-checker-osr/osr.cc | 20 | ||||
-rw-r--r-- | test/570-checker-osr/src/Main.java | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc index ac2e0ce77d..2a5b2c954d 100644 --- a/test/570-checker-osr/osr.cc +++ b/test/570-checker-osr/osr.cc @@ -89,35 +89,41 @@ extern "C" JNIEXPORT jboolean JNICALL Java_Main_isInInterpreter(JNIEnv* env, 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 ba839bfa48..e103d1bf7d 100644 --- a/test/570-checker-osr/src/Main.java +++ b/test/570-checker-osr/src/Main.java @@ -124,7 +124,7 @@ public class Main { return SubMain.class; } - ensureHasProfilingInfo(); + ensureHasProfilingInfo("$noinline$inlineCache"); // Ensure that we have OSR code to jump to. if (isSecondInvocation) { @@ -167,7 +167,7 @@ public class Main { } // 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 @@ public class Main { 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 class Main { 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; |