1e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light/*
2e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * Copyright (C) 2018 The Android Open Source Project
3e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light *
4e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * Licensed under the Apache License, Version 2.0 (the "License");
5e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * you may not use this file except in compliance with the License.
6e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * You may obtain a copy of the License at
7e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light *
8e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light *      http://www.apache.org/licenses/LICENSE-2.0
9e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light *
10e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * Unless required by applicable law or agreed to in writing, software
11e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * distributed under the License is distributed on an "AS IS" BASIS,
12e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * See the License for the specific language governing permissions and
14e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light * limitations under the License.
15e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light */
16e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light
17e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light#include "jni.h"
18e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light#include "art_method-inl.h"
19e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light#include "jni_internal.h"
20e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light#include "instrumentation.h"
21e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light#include "scoped_thread_state_change-inl.h"
22e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light
23e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Lightnamespace art {
24e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light
25e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Lightextern "C" JNIEXPORT jboolean JNICALL Java_Main_isMethodDeoptimized(JNIEnv*, jclass, jobject m) {
26e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light  ScopedObjectAccess soa(art::Thread::Current());
27e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light  ArtMethod* art_method = ArtMethod::FromReflectedMethod(soa, m);
28e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light  return Runtime::Current()->GetInstrumentation()->IsDeoptimized(art_method);
29e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light}
30e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light
31e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Lightextern "C" JNIEXPORT jboolean JNICALL Java_Main_isInterpretOnly(JNIEnv*, jclass) {
32e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light  return Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly();
33e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light}
34e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light
35e34fe44a04a28d5688e0ae5effee9922c26c5916Alex Light}  // namespace art
36