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) {}
return SubMain.class;
}
- ensureHasProfilingInfo();
+ ensureHasProfilingInfo("$noinline$inlineCache");
// Ensure that we have OSR code to jump to.
if (isSecondInvocation) {
}
// 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.
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");
}
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;