1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "dex/dex_file.h"
18 
19 #include "art_method-inl.h"
20 #include "dex/method_reference.h"
21 #include "jni.h"
22 #include "mirror/class-inl.h"
23 #include "mirror/executable.h"
24 #include "scoped_thread_state_change-inl.h"
25 #include "thread.h"
26 
27 namespace art {
28 namespace {
29 
Java_Main_testCompiled(JNIEnv * env,jclass,jobject method)30 extern "C" JNIEXPORT jboolean JNICALL Java_Main_testCompiled(JNIEnv* env,
31                                                              jclass,
32                                                              jobject method) {
33   CHECK(method != nullptr);
34   ScopedObjectAccess soa(env);
35   ObjPtr<mirror::Executable> exec = soa.Decode<mirror::Executable>(method);
36   ArtMethod* art_method = exec->GetArtMethod();
37   return art_method->HasAnyCompiledCode();
38 }
39 
40 }  // namespace
41 }  // namespace art
42