summaryrefslogtreecommitdiff
path: root/runtime/native/dalvik_system_DexFile.cc
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2022-10-12 16:07:04 +0100
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-10-17 15:52:58 +0000
commit6e18f436561a678a3a10e4fb7354b92fb7a10c2a (patch)
tree887d1667068e8848d48ef3e10c17bc249f0d2a44 /runtime/native/dalvik_system_DexFile.cc
parent839193ee2031d28aac2ce16c4b76ad40531b07cc (diff)
Implement JNI methods for `getCurrentOptimizationStatus`.
Bug: 253230007 Test: atest CtsCompilationTestCases:CompilationTest Change-Id: Icc5d2baca448aa1bf589b5ce8db7777d1ce29b23
Diffstat (limited to 'runtime/native/dalvik_system_DexFile.cc')
-rw-r--r--runtime/native/dalvik_system_DexFile.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 960a1f7375..c04ff5ab29 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -760,6 +760,36 @@ static jboolean DexFile_isProfileGuidedCompilerFilter(JNIEnv* env,
return CompilerFilter::DependsOnProfile(filter) ? JNI_TRUE : JNI_FALSE;
}
+static jboolean DexFile_isVerifiedCompilerFilter(JNIEnv* env,
+ jclass javeDexFileClass ATTRIBUTE_UNUSED,
+ jstring javaCompilerFilter) {
+ ScopedUtfChars compiler_filter(env, javaCompilerFilter);
+ if (env->ExceptionCheck()) {
+ return -1;
+ }
+
+ CompilerFilter::Filter filter;
+ if (!CompilerFilter::ParseCompilerFilter(compiler_filter.c_str(), &filter)) {
+ return JNI_FALSE;
+ }
+ return CompilerFilter::IsVerificationEnabled(filter) ? JNI_TRUE : JNI_FALSE;
+}
+
+static jboolean DexFile_isOptimizedCompilerFilter(JNIEnv* env,
+ jclass javeDexFileClass ATTRIBUTE_UNUSED,
+ jstring javaCompilerFilter) {
+ ScopedUtfChars compiler_filter(env, javaCompilerFilter);
+ if (env->ExceptionCheck()) {
+ return -1;
+ }
+
+ CompilerFilter::Filter filter;
+ if (!CompilerFilter::ParseCompilerFilter(compiler_filter.c_str(), &filter)) {
+ return JNI_FALSE;
+ }
+ return CompilerFilter::IsAotCompilationEnabled(filter) ? JNI_TRUE : JNI_FALSE;
+}
+
static jstring DexFile_getNonProfileGuidedCompilerFilter(JNIEnv* env,
jclass javeDexFileClass ATTRIBUTE_UNUSED,
jstring javaCompilerFilter) {
@@ -983,6 +1013,8 @@ static JNINativeMethod gMethods[] = {
")V"),
NATIVE_METHOD(DexFile, isValidCompilerFilter, "(Ljava/lang/String;)Z"),
NATIVE_METHOD(DexFile, isProfileGuidedCompilerFilter, "(Ljava/lang/String;)Z"),
+ NATIVE_METHOD(DexFile, isVerifiedCompilerFilter, "(Ljava/lang/String;)Z"),
+ NATIVE_METHOD(DexFile, isOptimizedCompilerFilter, "(Ljava/lang/String;)Z"),
NATIVE_METHOD(DexFile,
getNonProfileGuidedCompilerFilter,
"(Ljava/lang/String;)Ljava/lang/String;"),