author | mgronlun |
Wed, 30 Oct 2019 19:43:52 +0100 | |
changeset 58863 | c16ac7a2eba4 |
parent 53244 | 9807daeb47c4 |
child 59259 | 127ca611f19b |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
50113 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
25 |
#ifndef SHARE_JFR_JNI_JFRJAVASUPPORT_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
26 |
#define SHARE_JFR_JNI_JFRJAVASUPPORT_HPP |
50113 | 27 |
|
28 |
#include "jfr/jni/jfrJavaCall.hpp" |
|
29 |
#include "utilities/exceptions.hpp" |
|
30 |
||
31 |
class Klass; |
|
32 |
class outputStream; |
|
33 |
||
34 |
class JfrJavaSupport : public AllStatic { |
|
35 |
public: |
|
36 |
static jobject local_jni_handle(const oop obj, Thread* t); |
|
37 |
static jobject local_jni_handle(const jobject handle, Thread* t); |
|
58863 | 38 |
static void destroy_local_jni_handle(jobject handle); |
50113 | 39 |
|
40 |
static jobject global_jni_handle(const oop obj, Thread* t); |
|
41 |
static jobject global_jni_handle(const jobject handle, Thread* t); |
|
58863 | 42 |
static void destroy_global_jni_handle(jobject handle); |
43 |
||
44 |
static jweak global_weak_jni_handle(const oop obj, Thread* t); |
|
45 |
static jweak global_weak_jni_handle(const jobject handle, Thread* t); |
|
46 |
static void destroy_global_weak_jni_handle(jweak handle); |
|
50113 | 47 |
|
48 |
static oop resolve_non_null(jobject obj); |
|
49 |
static void notify_all(jobject obj, TRAPS); |
|
50 |
static void set_array_element(jobjectArray arr, jobject element, int index, Thread* t); |
|
51 |
||
52 |
// naked oop result |
|
53 |
static void call_static(JfrJavaArguments* args, TRAPS); |
|
54 |
static void call_special(JfrJavaArguments* args, TRAPS); |
|
55 |
static void call_virtual(JfrJavaArguments* args, TRAPS); |
|
56 |
||
57 |
static void set_field(JfrJavaArguments* args, TRAPS); |
|
58 |
static void get_field(JfrJavaArguments* args, TRAPS); |
|
59 |
static void new_object(JfrJavaArguments* args, TRAPS); |
|
60 |
||
61 |
// global jni handle result |
|
62 |
static void new_object_global_ref(JfrJavaArguments* args, TRAPS); |
|
63 |
static void get_field_global_ref(JfrJavaArguments* args, TRAPS); |
|
64 |
||
65 |
// local jni handle result |
|
66 |
static void new_object_local_ref(JfrJavaArguments* args, TRAPS); |
|
67 |
static void get_field_local_ref(JfrJavaArguments* args, TRAPS); |
|
68 |
||
69 |
static jstring new_string(const char* c_str, TRAPS); |
|
70 |
static jobjectArray new_string_array(int length, TRAPS); |
|
71 |
||
72 |
static jobject new_java_lang_Boolean(bool value, TRAPS); |
|
73 |
static jobject new_java_lang_Integer(jint value, TRAPS); |
|
74 |
static jobject new_java_lang_Long(jlong value, TRAPS); |
|
75 |
||
76 |
// misc |
|
77 |
static Klass* klass(const jobject handle); |
|
78 |
// caller needs ResourceMark |
|
79 |
static const char* c_str(jstring string, Thread* jt); |
|
80 |
||
81 |
// exceptions |
|
82 |
static void throw_illegal_state_exception(const char* message, TRAPS); |
|
83 |
static void throw_illegal_argument_exception(const char* message, TRAPS); |
|
84 |
static void throw_internal_error(const char* message, TRAPS); |
|
85 |
static void throw_out_of_memory_error(const char* message, TRAPS); |
|
86 |
static void throw_class_format_error(const char* message, TRAPS); |
|
87 |
||
88 |
static bool is_jdk_jfr_module_available(); |
|
89 |
static bool is_jdk_jfr_module_available(outputStream* stream, TRAPS); |
|
90 |
||
58863 | 91 |
static jlong jfr_thread_id(jobject thread); |
92 |
static void exclude(jobject thread); |
|
93 |
static void include(jobject thread); |
|
94 |
static bool is_excluded(jobject thread); |
|
95 |
static void on_thread_start(Thread* t); |
|
50113 | 96 |
|
97 |
// critical |
|
98 |
static void abort(jstring errorMsg, TRAPS); |
|
99 |
static void uncaught_exception(jthrowable throwable, Thread* t); |
|
100 |
||
101 |
// asserts |
|
102 |
DEBUG_ONLY(static void check_java_thread_in_vm(Thread* t);) |
|
103 |
DEBUG_ONLY(static void check_java_thread_in_native(Thread* t);) |
|
104 |
||
105 |
enum CAUSE { |
|
106 |
VM_ERROR, |
|
107 |
OUT_OF_MEMORY, |
|
108 |
STACK_OVERFLOW, |
|
109 |
RUNTIME_EXCEPTION, |
|
110 |
UNKNOWN, |
|
111 |
NOF_CAUSES |
|
112 |
}; |
|
113 |
||
114 |
static CAUSE cause(); |
|
115 |
||
116 |
private: |
|
117 |
static CAUSE _cause; |
|
118 |
static void set_cause(jthrowable throwable, Thread* t); |
|
119 |
}; |
|
120 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
121 |
#endif // SHARE_JFR_JNI_JFRJAVASUPPORT_HPP |