1 /*
2 * Copyright (C) 2019 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 "common_helper.h"
18
19 #include "jni.h"
20 #include "jvmti.h"
21
22 #include "jvmti_helper.h"
23 #include "scoped_local_ref.h"
24 #include "test_env.h"
25
26 namespace art {
27 namespace common_early_return {
28
Java_art_NonStandardExit_popFrame(JNIEnv * env,jclass k,jthread thr)29 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_popFrame(
30 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr) {
31 JvmtiErrorToException(env, jvmti_env, jvmti_env->PopFrame(thr));
32 }
33
Java_art_NonStandardExit_forceEarlyReturnFloat(JNIEnv * env,jclass k,jthread thr,jfloat val)34 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnFloat(
35 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr, jfloat val) {
36 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnFloat(thr, val));
37 }
38
Java_art_NonStandardExit_forceEarlyReturnDouble(JNIEnv * env,jclass k,jthread thr,jdouble val)39 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnDouble(
40 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr, jdouble val) {
41 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnDouble(thr, val));
42 }
43
Java_art_NonStandardExit_forceEarlyReturnLong(JNIEnv * env,jclass k,jthread thr,jlong val)44 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnLong(
45 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr, jlong val) {
46 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnLong(thr, val));
47 }
48
Java_art_NonStandardExit_forceEarlyReturnInt(JNIEnv * env,jclass k,jthread thr,jint val)49 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnInt(
50 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr, jint val) {
51 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnInt(thr, val));
52 }
53
Java_art_NonStandardExit_forceEarlyReturnVoid(JNIEnv * env,jclass k,jthread thr)54 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnVoid(
55 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr) {
56 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnVoid(thr));
57 }
58
Java_art_NonStandardExit_forceEarlyReturnObject(JNIEnv * env,jclass k,jthread thr,jobject val)59 extern "C" JNIEXPORT void JNICALL Java_art_NonStandardExit_forceEarlyReturnObject(
60 JNIEnv* env, [[maybe_unused]] jclass k, jthread thr, jobject val) {
61 JvmtiErrorToException(env, jvmti_env, jvmti_env->ForceEarlyReturnObject(thr, val));
62 }
63
64 } // namespace common_early_return
65 } // namespace art
66