blob: 554784effed3f233f77b52d382bf91ac6acebd38 [file] [log] [blame]
Alex Lightb7edcda2017-04-27 13:20:31 -07001/*
2 * Copyright (C) 2013 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 <inttypes.h>
18#include <memory>
19#include <stdio.h>
20
21#include "android-base/logging.h"
22#include "android-base/stringprintf.h"
23
24#include "jni.h"
25#include "jvmti.h"
26#include "scoped_local_ref.h"
27
28// Test infrastructure
29#include "jni_binder.h"
30#include "jni_helper.h"
31#include "jvmti_helper.h"
32#include "test_env.h"
33#include "ti_macros.h"
34
35namespace art {
36namespace Test989StackTraceThrow {
37
38extern "C" JNIEXPORT
39jfloat JNICALL Java_art_Test989_returnFloatNative(JNIEnv* env, jclass klass) {
40 jmethodID targetMethod = env->GetStaticMethodID(klass, "doGetFloat", "()F");
41 return env->CallStaticFloatMethod(klass, targetMethod);
42}
43extern "C" JNIEXPORT
44jdouble JNICALL Java_art_Test989_returnDoubleNative(JNIEnv* env, jclass klass) {
45 jmethodID targetMethod = env->GetStaticMethodID(klass, "doGetDouble", "()D");
46 return env->CallStaticDoubleMethod(klass, targetMethod);
47}
48
49extern "C" JNIEXPORT jobject JNICALL Java_art_Test989_returnValueNative(JNIEnv* env, jclass klass) {
50 jmethodID targetMethod = env->GetStaticMethodID(klass, "mkTestObject", "()Ljava/lang/Object;");
51 return env->CallStaticObjectMethod(klass, targetMethod);
52}
53
54extern "C" JNIEXPORT void JNICALL Java_art_Test989_doNothingNative(JNIEnv* env ATTRIBUTE_UNUSED,
55 jclass klass ATTRIBUTE_UNUSED) {
56 return;
57}
58
59extern "C" JNIEXPORT void JNICALL Java_art_Test989_throwANative(JNIEnv* env,
60 jclass klass) {
61 jmethodID targetMethod = env->GetStaticMethodID(klass, "doThrowA", "()V");
62 env->CallStaticVoidMethod(klass, targetMethod);
63}
64
65extern "C" JNIEXPORT void JNICALL Java_art_Test989_acceptValueNative(JNIEnv* env,
66 jclass klass,
67 jobject arg) {
68 jmethodID targetMethod = env->GetStaticMethodID(klass, "printObject", "(Ljava/lang/Object;)V");
69 env->CallStaticVoidMethod(klass, targetMethod, arg);
70}
71
72} // namespace Test989StackTraceThrow
73} // namespace art
74