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