Generalize Main.compiledWithOptimizing.
Return false for any compiler filter which does not do AOT compilation.
Test: 449-checker-bce
Bug: 186500342
Change-Id: I29ab70b98b5f699ebea94a8c2ff1820cf8ae7322
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index ecbe546..ad11679 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -146,23 +146,18 @@
constexpr const char* kCompilerFilter = "--compiler-filter=";
const char* filter = strstr(cmd_line, kCompilerFilter);
if (filter != nullptr) {
- // If it's set, make sure it's not interpret-only|verify-none|verify-at-runtime.
- // Note: The space filter might have an impact on the test, but ignore that for now.
filter += strlen(kCompilerFilter);
- constexpr const char* kInterpretOnly = "interpret-only";
- constexpr const char* kVerifyNone = "verify-none";
- constexpr const char* kVerifyAtRuntime = "verify-at-runtime";
- constexpr const char* kQuicken = "quicken";
- constexpr const char* kExtract = "extract";
- if (strncmp(filter, kInterpretOnly, strlen(kInterpretOnly)) == 0 ||
- strncmp(filter, kVerifyNone, strlen(kVerifyNone)) == 0 ||
- strncmp(filter, kVerifyAtRuntime, strlen(kVerifyAtRuntime)) == 0 ||
- strncmp(filter, kExtract, strlen(kExtract)) == 0 ||
- strncmp(filter, kQuicken, strlen(kQuicken)) == 0) {
+ const char* end = strchr(filter, ' ');
+ std::string string_filter(filter, (end == nullptr) ? strlen(filter) : end - filter);
+ CompilerFilter::Filter compiler_filter;
+ if (CompilerFilter::ParseCompilerFilter(string_filter.c_str(), &compiler_filter)) {
+ return CompilerFilter::IsAotCompilationEnabled(compiler_filter) ? JNI_TRUE : JNI_FALSE;
+ } else {
return JNI_FALSE;
}
}
+ // No filter passed, assume default has AOT.
return JNI_TRUE;
}