annotate src/share/vm/prims/jniCheck.cpp @ 23842:d109bda16490

Merge
author asaha
date Tue, 05 Apr 2016 08:55:39 -0700
parents 9904bb920313
children dd9cc155639c fde446cb8e19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1142
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1142
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1142
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "classfile/vmSymbols.hpp"
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
28 #include "memory/guardedMemory.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "oops/instanceKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "oops/oop.inline.hpp"
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1989
diff changeset
31 #include "oops/symbol.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "prims/jni.h"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "prims/jniCheck.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "prims/jvm_misc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "runtime/fieldDescriptor.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "runtime/handles.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #include "runtime/interfaceSupport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #include "runtime/jfieldIDWorkaround.hpp"
20197
ce8f6bb717c9 8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents: 17937
diff changeset
39 #include "runtime/thread.inline.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #ifdef TARGET_ARCH_x86
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
41 # include "jniTypes_x86.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
42 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
43 #ifdef TARGET_ARCH_sparc
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
44 # include "jniTypes_sparc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
45 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
46 #ifdef TARGET_ARCH_zero
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
47 # include "jniTypes_zero.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
48 #endif
2192
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
49 #ifdef TARGET_ARCH_arm
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
50 # include "jniTypes_arm.hpp"
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
51 #endif
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
52 #ifdef TARGET_ARCH_ppc
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
53 # include "jniTypes_ppc.hpp"
b92c45f2bc75 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 2177
diff changeset
54 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
56 // Complain every extra number of unplanned local refs
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
57 #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Heap objects are allowed to be directly referenced only in VM code,
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // not in native code.
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 #define ASSERT_OOPS_ALLOWED \
a61af66fc99e Initial load
duke
parents:
diff changeset
63 assert(JavaThread::current()->thread_state() == _thread_in_vm, \
a61af66fc99e Initial load
duke
parents:
diff changeset
64 "jniCheck examining oops in bad state.")
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Execute the given block of source code with the thread in VM state.
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // To do this, transition from the NATIVE state to the VM state, execute
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // the code, and transtition back. The ThreadInVMfromNative constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // performs the transition to VM state, its destructor restores the
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // NATIVE state.
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 #define IN_VM(source_code) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
74 { \
a61af66fc99e Initial load
duke
parents:
diff changeset
75 ThreadInVMfromNative __tiv(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
76 source_code \
a61af66fc99e Initial load
duke
parents:
diff changeset
77 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
82 * DECLARATIONS
a61af66fc99e Initial load
duke
parents:
diff changeset
83 */
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 static struct JNINativeInterface_ * unchecked_jni_NativeInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
89 * MACRO DEFINITIONS
a61af66fc99e Initial load
duke
parents:
diff changeset
90 */
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // All JNI checked functions here use JNI_ENTRY_CHECKED() instead of the
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // QUICK_ENTRY or LEAF variants found in jni.cpp. This allows handles
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // to be created if a fatal error should occur.
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Check for thread not attached to VM; need to catch this before
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // assertions in the wrapper routines might fire
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Check for env being the one value appropriate for this thread.
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 #define JNI_ENTRY_CHECKED(result_type, header) \
a61af66fc99e Initial load
duke
parents:
diff changeset
102 extern "C" { \
a61af66fc99e Initial load
duke
parents:
diff changeset
103 result_type JNICALL header { \
a61af66fc99e Initial load
duke
parents:
diff changeset
104 JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
a61af66fc99e Initial load
duke
parents:
diff changeset
105 if (thr == NULL || !thr->is_Java_thread()) { \
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17467
diff changeset
106 tty->print_cr("%s", fatal_using_jnienv_in_nonjava); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 os::abort(true); \
a61af66fc99e Initial load
duke
parents:
diff changeset
108 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
109 JNIEnv* xenv = thr->jni_environment(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if (env != xenv) { \
a61af66fc99e Initial load
duke
parents:
diff changeset
111 NativeReportJNIFatalError(thr, warn_wrong_jnienv); \
a61af66fc99e Initial load
duke
parents:
diff changeset
112 } \
4045
a6eef545f1a2 7103224: collision between __LEAF define in interfaceSupport.hpp and /usr/include/sys/cdefs.h with gcc
never
parents: 2376
diff changeset
113 VM_ENTRY_BASE(result_type, header, thr)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 #define UNCHECKED() (unchecked_jni_NativeInterface)
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static const char * warn_wrong_jnienv = "Using JNIEnv in the wrong thread";
a61af66fc99e Initial load
duke
parents:
diff changeset
119 static const char * warn_bad_class_descriptor = "JNI FindClass received a bad class descriptor \"%s\". A correct class descriptor " \
a61af66fc99e Initial load
duke
parents:
diff changeset
120 "has no leading \"L\" or trailing \";\". Incorrect descriptors will not be accepted in future releases.";
a61af66fc99e Initial load
duke
parents:
diff changeset
121 static const char * fatal_using_jnienv_in_nonjava = "FATAL ERROR in native method: Using JNIEnv in non-Java thread";
a61af66fc99e Initial load
duke
parents:
diff changeset
122 static const char * warn_other_function_in_critical = "Warning: Calling other JNI functions in the scope of " \
a61af66fc99e Initial load
duke
parents:
diff changeset
123 "Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical";
a61af66fc99e Initial load
duke
parents:
diff changeset
124 static const char * fatal_bad_ref_to_jni = "Bad global or local ref passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
125 static const char * fatal_received_null_class = "JNI received a null class";
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static const char * fatal_class_not_a_class = "JNI received a class argument that is not a class";
a61af66fc99e Initial load
duke
parents:
diff changeset
127 static const char * fatal_class_not_a_throwable_class = "JNI Throw or ThrowNew received a class argument that is not a Throwable or Throwable subclass";
a61af66fc99e Initial load
duke
parents:
diff changeset
128 static const char * fatal_wrong_class_or_method = "Wrong object class or methodID passed to JNI call";
917
1760a1cbed36 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 470
diff changeset
129 static const char * fatal_non_weak_method = "non-weak methodID passed to JNI call";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
130 static const char * fatal_unknown_array_object = "Unknown array object passed to JNI array operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
131 static const char * fatal_object_array_expected = "Object array expected but not received for JNI array operation";
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
132 static const char * fatal_prim_type_array_expected = "Primitive type array expected but not received for JNI array operation";
0
a61af66fc99e Initial load
duke
parents:
diff changeset
133 static const char * fatal_non_array = "Non-array passed to JNI array operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
134 static const char * fatal_element_type_mismatch = "Array element type mismatch in JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
135 static const char * fatal_should_be_static = "Non-static field ID passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
136 static const char * fatal_wrong_static_field = "Wrong static field ID passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
137 static const char * fatal_static_field_not_found = "Static field not found in JNI get/set field operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
138 static const char * fatal_static_field_mismatch = "Field type (static) mismatch in JNI get/set field operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
139 static const char * fatal_should_be_nonstatic = "Static field ID passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
140 static const char * fatal_null_object = "Null object passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
141 static const char * fatal_wrong_field = "Wrong field ID passed to JNI";
a61af66fc99e Initial load
duke
parents:
diff changeset
142 static const char * fatal_instance_field_not_found = "Instance field not found in JNI get/set field operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
143 static const char * fatal_instance_field_mismatch = "Field type (instance) mismatch in JNI get/set field operations";
a61af66fc99e Initial load
duke
parents:
diff changeset
144 static const char * fatal_non_string = "JNI string operation received a non-string";
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // When in VM state:
a61af66fc99e Initial load
duke
parents:
diff changeset
148 static void ReportJNIWarning(JavaThread* thr, const char *msg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 tty->print_cr("WARNING in native method: %s", msg);
a61af66fc99e Initial load
duke
parents:
diff changeset
150 thr->print_stack();
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // When in NATIVE state:
a61af66fc99e Initial load
duke
parents:
diff changeset
154 static void NativeReportJNIFatalError(JavaThread* thr, const char *msg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
156 ReportJNIFatalError(thr, msg);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 )
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 static void NativeReportJNIWarning(JavaThread* thr, const char *msg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
162 ReportJNIWarning(thr, msg);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 )
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
170 * SUPPORT FUNCTIONS
a61af66fc99e Initial load
duke
parents:
diff changeset
171 */
a61af66fc99e Initial load
duke
parents:
diff changeset
172
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
173 /**
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
174 * Check whether or not a programmer has actually checked for exceptions. According
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
175 * to the JNI Specification ("jni/spec/design.html#java_exceptions"):
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
176 *
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
177 * There are two cases where the programmer needs to check for exceptions without
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
178 * being able to first check an error code:
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
179 *
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
180 * - The JNI functions that invoke a Java method return the result of the Java method.
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
181 * The programmer must call ExceptionOccurred() to check for possible exceptions
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
182 * that occurred during the execution of the Java method.
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
183 *
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
184 * - Some of the JNI array access functions do not return an error code, but may
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
185 * throw an ArrayIndexOutOfBoundsException or ArrayStoreException.
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
186 *
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
187 * In all other cases, a non-error return value guarantees that no exceptions have been thrown.
23039
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
188 *
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
189 * Programmers often defend against ArrayIndexOutOfBoundsException, so warning
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
190 * for these functions would be pedantic.
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
191 */
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
192 static inline void
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
193 check_pending_exception(JavaThread* thr) {
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
194 if (thr->has_pending_exception()) {
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
195 NativeReportJNIWarning(thr, "JNI call made with exception pending");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
196 }
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
197 if (thr->is_pending_jni_exception_check()) {
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
198 IN_VM(
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
199 tty->print_cr("WARNING in native method: JNI call made without checking exceptions when required to from %s",
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
200 thr->get_pending_jni_exception_check());
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
201 thr->print_stack();
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
202 )
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
203 thr->clear_pending_jni_exception_check(); // Just complain once
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
204 }
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
205 }
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
206
23039
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
207 /**
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
208 * Add to the planned number of handles. I.e. plus current live & warning threshold
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
209 */
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
210 static inline void
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
211 add_planned_handle_capacity(JNIHandleBlock* handles, size_t capacity) {
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
212 handles->set_planned_capacity(capacity +
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
213 handles->get_number_of_live_handles() +
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
214 CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD);
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
215 }
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
216
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
217
0
a61af66fc99e Initial load
duke
parents:
diff changeset
218 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
219 functionEnterCritical(JavaThread* thr)
a61af66fc99e Initial load
duke
parents:
diff changeset
220 {
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
221 check_pending_exception(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
222 }
a61af66fc99e Initial load
duke
parents:
diff changeset
223
a61af66fc99e Initial load
duke
parents:
diff changeset
224 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
225 functionEnterCriticalExceptionAllowed(JavaThread* thr)
a61af66fc99e Initial load
duke
parents:
diff changeset
226 {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
230 functionEnter(JavaThread* thr)
a61af66fc99e Initial load
duke
parents:
diff changeset
231 {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (thr->in_critical()) {
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17467
diff changeset
233 tty->print_cr("%s", warn_other_function_in_critical);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
234 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
235 check_pending_exception(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
239 functionEnterExceptionAllowed(JavaThread* thr)
a61af66fc99e Initial load
duke
parents:
diff changeset
240 {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 if (thr->in_critical()) {
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17467
diff changeset
242 tty->print_cr("%s", warn_other_function_in_critical);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 static inline void
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
247 functionExit(JavaThread* thr)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
248 {
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
249 JNIHandleBlock* handles = thr->active_handles();
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
250 size_t planned_capacity = handles->get_planned_capacity();
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
251 size_t live_handles = handles->get_number_of_live_handles();
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
252 if (live_handles > planned_capacity) {
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
253 IN_VM(
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
254 tty->print_cr("WARNING: JNI local refs: %zu, exceeds capacity: %zu",
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
255 live_handles, planned_capacity);
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
256 thr->print_stack();
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
257 )
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
258 // Complain just the once, reset to current + warn threshold
23039
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
259 add_planned_handle_capacity(handles, 0);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
260 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
261 }
a61af66fc99e Initial load
duke
parents:
diff changeset
262
a61af66fc99e Initial load
duke
parents:
diff changeset
263 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
264 checkStaticFieldID(JavaThread* thr, jfieldID fid, jclass cls, int ftype)
a61af66fc99e Initial load
duke
parents:
diff changeset
265 {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 fieldDescriptor fd;
a61af66fc99e Initial load
duke
parents:
diff changeset
267
a61af66fc99e Initial load
duke
parents:
diff changeset
268 /* make sure it is a static field */
a61af66fc99e Initial load
duke
parents:
diff changeset
269 if (!jfieldIDWorkaround::is_static_jfieldID(fid))
a61af66fc99e Initial load
duke
parents:
diff changeset
270 ReportJNIFatalError(thr, fatal_should_be_static);
a61af66fc99e Initial load
duke
parents:
diff changeset
271
a61af66fc99e Initial load
duke
parents:
diff changeset
272 /* validate the class being passed */
a61af66fc99e Initial load
duke
parents:
diff changeset
273 ASSERT_OOPS_ALLOWED;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
274 Klass* k_oop = jniCheck::validate_class(thr, cls, false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
275
a61af66fc99e Initial load
duke
parents:
diff changeset
276 /* check for proper subclass hierarchy */
a61af66fc99e Initial load
duke
parents:
diff changeset
277 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fid);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
278 Klass* f_oop = id->holder();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
279 if (!InstanceKlass::cast(k_oop)->is_subtype_of(f_oop))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
280 ReportJNIFatalError(thr, fatal_wrong_static_field);
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 /* check for proper field type */
2376
c7f3d0b4570f 7017732: move static fields into Class to prepare for perm gen removal
never
parents: 2192
diff changeset
283 if (!id->find_local_field(&fd))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
284 ReportJNIFatalError(thr, fatal_static_field_not_found);
a61af66fc99e Initial load
duke
parents:
diff changeset
285 if ((fd.field_type() != ftype) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
286 !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
287 ReportJNIFatalError(thr, fatal_static_field_mismatch);
a61af66fc99e Initial load
duke
parents:
diff changeset
288 }
a61af66fc99e Initial load
duke
parents:
diff changeset
289 }
a61af66fc99e Initial load
duke
parents:
diff changeset
290
a61af66fc99e Initial load
duke
parents:
diff changeset
291 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
292 checkInstanceFieldID(JavaThread* thr, jfieldID fid, jobject obj, int ftype)
a61af66fc99e Initial load
duke
parents:
diff changeset
293 {
a61af66fc99e Initial load
duke
parents:
diff changeset
294 fieldDescriptor fd;
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 /* make sure it is an instance field */
a61af66fc99e Initial load
duke
parents:
diff changeset
297 if (jfieldIDWorkaround::is_static_jfieldID(fid))
a61af66fc99e Initial load
duke
parents:
diff changeset
298 ReportJNIFatalError(thr, fatal_should_be_nonstatic);
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300 /* validate the object being passed and then get its class */
a61af66fc99e Initial load
duke
parents:
diff changeset
301 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
302 oop oopObj = jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
303 if (!oopObj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
304 ReportJNIFatalError(thr, fatal_null_object);
a61af66fc99e Initial load
duke
parents:
diff changeset
305 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
306 Klass* k_oop = oopObj->klass();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
307
a61af66fc99e Initial load
duke
parents:
diff changeset
308 if (!jfieldIDWorkaround::is_valid_jfieldID(k_oop, fid)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 ReportJNIFatalError(thr, fatal_wrong_field);
a61af66fc99e Initial load
duke
parents:
diff changeset
310 }
a61af66fc99e Initial load
duke
parents:
diff changeset
311
a61af66fc99e Initial load
duke
parents:
diff changeset
312 /* make sure the field exists */
a61af66fc99e Initial load
duke
parents:
diff changeset
313 int offset = jfieldIDWorkaround::from_instance_jfieldID(k_oop, fid);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
314 if (!InstanceKlass::cast(k_oop)->contains_field_offset(offset))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
315 ReportJNIFatalError(thr, fatal_wrong_field);
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317 /* check for proper field type */
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
318 if (!InstanceKlass::cast(k_oop)->find_field_from_offset(offset,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
319 false, &fd))
a61af66fc99e Initial load
duke
parents:
diff changeset
320 ReportJNIFatalError(thr, fatal_instance_field_not_found);
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 if ((fd.field_type() != ftype) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
323 !(fd.field_type() == T_ARRAY && ftype == T_OBJECT)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
324 ReportJNIFatalError(thr, fatal_instance_field_mismatch);
a61af66fc99e Initial load
duke
parents:
diff changeset
325 }
a61af66fc99e Initial load
duke
parents:
diff changeset
326 }
a61af66fc99e Initial load
duke
parents:
diff changeset
327
a61af66fc99e Initial load
duke
parents:
diff changeset
328 static inline void
a61af66fc99e Initial load
duke
parents:
diff changeset
329 checkString(JavaThread* thr, jstring js)
a61af66fc99e Initial load
duke
parents:
diff changeset
330 {
a61af66fc99e Initial load
duke
parents:
diff changeset
331 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
332 oop s = jniCheck::validate_object(thr, js);
a61af66fc99e Initial load
duke
parents:
diff changeset
333 if (!s || !java_lang_String::is_instance(s))
a61af66fc99e Initial load
duke
parents:
diff changeset
334 ReportJNIFatalError(thr, fatal_non_string);
a61af66fc99e Initial load
duke
parents:
diff changeset
335 }
a61af66fc99e Initial load
duke
parents:
diff changeset
336
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
337 static inline arrayOop
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
338 check_is_array(JavaThread* thr, jarray jArray)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
339 {
a61af66fc99e Initial load
duke
parents:
diff changeset
340 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
341 arrayOop aOop;
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 aOop = (arrayOop)jniCheck::validate_object(thr, jArray);
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
344 if (aOop == NULL || !aOop->is_array()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
345 ReportJNIFatalError(thr, fatal_non_array);
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
346 }
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
347 return aOop;
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
348 }
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
349
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
350 static inline arrayOop
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
351 check_is_primitive_array(JavaThread* thr, jarray jArray) {
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
352 arrayOop aOop = check_is_array(thr, jArray);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
353
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
354 if (!aOop->is_typeArray()) {
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
355 ReportJNIFatalError(thr, fatal_prim_type_array_expected);
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
356 }
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
357 return aOop;
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
358 }
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
359
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
360 static inline void
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
361 check_primitive_array_type(JavaThread* thr, jarray jArray, BasicType elementType)
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
362 {
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
363 BasicType array_type;
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
364 arrayOop aOop;
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
365
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
366 aOop = check_is_primitive_array(thr, jArray);
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
367 array_type = TypeArrayKlass::cast(aOop->klass())->element_type();
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
368 if (array_type != elementType) {
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
369 ReportJNIFatalError(thr, fatal_element_type_mismatch);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
370 }
a61af66fc99e Initial load
duke
parents:
diff changeset
371 }
a61af66fc99e Initial load
duke
parents:
diff changeset
372
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
373 static inline void
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
374 check_is_obj_array(JavaThread* thr, jarray jArray) {
11150
c29568b733d2 8020697: jniCheck.cpp:check_is_obj_array asserts on TypeArrayKlass::cast(aOop->klass())
dholmes
parents: 11145
diff changeset
375 arrayOop aOop = check_is_array(thr, jArray);
c29568b733d2 8020697: jniCheck.cpp:check_is_obj_array asserts on TypeArrayKlass::cast(aOop->klass())
dholmes
parents: 11145
diff changeset
376 if (!aOop->is_objArray()) {
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
377 ReportJNIFatalError(thr, fatal_object_array_expected);
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
378 }
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
379 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
380
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
381 /*
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
382 * Copy and wrap array elements for bounds checking.
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
383 * Remember the original elements (GuardedMemory::get_tag())
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
384 */
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
385 static void* check_jni_wrap_copy_array(JavaThread* thr, jarray array,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
386 void* orig_elements) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
387 void* result;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
388 IN_VM(
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
389 oop a = JNIHandles::resolve_non_null(array);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
390 size_t len = arrayOop(a)->length() <<
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
391 TypeArrayKlass::cast(a->klass())->log2_element_size();
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
392 result = GuardedMemory::wrap_copy(orig_elements, len, orig_elements);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
393 )
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
394 return result;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
395 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
396
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
397 static void* check_wrapped_array(JavaThread* thr, const char* fn_name,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
398 void* obj, void* carray, size_t* rsz) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
399 if (carray == NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
400 tty->print_cr("%s: elements vector NULL" PTR_FORMAT, fn_name, p2i(obj));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
401 NativeReportJNIFatalError(thr, "Elements vector NULL");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
402 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
403 GuardedMemory guarded(carray);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
404 void* orig_result = guarded.get_tag();
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
405 if (!guarded.verify_guards()) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
406 tty->print_cr("ReleasePrimitiveArrayCritical: release array failed bounds "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
407 "check, incorrect pointer returned ? array: " PTR_FORMAT " carray: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
408 PTR_FORMAT, p2i(obj), p2i(carray));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
409 guarded.print_on(tty);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
410 NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
411 "failed bounds check");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
412 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
413 if (orig_result == NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
414 tty->print_cr("ReleasePrimitiveArrayCritical: unrecognized elements. array: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
415 PTR_FORMAT " carray: " PTR_FORMAT, p2i(obj), p2i(carray));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
416 guarded.print_on(tty);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
417 NativeReportJNIFatalError(thr, "ReleasePrimitiveArrayCritical: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
418 "unrecognized elements");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
419 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
420 if (rsz != NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
421 *rsz = guarded.get_user_size();
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
422 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
423 return orig_result;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
424 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
425
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
426 static void* check_wrapped_array_release(JavaThread* thr, const char* fn_name,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
427 void* obj, void* carray, jint mode) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
428 size_t sz;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
429 void* orig_result = check_wrapped_array(thr, fn_name, obj, carray, &sz);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
430 switch (mode) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
431 case 0:
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
432 memcpy(orig_result, carray, sz);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
433 GuardedMemory::free_copy(carray);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
434 break;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
435 case JNI_COMMIT:
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
436 memcpy(orig_result, carray, sz);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
437 break;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
438 case JNI_ABORT:
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
439 GuardedMemory::free_copy(carray);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
440 break;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
441 default:
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
442 tty->print_cr("%s: Unrecognized mode %i releasing array "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
443 PTR_FORMAT " elements " PTR_FORMAT, fn_name, mode, p2i(obj), p2i(carray));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
444 NativeReportJNIFatalError(thr, "Unrecognized array release mode");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
445 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
446 return orig_result;
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
447 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
448
0
a61af66fc99e Initial load
duke
parents:
diff changeset
449 oop jniCheck::validate_handle(JavaThread* thr, jobject obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
450 if (JNIHandles::is_frame_handle(thr, obj) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
451 JNIHandles::is_local_handle(thr, obj) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
452 JNIHandles::is_global_handle(obj) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
453 JNIHandles::is_weak_global_handle(obj)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
454 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
455 return JNIHandles::resolve_external_guard(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
456 }
a61af66fc99e Initial load
duke
parents:
diff changeset
457 ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
a61af66fc99e Initial load
duke
parents:
diff changeset
458 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
459 }
a61af66fc99e Initial load
duke
parents:
diff changeset
460
a61af66fc99e Initial load
duke
parents:
diff changeset
461
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
462 Method* jniCheck::validate_jmethod_id(JavaThread* thr, jmethodID method_id) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
463 ASSERT_OOPS_ALLOWED;
917
1760a1cbed36 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 470
diff changeset
464 // do the fast jmethodID check first
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
465 Method* moop = Method::checked_resolve_jmethod_id(method_id);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
466 if (moop == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
467 ReportJNIFatalError(thr, fatal_wrong_class_or_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
468 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
469 // jmethodIDs are supposed to be weak handles in the class loader data,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
470 // but that can be expensive so check it last
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
471 else if (!Method::is_method_id(method_id)) {
917
1760a1cbed36 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 470
diff changeset
472 ReportJNIFatalError(thr, fatal_non_weak_method);
1760a1cbed36 6862945: 4/3 conversion of jmethodID to methodOop in JVMTI is too expensive
dcubed
parents: 470
diff changeset
473 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
474 return moop;
a61af66fc99e Initial load
duke
parents:
diff changeset
475 }
a61af66fc99e Initial load
duke
parents:
diff changeset
476
a61af66fc99e Initial load
duke
parents:
diff changeset
477
a61af66fc99e Initial load
duke
parents:
diff changeset
478 oop jniCheck::validate_object(JavaThread* thr, jobject obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
479 if (!obj)
a61af66fc99e Initial load
duke
parents:
diff changeset
480 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
481 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
482 oop oopObj = jniCheck::validate_handle(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
483 if (!oopObj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
484 ReportJNIFatalError(thr, fatal_bad_ref_to_jni);
a61af66fc99e Initial load
duke
parents:
diff changeset
485 }
a61af66fc99e Initial load
duke
parents:
diff changeset
486 return oopObj;
a61af66fc99e Initial load
duke
parents:
diff changeset
487 }
a61af66fc99e Initial load
duke
parents:
diff changeset
488
a61af66fc99e Initial load
duke
parents:
diff changeset
489 // Warn if a class descriptor is in decorated form; class descriptors
a61af66fc99e Initial load
duke
parents:
diff changeset
490 // passed to JNI findClass should not be decorated unless they are
a61af66fc99e Initial load
duke
parents:
diff changeset
491 // array descriptors.
a61af66fc99e Initial load
duke
parents:
diff changeset
492 void jniCheck::validate_class_descriptor(JavaThread* thr, const char* name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
493 if (name == NULL) return; // implementation accepts NULL so just return
a61af66fc99e Initial load
duke
parents:
diff changeset
494
a61af66fc99e Initial load
duke
parents:
diff changeset
495 size_t len = strlen(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
496
a61af66fc99e Initial load
duke
parents:
diff changeset
497 if (len >= 2 &&
a61af66fc99e Initial load
duke
parents:
diff changeset
498 name[0] == JVM_SIGNATURE_CLASS && // 'L'
a61af66fc99e Initial load
duke
parents:
diff changeset
499 name[len-1] == JVM_SIGNATURE_ENDCLASS ) { // ';'
a61af66fc99e Initial load
duke
parents:
diff changeset
500 char msg[JVM_MAXPATHLEN];
a61af66fc99e Initial load
duke
parents:
diff changeset
501 jio_snprintf(msg, JVM_MAXPATHLEN, warn_bad_class_descriptor, name);
a61af66fc99e Initial load
duke
parents:
diff changeset
502 ReportJNIWarning(thr, msg);
a61af66fc99e Initial load
duke
parents:
diff changeset
503 }
a61af66fc99e Initial load
duke
parents:
diff changeset
504 }
a61af66fc99e Initial load
duke
parents:
diff changeset
505
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
506 Klass* jniCheck::validate_class(JavaThread* thr, jclass clazz, bool allow_primitive) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
507 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
508 oop mirror = jniCheck::validate_handle(thr, clazz);
a61af66fc99e Initial load
duke
parents:
diff changeset
509 if (!mirror) {
a61af66fc99e Initial load
duke
parents:
diff changeset
510 ReportJNIFatalError(thr, fatal_received_null_class);
a61af66fc99e Initial load
duke
parents:
diff changeset
511 }
a61af66fc99e Initial load
duke
parents:
diff changeset
512
1142
4ce7240d622c 6914300: ciEnv should export all well known classes
never
parents: 917
diff changeset
513 if (mirror->klass() != SystemDictionary::Class_klass()) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
514 ReportJNIFatalError(thr, fatal_class_not_a_class);
a61af66fc99e Initial load
duke
parents:
diff changeset
515 }
a61af66fc99e Initial load
duke
parents:
diff changeset
516
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
517 Klass* k = java_lang_Class::as_Klass(mirror);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
518 // Make allowances for primitive classes ...
a61af66fc99e Initial load
duke
parents:
diff changeset
519 if (!(k != NULL || allow_primitive && java_lang_Class::is_primitive(mirror))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
520 ReportJNIFatalError(thr, fatal_class_not_a_class);
a61af66fc99e Initial load
duke
parents:
diff changeset
521 }
a61af66fc99e Initial load
duke
parents:
diff changeset
522 return k;
a61af66fc99e Initial load
duke
parents:
diff changeset
523 }
a61af66fc99e Initial load
duke
parents:
diff changeset
524
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
525 void jniCheck::validate_throwable_klass(JavaThread* thr, Klass* klass) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
526 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
527 assert(klass != NULL, "klass argument must have a value");
a61af66fc99e Initial load
duke
parents:
diff changeset
528
6983
070d523b96a7 8001471: Klass::cast() does nothing
hseigel
parents: 6831
diff changeset
529 if (!klass->oop_is_instance() ||
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
530 !InstanceKlass::cast(klass)->is_subclass_of(SystemDictionary::Throwable_klass())) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
531 ReportJNIFatalError(thr, fatal_class_not_a_throwable_class);
a61af66fc99e Initial load
duke
parents:
diff changeset
532 }
a61af66fc99e Initial load
duke
parents:
diff changeset
533 }
a61af66fc99e Initial load
duke
parents:
diff changeset
534
a61af66fc99e Initial load
duke
parents:
diff changeset
535 void jniCheck::validate_call_object(JavaThread* thr, jobject obj, jmethodID method_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
536 /* validate the object being passed */
a61af66fc99e Initial load
duke
parents:
diff changeset
537 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
538 jniCheck::validate_jmethod_id(thr, method_id);
a61af66fc99e Initial load
duke
parents:
diff changeset
539 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
540 }
a61af66fc99e Initial load
duke
parents:
diff changeset
541
a61af66fc99e Initial load
duke
parents:
diff changeset
542 void jniCheck::validate_call_class(JavaThread* thr, jclass clazz, jmethodID method_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
543 /* validate the class being passed */
a61af66fc99e Initial load
duke
parents:
diff changeset
544 ASSERT_OOPS_ALLOWED;
a61af66fc99e Initial load
duke
parents:
diff changeset
545 jniCheck::validate_jmethod_id(thr, method_id);
a61af66fc99e Initial load
duke
parents:
diff changeset
546 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
547 }
a61af66fc99e Initial load
duke
parents:
diff changeset
548
a61af66fc99e Initial load
duke
parents:
diff changeset
549
a61af66fc99e Initial load
duke
parents:
diff changeset
550 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
551 * IMPLEMENTATION OF FUNCTIONS IN CHECKED TABLE
a61af66fc99e Initial load
duke
parents:
diff changeset
552 */
a61af66fc99e Initial load
duke
parents:
diff changeset
553
a61af66fc99e Initial load
duke
parents:
diff changeset
554 JNI_ENTRY_CHECKED(jclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
555 checked_jni_DefineClass(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
556 const char *name,
a61af66fc99e Initial load
duke
parents:
diff changeset
557 jobject loader,
a61af66fc99e Initial load
duke
parents:
diff changeset
558 const jbyte *buf,
a61af66fc99e Initial load
duke
parents:
diff changeset
559 jsize len))
a61af66fc99e Initial load
duke
parents:
diff changeset
560 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
561 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
562 jniCheck::validate_object(thr, loader);
a61af66fc99e Initial load
duke
parents:
diff changeset
563 )
a61af66fc99e Initial load
duke
parents:
diff changeset
564 jclass result = UNCHECKED()->DefineClass(env, name, loader, buf, len);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
565 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
566 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
567 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
568
a61af66fc99e Initial load
duke
parents:
diff changeset
569 JNI_ENTRY_CHECKED(jclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
570 checked_jni_FindClass(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
571 const char *name))
a61af66fc99e Initial load
duke
parents:
diff changeset
572 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
573 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
574 jniCheck::validate_class_descriptor(thr, name);
a61af66fc99e Initial load
duke
parents:
diff changeset
575 )
a61af66fc99e Initial load
duke
parents:
diff changeset
576 jclass result = UNCHECKED()->FindClass(env, name);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
577 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
578 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
579 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
580
a61af66fc99e Initial load
duke
parents:
diff changeset
581 JNI_ENTRY_CHECKED(jmethodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
582 checked_jni_FromReflectedMethod(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
583 jobject method))
a61af66fc99e Initial load
duke
parents:
diff changeset
584 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
585 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
586 jniCheck::validate_object(thr, method);
a61af66fc99e Initial load
duke
parents:
diff changeset
587 )
a61af66fc99e Initial load
duke
parents:
diff changeset
588 jmethodID result = UNCHECKED()->FromReflectedMethod(env, method);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
589 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
590 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
591 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
592
a61af66fc99e Initial load
duke
parents:
diff changeset
593 JNI_ENTRY_CHECKED(jfieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
594 checked_jni_FromReflectedField(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
595 jobject field))
a61af66fc99e Initial load
duke
parents:
diff changeset
596 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
597 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
598 jniCheck::validate_object(thr, field);
a61af66fc99e Initial load
duke
parents:
diff changeset
599 )
a61af66fc99e Initial load
duke
parents:
diff changeset
600 jfieldID result = UNCHECKED()->FromReflectedField(env, field);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
601 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
602 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
603 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
604
a61af66fc99e Initial load
duke
parents:
diff changeset
605 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
606 checked_jni_ToReflectedMethod(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
607 jclass cls,
a61af66fc99e Initial load
duke
parents:
diff changeset
608 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
609 jboolean isStatic))
a61af66fc99e Initial load
duke
parents:
diff changeset
610 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
611 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
612 jniCheck::validate_class(thr, cls, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
613 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
614 )
a61af66fc99e Initial load
duke
parents:
diff changeset
615 jobject result = UNCHECKED()->ToReflectedMethod(env, cls, methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
616 isStatic);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
617 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
618 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
619 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
620
a61af66fc99e Initial load
duke
parents:
diff changeset
621 JNI_ENTRY_CHECKED(jclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
622 checked_jni_GetSuperclass(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
623 jclass sub))
a61af66fc99e Initial load
duke
parents:
diff changeset
624 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
625 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
626 jniCheck::validate_class(thr, sub, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
627 )
a61af66fc99e Initial load
duke
parents:
diff changeset
628 jclass result = UNCHECKED()->GetSuperclass(env, sub);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
629 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
630 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
631 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
632
a61af66fc99e Initial load
duke
parents:
diff changeset
633 JNI_ENTRY_CHECKED(jboolean,
a61af66fc99e Initial load
duke
parents:
diff changeset
634 checked_jni_IsAssignableFrom(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
635 jclass sub,
a61af66fc99e Initial load
duke
parents:
diff changeset
636 jclass sup))
a61af66fc99e Initial load
duke
parents:
diff changeset
637 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
638 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
639 jniCheck::validate_class(thr, sub, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
640 jniCheck::validate_class(thr, sup, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
641 )
a61af66fc99e Initial load
duke
parents:
diff changeset
642 jboolean result = UNCHECKED()->IsAssignableFrom(env, sub, sup);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
643 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
644 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
645 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
646
a61af66fc99e Initial load
duke
parents:
diff changeset
647 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
648 checked_jni_ToReflectedField(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
649 jclass cls,
a61af66fc99e Initial load
duke
parents:
diff changeset
650 jfieldID fieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
651 jboolean isStatic))
a61af66fc99e Initial load
duke
parents:
diff changeset
652 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
653 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
654 jniCheck::validate_class(thr, cls, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
655 )
a61af66fc99e Initial load
duke
parents:
diff changeset
656 jobject result = UNCHECKED()->ToReflectedField(env, cls, fieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
657 isStatic);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
658 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
659 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
660 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
661
a61af66fc99e Initial load
duke
parents:
diff changeset
662 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
663 checked_jni_Throw(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
664 jthrowable obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
665 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
666 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
667 oop oopObj = jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
668 if (oopObj == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
669 // Unchecked Throw tolerates a NULL obj, so just warn
a61af66fc99e Initial load
duke
parents:
diff changeset
670 ReportJNIWarning(thr, "JNI Throw called with NULL throwable");
a61af66fc99e Initial load
duke
parents:
diff changeset
671 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
672 jniCheck::validate_throwable_klass(thr, oopObj->klass());
a61af66fc99e Initial load
duke
parents:
diff changeset
673 }
a61af66fc99e Initial load
duke
parents:
diff changeset
674 )
a61af66fc99e Initial load
duke
parents:
diff changeset
675 jint result = UNCHECKED()->Throw(env, obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
676 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
677 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
678 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
679
a61af66fc99e Initial load
duke
parents:
diff changeset
680 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
681 checked_jni_ThrowNew(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
682 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
683 const char *msg))
a61af66fc99e Initial load
duke
parents:
diff changeset
684 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
685 IN_VM(
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
686 Klass* k = jniCheck::validate_class(thr, clazz, false);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
687 assert(k != NULL, "validate_class shouldn't return NULL Klass*");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
688 jniCheck::validate_throwable_klass(thr, k);
a61af66fc99e Initial load
duke
parents:
diff changeset
689 )
a61af66fc99e Initial load
duke
parents:
diff changeset
690 jint result = UNCHECKED()->ThrowNew(env, clazz, msg);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
691 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
692 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
693 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
694
a61af66fc99e Initial load
duke
parents:
diff changeset
695 JNI_ENTRY_CHECKED(jthrowable,
a61af66fc99e Initial load
duke
parents:
diff changeset
696 checked_jni_ExceptionOccurred(JNIEnv *env))
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
697 thr->clear_pending_jni_exception_check();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
698 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
699 jthrowable result = UNCHECKED()->ExceptionOccurred(env);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
700 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
701 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
702 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
703
a61af66fc99e Initial load
duke
parents:
diff changeset
704 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
705 checked_jni_ExceptionDescribe(JNIEnv *env))
a61af66fc99e Initial load
duke
parents:
diff changeset
706 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
707 UNCHECKED()->ExceptionDescribe(env);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
708 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
709 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
710
a61af66fc99e Initial load
duke
parents:
diff changeset
711 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
712 checked_jni_ExceptionClear(JNIEnv *env))
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
713 thr->clear_pending_jni_exception_check();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
714 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
715 UNCHECKED()->ExceptionClear(env);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
716 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
717 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
718
a61af66fc99e Initial load
duke
parents:
diff changeset
719 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
720 checked_jni_FatalError(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
721 const char *msg))
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
722 thr->clear_pending_jni_exception_check();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
723 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
724 UNCHECKED()->FatalError(env, msg);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
725 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
726 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
727
a61af66fc99e Initial load
duke
parents:
diff changeset
728 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
729 checked_jni_PushLocalFrame(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
730 jint capacity))
a61af66fc99e Initial load
duke
parents:
diff changeset
731 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
732 if (capacity < 0)
a61af66fc99e Initial load
duke
parents:
diff changeset
733 NativeReportJNIFatalError(thr, "negative capacity");
a61af66fc99e Initial load
duke
parents:
diff changeset
734 jint result = UNCHECKED()->PushLocalFrame(env, capacity);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
735 if (result == JNI_OK) {
23039
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
736 add_planned_handle_capacity(thr->active_handles(), capacity);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
737 }
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
738 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
739 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
740 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
741
a61af66fc99e Initial load
duke
parents:
diff changeset
742 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
743 checked_jni_PopLocalFrame(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
744 jobject result))
a61af66fc99e Initial load
duke
parents:
diff changeset
745 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
746 jobject res = UNCHECKED()->PopLocalFrame(env, result);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
747 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
748 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
749 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
750
a61af66fc99e Initial load
duke
parents:
diff changeset
751 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
752 checked_jni_NewGlobalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
753 jobject lobj))
a61af66fc99e Initial load
duke
parents:
diff changeset
754 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
755 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
756 if (lobj != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
757 jniCheck::validate_handle(thr, lobj);
a61af66fc99e Initial load
duke
parents:
diff changeset
758 }
a61af66fc99e Initial load
duke
parents:
diff changeset
759 )
a61af66fc99e Initial load
duke
parents:
diff changeset
760 jobject result = UNCHECKED()->NewGlobalRef(env,lobj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
761 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
762 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
763 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
764
a61af66fc99e Initial load
duke
parents:
diff changeset
765 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
766 checked_jni_DeleteGlobalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
767 jobject gref))
a61af66fc99e Initial load
duke
parents:
diff changeset
768 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
769 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
770 jniCheck::validate_object(thr, gref);
a61af66fc99e Initial load
duke
parents:
diff changeset
771 if (gref && !JNIHandles::is_global_handle(gref)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
772 ReportJNIFatalError(thr,
a61af66fc99e Initial load
duke
parents:
diff changeset
773 "Invalid global JNI handle passed to DeleteGlobalRef");
a61af66fc99e Initial load
duke
parents:
diff changeset
774 }
a61af66fc99e Initial load
duke
parents:
diff changeset
775 )
a61af66fc99e Initial load
duke
parents:
diff changeset
776 UNCHECKED()->DeleteGlobalRef(env,gref);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
777 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
778 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
779
a61af66fc99e Initial load
duke
parents:
diff changeset
780 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
781 checked_jni_DeleteLocalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
782 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
783 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
784 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
785 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
786 if (obj && !(JNIHandles::is_local_handle(thr, obj) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
787 JNIHandles::is_frame_handle(thr, obj)))
a61af66fc99e Initial load
duke
parents:
diff changeset
788 ReportJNIFatalError(thr,
a61af66fc99e Initial load
duke
parents:
diff changeset
789 "Invalid local JNI handle passed to DeleteLocalRef");
a61af66fc99e Initial load
duke
parents:
diff changeset
790 )
a61af66fc99e Initial load
duke
parents:
diff changeset
791 UNCHECKED()->DeleteLocalRef(env, obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
792 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
793 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
794
a61af66fc99e Initial load
duke
parents:
diff changeset
795 JNI_ENTRY_CHECKED(jboolean,
a61af66fc99e Initial load
duke
parents:
diff changeset
796 checked_jni_IsSameObject(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
797 jobject obj1,
a61af66fc99e Initial load
duke
parents:
diff changeset
798 jobject obj2))
a61af66fc99e Initial load
duke
parents:
diff changeset
799 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
800 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
801 /* This JNI function can be used to compare weak global references
a61af66fc99e Initial load
duke
parents:
diff changeset
802 * to NULL objects. If the handles are valid, but contain NULL,
a61af66fc99e Initial load
duke
parents:
diff changeset
803 * then don't attempt to validate the object.
a61af66fc99e Initial load
duke
parents:
diff changeset
804 */
a61af66fc99e Initial load
duke
parents:
diff changeset
805 if (obj1 != NULL && jniCheck::validate_handle(thr, obj1) != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
806 jniCheck::validate_object(thr, obj1);
a61af66fc99e Initial load
duke
parents:
diff changeset
807 }
a61af66fc99e Initial load
duke
parents:
diff changeset
808 if (obj2 != NULL && jniCheck::validate_handle(thr, obj2) != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
809 jniCheck::validate_object(thr, obj2);
a61af66fc99e Initial load
duke
parents:
diff changeset
810 }
a61af66fc99e Initial load
duke
parents:
diff changeset
811 )
a61af66fc99e Initial load
duke
parents:
diff changeset
812 jboolean result = UNCHECKED()->IsSameObject(env,obj1,obj2);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
813 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
814 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
815 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
816
a61af66fc99e Initial load
duke
parents:
diff changeset
817 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
818 checked_jni_NewLocalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
819 jobject ref))
a61af66fc99e Initial load
duke
parents:
diff changeset
820 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
821 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
822 if (ref != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
823 jniCheck::validate_handle(thr, ref);
a61af66fc99e Initial load
duke
parents:
diff changeset
824 }
a61af66fc99e Initial load
duke
parents:
diff changeset
825 )
a61af66fc99e Initial load
duke
parents:
diff changeset
826 jobject result = UNCHECKED()->NewLocalRef(env, ref);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
827 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
828 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
829 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
830
a61af66fc99e Initial load
duke
parents:
diff changeset
831 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
832 checked_jni_EnsureLocalCapacity(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
833 jint capacity))
a61af66fc99e Initial load
duke
parents:
diff changeset
834 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
835 if (capacity < 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
836 NativeReportJNIFatalError(thr, "negative capacity");
a61af66fc99e Initial load
duke
parents:
diff changeset
837 }
a61af66fc99e Initial load
duke
parents:
diff changeset
838 jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
839 if (result == JNI_OK) {
23039
9904bb920313 8046668: Excessive checked JNI warnings from Java startup
dsimms
parents: 22877
diff changeset
840 add_planned_handle_capacity(thr->active_handles(), capacity);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
841 }
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
842 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
843 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
844 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
845
a61af66fc99e Initial load
duke
parents:
diff changeset
846 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
847 checked_jni_AllocObject(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
848 jclass clazz))
a61af66fc99e Initial load
duke
parents:
diff changeset
849 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
850 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
851 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
852 )
a61af66fc99e Initial load
duke
parents:
diff changeset
853 jobject result = UNCHECKED()->AllocObject(env,clazz);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
854 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
855 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
856 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
857
a61af66fc99e Initial load
duke
parents:
diff changeset
858 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
859 checked_jni_NewObject(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
860 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
861 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
862 ...))
a61af66fc99e Initial load
duke
parents:
diff changeset
863 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
864 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
865 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
866 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
867 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
868 )
a61af66fc99e Initial load
duke
parents:
diff changeset
869 va_start(args, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
870 jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
a61af66fc99e Initial load
duke
parents:
diff changeset
871 va_end(args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
872 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
873 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
874 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
875
a61af66fc99e Initial load
duke
parents:
diff changeset
876 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
877 checked_jni_NewObjectV(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
878 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
879 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
880 va_list args))
a61af66fc99e Initial load
duke
parents:
diff changeset
881 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
882 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
883 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
884 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
885 )
a61af66fc99e Initial load
duke
parents:
diff changeset
886 jobject result = UNCHECKED()->NewObjectV(env,clazz,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
887 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
888 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
889 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
890
a61af66fc99e Initial load
duke
parents:
diff changeset
891 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
892 checked_jni_NewObjectA(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
893 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
894 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
895 const jvalue *args))
a61af66fc99e Initial load
duke
parents:
diff changeset
896 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
897 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
898 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
899 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
900 )
a61af66fc99e Initial load
duke
parents:
diff changeset
901 jobject result = UNCHECKED()->NewObjectA(env,clazz,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
902 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
903 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
904 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
905
a61af66fc99e Initial load
duke
parents:
diff changeset
906 JNI_ENTRY_CHECKED(jclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
907 checked_jni_GetObjectClass(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
908 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
909 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
910 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
911 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
912 )
a61af66fc99e Initial load
duke
parents:
diff changeset
913 jclass result = UNCHECKED()->GetObjectClass(env,obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
914 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
915 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
916 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
917
a61af66fc99e Initial load
duke
parents:
diff changeset
918 JNI_ENTRY_CHECKED(jboolean,
a61af66fc99e Initial load
duke
parents:
diff changeset
919 checked_jni_IsInstanceOf(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
920 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
921 jclass clazz))
a61af66fc99e Initial load
duke
parents:
diff changeset
922 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
923 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
924 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
925 jniCheck::validate_class(thr, clazz, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
926 )
a61af66fc99e Initial load
duke
parents:
diff changeset
927 jboolean result = UNCHECKED()->IsInstanceOf(env,obj,clazz);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
928 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
929 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
930 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
931
a61af66fc99e Initial load
duke
parents:
diff changeset
932 JNI_ENTRY_CHECKED(jmethodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
933 checked_jni_GetMethodID(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
934 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
935 const char *name,
a61af66fc99e Initial load
duke
parents:
diff changeset
936 const char *sig))
a61af66fc99e Initial load
duke
parents:
diff changeset
937 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
938 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
939 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
940 )
a61af66fc99e Initial load
duke
parents:
diff changeset
941 jmethodID result = UNCHECKED()->GetMethodID(env,clazz,name,sig);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
942 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
943 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
944 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
945
a61af66fc99e Initial load
duke
parents:
diff changeset
946 #define WRAPPER_CallMethod(ResultType, Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
947 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
948 checked_jni_Call##Result##Method(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
949 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
950 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
951 ...)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
952 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
953 va_list args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
954 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
955 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
956 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
957 va_start(args,methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
958 ResultType result =UNCHECKED()->Call##Result##MethodV(env, obj, methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
959 args); \
a61af66fc99e Initial load
duke
parents:
diff changeset
960 va_end(args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
961 thr->set_pending_jni_exception_check("Call"#Result"Method"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
962 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
963 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
964 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
965 \
a61af66fc99e Initial load
duke
parents:
diff changeset
966 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
967 checked_jni_Call##Result##MethodV(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
968 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
969 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
970 va_list args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
971 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
972 IN_VM(\
a61af66fc99e Initial load
duke
parents:
diff changeset
973 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
974 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
975 ResultType result = UNCHECKED()->Call##Result##MethodV(env, obj, methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
976 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
977 thr->set_pending_jni_exception_check("Call"#Result"MethodV"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
978 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
979 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
980 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
981 \
a61af66fc99e Initial load
duke
parents:
diff changeset
982 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
983 checked_jni_Call##Result##MethodA(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
984 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
985 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
986 const jvalue * args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
987 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
988 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
989 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
990 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
991 ResultType result = UNCHECKED()->Call##Result##MethodA(env, obj, methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
992 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
993 thr->set_pending_jni_exception_check("Call"#Result"MethodA"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
994 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
995 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
996 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
997
a61af66fc99e Initial load
duke
parents:
diff changeset
998 WRAPPER_CallMethod(jobject,Object)
a61af66fc99e Initial load
duke
parents:
diff changeset
999 WRAPPER_CallMethod(jboolean,Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1000 WRAPPER_CallMethod(jbyte,Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1001 WRAPPER_CallMethod(jshort,Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1002 WRAPPER_CallMethod(jchar,Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1003 WRAPPER_CallMethod(jint,Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1004 WRAPPER_CallMethod(jlong,Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1005 WRAPPER_CallMethod(jfloat,Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1006 WRAPPER_CallMethod(jdouble,Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1007
a61af66fc99e Initial load
duke
parents:
diff changeset
1008 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1009 checked_jni_CallVoidMethod(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1010 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1011 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1012 ...))
a61af66fc99e Initial load
duke
parents:
diff changeset
1013 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1014 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
1015 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1016 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1017 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1018 va_start(args,methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1019 UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
a61af66fc99e Initial load
duke
parents:
diff changeset
1020 va_end(args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1021 thr->set_pending_jni_exception_check("CallVoidMethod");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1022 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1023 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1024
a61af66fc99e Initial load
duke
parents:
diff changeset
1025 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1026 checked_jni_CallVoidMethodV(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1027 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
1028 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1029 va_list args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1030 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1031 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1032 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1033 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1034 UNCHECKED()->CallVoidMethodV(env,obj,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1035 thr->set_pending_jni_exception_check("CallVoidMethodV");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1036 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1037 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1038
a61af66fc99e Initial load
duke
parents:
diff changeset
1039 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1040 checked_jni_CallVoidMethodA(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1041 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
1042 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1043 const jvalue * args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1044 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1045 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1046 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1047 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1048 UNCHECKED()->CallVoidMethodA(env,obj,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1049 thr->set_pending_jni_exception_check("CallVoidMethodA");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1050 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1051 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1052
a61af66fc99e Initial load
duke
parents:
diff changeset
1053 #define WRAPPER_CallNonvirtualMethod(ResultType, Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1054 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1055 checked_jni_CallNonvirtual##Result##Method(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1056 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1057 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1058 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1059 ...)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1060 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1061 va_list args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1062 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1063 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1064 jniCheck::validate_call_class(thr, clazz, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1065 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1066 va_start(args,methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1067 ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1068 obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1069 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1070 methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
1071 args); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1072 va_end(args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1073 thr->set_pending_jni_exception_check("CallNonvirtual"#Result"Method"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1074 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1075 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1076 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
1077 \
a61af66fc99e Initial load
duke
parents:
diff changeset
1078 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1079 checked_jni_CallNonvirtual##Result##MethodV(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1080 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1081 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1082 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1083 va_list args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1084 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1085 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1086 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1087 jniCheck::validate_call_class(thr, clazz, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1088 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1089 ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodV(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1090 obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1091 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1092 methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
1093 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1094 thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodV"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1095 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1096 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1097 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
1098 \
a61af66fc99e Initial load
duke
parents:
diff changeset
1099 JNI_ENTRY_CHECKED(ResultType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1100 checked_jni_CallNonvirtual##Result##MethodA(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1101 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1102 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1103 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1104 const jvalue * args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1105 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1106 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1107 jniCheck::validate_call_object(thr, obj, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1108 jniCheck::validate_call_class(thr, clazz, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1109 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1110 ResultType result = UNCHECKED()->CallNonvirtual##Result##MethodA(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1111 obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1112 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1113 methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
1114 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1115 thr->set_pending_jni_exception_check("CallNonvirtual"#Result"MethodA"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1116 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1117 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1118 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1119
a61af66fc99e Initial load
duke
parents:
diff changeset
1120 WRAPPER_CallNonvirtualMethod(jobject,Object)
a61af66fc99e Initial load
duke
parents:
diff changeset
1121 WRAPPER_CallNonvirtualMethod(jboolean,Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1122 WRAPPER_CallNonvirtualMethod(jbyte,Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1123 WRAPPER_CallNonvirtualMethod(jshort,Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1124 WRAPPER_CallNonvirtualMethod(jchar,Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1125 WRAPPER_CallNonvirtualMethod(jint,Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1126 WRAPPER_CallNonvirtualMethod(jlong,Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1127 WRAPPER_CallNonvirtualMethod(jfloat,Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1128 WRAPPER_CallNonvirtualMethod(jdouble,Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1129
a61af66fc99e Initial load
duke
parents:
diff changeset
1130 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1131 checked_jni_CallNonvirtualVoidMethod(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1132 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
1133 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1134 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1135 ...))
a61af66fc99e Initial load
duke
parents:
diff changeset
1136 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1137 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
1138 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1139 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1140 jniCheck::validate_call_class(thr, clazz, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1141 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1142 va_start(args,methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1143 UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
a61af66fc99e Initial load
duke
parents:
diff changeset
1144 va_end(args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1145 thr->set_pending_jni_exception_check("CallNonvirtualVoidMethod");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1146 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1147 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1148
a61af66fc99e Initial load
duke
parents:
diff changeset
1149 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1150 checked_jni_CallNonvirtualVoidMethodV(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1151 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
1152 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1153 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1154 va_list args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1155 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1156 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1157 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1158 jniCheck::validate_call_class(thr, clazz, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1159 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1160 UNCHECKED()->CallNonvirtualVoidMethodV(env,obj,clazz,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1161 thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodV");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1162 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1163 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1164
a61af66fc99e Initial load
duke
parents:
diff changeset
1165 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1166 checked_jni_CallNonvirtualVoidMethodA(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1167 jobject obj,
a61af66fc99e Initial load
duke
parents:
diff changeset
1168 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1169 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1170 const jvalue * args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1171 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1172 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1173 jniCheck::validate_call_object(thr, obj, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1174 jniCheck::validate_call_class(thr, clazz, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1175 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1176 UNCHECKED()->CallNonvirtualVoidMethodA(env,obj,clazz,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1177 thr->set_pending_jni_exception_check("CallNonvirtualVoidMethodA");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1178 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1179 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1180
a61af66fc99e Initial load
duke
parents:
diff changeset
1181 JNI_ENTRY_CHECKED(jfieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1182 checked_jni_GetFieldID(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1183 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1184 const char *name,
a61af66fc99e Initial load
duke
parents:
diff changeset
1185 const char *sig))
a61af66fc99e Initial load
duke
parents:
diff changeset
1186 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1187 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1188 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1189 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1190 jfieldID result = UNCHECKED()->GetFieldID(env,clazz,name,sig);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1191 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1192 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1193 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1194
a61af66fc99e Initial load
duke
parents:
diff changeset
1195 #define WRAPPER_GetField(ReturnType,Result,FieldType) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1196 JNI_ENTRY_CHECKED(ReturnType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1197 checked_jni_Get##Result##Field(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1198 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1199 jfieldID fieldID)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1200 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1201 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1202 checkInstanceFieldID(thr, fieldID, obj, FieldType); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1203 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1204 ReturnType result = UNCHECKED()->Get##Result##Field(env,obj,fieldID); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1205 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1206 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1207 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1208
a61af66fc99e Initial load
duke
parents:
diff changeset
1209 WRAPPER_GetField(jobject, Object, T_OBJECT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1210 WRAPPER_GetField(jboolean, Boolean, T_BOOLEAN)
a61af66fc99e Initial load
duke
parents:
diff changeset
1211 WRAPPER_GetField(jbyte, Byte, T_BYTE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1212 WRAPPER_GetField(jshort, Short, T_SHORT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1213 WRAPPER_GetField(jchar, Char, T_CHAR)
a61af66fc99e Initial load
duke
parents:
diff changeset
1214 WRAPPER_GetField(jint, Int, T_INT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1215 WRAPPER_GetField(jlong, Long, T_LONG)
a61af66fc99e Initial load
duke
parents:
diff changeset
1216 WRAPPER_GetField(jfloat, Float, T_FLOAT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1217 WRAPPER_GetField(jdouble, Double, T_DOUBLE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1218
a61af66fc99e Initial load
duke
parents:
diff changeset
1219 #define WRAPPER_SetField(ValueType,Result,FieldType) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1220 JNI_ENTRY_CHECKED(void, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1221 checked_jni_Set##Result##Field(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1222 jobject obj, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1223 jfieldID fieldID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1224 ValueType val)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1225 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1226 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1227 checkInstanceFieldID(thr, fieldID, obj, FieldType); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1228 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1229 UNCHECKED()->Set##Result##Field(env,obj,fieldID,val); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1230 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1231 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1232
a61af66fc99e Initial load
duke
parents:
diff changeset
1233 WRAPPER_SetField(jobject, Object, T_OBJECT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1234 WRAPPER_SetField(jboolean, Boolean, T_BOOLEAN)
a61af66fc99e Initial load
duke
parents:
diff changeset
1235 WRAPPER_SetField(jbyte, Byte, T_BYTE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1236 WRAPPER_SetField(jshort, Short, T_SHORT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1237 WRAPPER_SetField(jchar, Char, T_CHAR)
a61af66fc99e Initial load
duke
parents:
diff changeset
1238 WRAPPER_SetField(jint, Int, T_INT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1239 WRAPPER_SetField(jlong, Long, T_LONG)
a61af66fc99e Initial load
duke
parents:
diff changeset
1240 WRAPPER_SetField(jfloat, Float, T_FLOAT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1241 WRAPPER_SetField(jdouble, Double, T_DOUBLE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1242
a61af66fc99e Initial load
duke
parents:
diff changeset
1243
a61af66fc99e Initial load
duke
parents:
diff changeset
1244 JNI_ENTRY_CHECKED(jmethodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1245 checked_jni_GetStaticMethodID(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1246 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1247 const char *name,
a61af66fc99e Initial load
duke
parents:
diff changeset
1248 const char *sig))
a61af66fc99e Initial load
duke
parents:
diff changeset
1249 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1250 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1251 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1252 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1253 jmethodID result = UNCHECKED()->GetStaticMethodID(env,clazz,name,sig);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1254 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1255 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1256 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1257
a61af66fc99e Initial load
duke
parents:
diff changeset
1258 #define WRAPPER_CallStaticMethod(ReturnType,Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1259 JNI_ENTRY_CHECKED(ReturnType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1260 checked_jni_CallStatic##Result##Method(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1261 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1262 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1263 ...)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1264 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1265 va_list args; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1266 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1267 jniCheck::validate_jmethod_id(thr, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1268 jniCheck::validate_class(thr, clazz, false); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1269 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1270 va_start(args,methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1271 ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1272 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1273 methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1274 args); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1275 va_end(args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1276 thr->set_pending_jni_exception_check("CallStatic"#Result"Method"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1277 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1278 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1279 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
1280 \
a61af66fc99e Initial load
duke
parents:
diff changeset
1281 JNI_ENTRY_CHECKED(ReturnType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1282 checked_jni_CallStatic##Result##MethodV(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1283 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1284 jmethodID methodID,\
a61af66fc99e Initial load
duke
parents:
diff changeset
1285 va_list args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1286 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1287 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1288 jniCheck::validate_jmethod_id(thr, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1289 jniCheck::validate_class(thr, clazz, false); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1290 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1291 ReturnType result = UNCHECKED()->CallStatic##Result##MethodV(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1292 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1293 methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1294 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1295 thr->set_pending_jni_exception_check("CallStatic"#Result"MethodV"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1296 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1297 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1298 JNI_END \
a61af66fc99e Initial load
duke
parents:
diff changeset
1299 \
a61af66fc99e Initial load
duke
parents:
diff changeset
1300 JNI_ENTRY_CHECKED(ReturnType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1301 checked_jni_CallStatic##Result##MethodA(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1302 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1303 jmethodID methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1304 const jvalue *args)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1305 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1306 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1307 jniCheck::validate_jmethod_id(thr, methodID); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1308 jniCheck::validate_class(thr, clazz, false); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1309 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1310 ReturnType result = UNCHECKED()->CallStatic##Result##MethodA(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1311 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1312 methodID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1313 args); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1314 thr->set_pending_jni_exception_check("CallStatic"#Result"MethodA"); \
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1315 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1316 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1317 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1318
a61af66fc99e Initial load
duke
parents:
diff changeset
1319 WRAPPER_CallStaticMethod(jobject,Object)
a61af66fc99e Initial load
duke
parents:
diff changeset
1320 WRAPPER_CallStaticMethod(jboolean,Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1321 WRAPPER_CallStaticMethod(jbyte,Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1322 WRAPPER_CallStaticMethod(jshort,Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1323 WRAPPER_CallStaticMethod(jchar,Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1324 WRAPPER_CallStaticMethod(jint,Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1325 WRAPPER_CallStaticMethod(jlong,Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1326 WRAPPER_CallStaticMethod(jfloat,Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1327 WRAPPER_CallStaticMethod(jdouble,Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1328
a61af66fc99e Initial load
duke
parents:
diff changeset
1329 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1330 checked_jni_CallStaticVoidMethod(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1331 jclass cls,
a61af66fc99e Initial load
duke
parents:
diff changeset
1332 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1333 ...))
a61af66fc99e Initial load
duke
parents:
diff changeset
1334 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1335 va_list args;
a61af66fc99e Initial load
duke
parents:
diff changeset
1336 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1337 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1338 jniCheck::validate_class(thr, cls, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1339 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1340 va_start(args,methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1341 UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
a61af66fc99e Initial load
duke
parents:
diff changeset
1342 va_end(args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1343 thr->set_pending_jni_exception_check("CallStaticVoidMethod");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1344 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1345 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1346
a61af66fc99e Initial load
duke
parents:
diff changeset
1347 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1348 checked_jni_CallStaticVoidMethodV(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1349 jclass cls,
a61af66fc99e Initial load
duke
parents:
diff changeset
1350 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1351 va_list args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1352 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1353 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1354 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1355 jniCheck::validate_class(thr, cls, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1356 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1357 UNCHECKED()->CallStaticVoidMethodV(env,cls,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1358 thr->set_pending_jni_exception_check("CallStaticVoidMethodV");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1359 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1360 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1361
a61af66fc99e Initial load
duke
parents:
diff changeset
1362 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1363 checked_jni_CallStaticVoidMethodA(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1364 jclass cls,
a61af66fc99e Initial load
duke
parents:
diff changeset
1365 jmethodID methodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1366 const jvalue * args))
a61af66fc99e Initial load
duke
parents:
diff changeset
1367 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1368 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1369 jniCheck::validate_jmethod_id(thr, methodID);
a61af66fc99e Initial load
duke
parents:
diff changeset
1370 jniCheck::validate_class(thr, cls, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1371 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1372 UNCHECKED()->CallStaticVoidMethodA(env,cls,methodID,args);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1373 thr->set_pending_jni_exception_check("CallStaticVoidMethodA");
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1374 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1375 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1376
a61af66fc99e Initial load
duke
parents:
diff changeset
1377 JNI_ENTRY_CHECKED(jfieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
1378 checked_jni_GetStaticFieldID(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1379 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1380 const char *name,
a61af66fc99e Initial load
duke
parents:
diff changeset
1381 const char *sig))
a61af66fc99e Initial load
duke
parents:
diff changeset
1382 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1383 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1384 jniCheck::validate_class(thr, clazz, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1385 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1386 jfieldID result = UNCHECKED()->GetStaticFieldID(env,clazz,name,sig);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1387 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1388 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1389 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1390
a61af66fc99e Initial load
duke
parents:
diff changeset
1391 #define WRAPPER_GetStaticField(ReturnType,Result,FieldType) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1392 JNI_ENTRY_CHECKED(ReturnType, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1393 checked_jni_GetStatic##Result##Field(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1394 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1395 jfieldID fieldID)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1396 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1397 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1398 jniCheck::validate_class(thr, clazz, false); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1399 checkStaticFieldID(thr, fieldID, clazz, FieldType); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1400 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1401 ReturnType result = UNCHECKED()->GetStatic##Result##Field(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1402 clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1403 fieldID); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1404 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1405 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1406 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1407
a61af66fc99e Initial load
duke
parents:
diff changeset
1408 WRAPPER_GetStaticField(jobject, Object, T_OBJECT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1409 WRAPPER_GetStaticField(jboolean, Boolean, T_BOOLEAN)
a61af66fc99e Initial load
duke
parents:
diff changeset
1410 WRAPPER_GetStaticField(jbyte, Byte, T_BYTE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1411 WRAPPER_GetStaticField(jshort, Short, T_SHORT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1412 WRAPPER_GetStaticField(jchar, Char, T_CHAR)
a61af66fc99e Initial load
duke
parents:
diff changeset
1413 WRAPPER_GetStaticField(jint, Int, T_INT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1414 WRAPPER_GetStaticField(jlong, Long, T_LONG)
a61af66fc99e Initial load
duke
parents:
diff changeset
1415 WRAPPER_GetStaticField(jfloat, Float, T_FLOAT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1416 WRAPPER_GetStaticField(jdouble, Double, T_DOUBLE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1417
a61af66fc99e Initial load
duke
parents:
diff changeset
1418 #define WRAPPER_SetStaticField(ValueType,Result,FieldType) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1419 JNI_ENTRY_CHECKED(void, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1420 checked_jni_SetStatic##Result##Field(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1421 jclass clazz, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1422 jfieldID fieldID, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1423 ValueType value)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1424 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1425 IN_VM( \
a61af66fc99e Initial load
duke
parents:
diff changeset
1426 jniCheck::validate_class(thr, clazz, false); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1427 checkStaticFieldID(thr, fieldID, clazz, FieldType); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1428 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1429 UNCHECKED()->SetStatic##Result##Field(env,clazz,fieldID,value); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1430 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1431 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1432
a61af66fc99e Initial load
duke
parents:
diff changeset
1433 WRAPPER_SetStaticField(jobject, Object, T_OBJECT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1434 WRAPPER_SetStaticField(jboolean, Boolean, T_BOOLEAN)
a61af66fc99e Initial load
duke
parents:
diff changeset
1435 WRAPPER_SetStaticField(jbyte, Byte, T_BYTE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1436 WRAPPER_SetStaticField(jshort, Short, T_SHORT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1437 WRAPPER_SetStaticField(jchar, Char, T_CHAR)
a61af66fc99e Initial load
duke
parents:
diff changeset
1438 WRAPPER_SetStaticField(jint, Int, T_INT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1439 WRAPPER_SetStaticField(jlong, Long, T_LONG)
a61af66fc99e Initial load
duke
parents:
diff changeset
1440 WRAPPER_SetStaticField(jfloat, Float, T_FLOAT)
a61af66fc99e Initial load
duke
parents:
diff changeset
1441 WRAPPER_SetStaticField(jdouble, Double, T_DOUBLE)
a61af66fc99e Initial load
duke
parents:
diff changeset
1442
a61af66fc99e Initial load
duke
parents:
diff changeset
1443
a61af66fc99e Initial load
duke
parents:
diff changeset
1444 JNI_ENTRY_CHECKED(jstring,
a61af66fc99e Initial load
duke
parents:
diff changeset
1445 checked_jni_NewString(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1446 const jchar *unicode,
a61af66fc99e Initial load
duke
parents:
diff changeset
1447 jsize len))
a61af66fc99e Initial load
duke
parents:
diff changeset
1448 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1449 jstring result = UNCHECKED()->NewString(env,unicode,len);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1450 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1451 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1452 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1453
a61af66fc99e Initial load
duke
parents:
diff changeset
1454 JNI_ENTRY_CHECKED(jsize,
a61af66fc99e Initial load
duke
parents:
diff changeset
1455 checked_jni_GetStringLength(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1456 jstring str))
a61af66fc99e Initial load
duke
parents:
diff changeset
1457 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1458 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1459 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1460 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1461 jsize result = UNCHECKED()->GetStringLength(env,str);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1462 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1463 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1464 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1465
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1466 // Arbitrary (but well-known) tag
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1467 const void* STRING_TAG = (void*)0x47114711;
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1468
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1469 JNI_ENTRY_CHECKED(const jchar *,
a61af66fc99e Initial load
duke
parents:
diff changeset
1470 checked_jni_GetStringChars(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1471 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1472 jboolean *isCopy))
a61af66fc99e Initial load
duke
parents:
diff changeset
1473 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1474 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1475 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1476 )
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1477 jchar* new_result = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1478 const jchar *result = UNCHECKED()->GetStringChars(env,str,isCopy);
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1479 assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringChars didn't return a copy as expected");
12819
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1480 if (result != NULL) {
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1481 size_t len = UNCHECKED()->GetStringLength(env,str) + 1; // + 1 for NULL termination
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1482 len *= sizeof(jchar);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1483 new_result = (jchar*) GuardedMemory::wrap_copy(result, len, STRING_TAG);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1484 if (new_result == NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1485 vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringChars");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1486 }
12819
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1487 // Avoiding call to UNCHECKED()->ReleaseStringChars() since that will fire unexpected dtrace probes
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1488 // Note that the dtrace arguments for the allocated memory will not match up with this solution.
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1489 FreeHeap((char*)result);
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1490 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1491 functionExit(thr);
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1492 return new_result;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1493 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1494
a61af66fc99e Initial load
duke
parents:
diff changeset
1495 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1496 checked_jni_ReleaseStringChars(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1497 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1498 const jchar *chars))
a61af66fc99e Initial load
duke
parents:
diff changeset
1499 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1500 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1501 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1502 )
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1503 if (chars == NULL) {
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1504 // still do the unchecked call to allow dtrace probes
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1505 UNCHECKED()->ReleaseStringChars(env,str,chars);
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1506 }
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1507 else {
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1508 GuardedMemory guarded((void*)chars);
20319
29a5c2fd2d2e 8046662: Check JNI ReleaseStringChars / ReleaseStringUTFChars verify_guards test inverted
dsimms
parents: 20318
diff changeset
1509 if (!guarded.verify_guards()) {
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1510 tty->print_cr("ReleaseStringChars: release chars failed bounds check. "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1511 "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1512 guarded.print_on(tty);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1513 NativeReportJNIFatalError(thr, "ReleaseStringChars: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1514 "release chars failed bounds check.");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1515 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1516 if (guarded.get_tag() != STRING_TAG) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1517 tty->print_cr("ReleaseStringChars: called on something not allocated "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1518 "by GetStringChars. string: " PTR_FORMAT " chars: " PTR_FORMAT,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1519 p2i(str), p2i(chars));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1520 NativeReportJNIFatalError(thr, "ReleaseStringChars called on something "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1521 "not allocated by GetStringChars");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1522 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1523 UNCHECKED()->ReleaseStringChars(env, str,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1524 (const jchar*) guarded.release_for_freeing());
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1525 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1526 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1527 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1528
a61af66fc99e Initial load
duke
parents:
diff changeset
1529 JNI_ENTRY_CHECKED(jstring,
a61af66fc99e Initial load
duke
parents:
diff changeset
1530 checked_jni_NewStringUTF(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1531 const char *utf))
a61af66fc99e Initial load
duke
parents:
diff changeset
1532 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1533 jstring result = UNCHECKED()->NewStringUTF(env,utf);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1534 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1535 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1536 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1537
a61af66fc99e Initial load
duke
parents:
diff changeset
1538 JNI_ENTRY_CHECKED(jsize,
a61af66fc99e Initial load
duke
parents:
diff changeset
1539 checked_jni_GetStringUTFLength(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1540 jstring str))
a61af66fc99e Initial load
duke
parents:
diff changeset
1541 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1542 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1543 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1544 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1545 jsize result = UNCHECKED()->GetStringUTFLength(env,str);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1546 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1547 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1548 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1549
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1550 // Arbitrary (but well-known) tag - different than GetStringChars
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1551 const void* STRING_UTF_TAG = (void*) 0x48124812;
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1552
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1553 JNI_ENTRY_CHECKED(const char *,
a61af66fc99e Initial load
duke
parents:
diff changeset
1554 checked_jni_GetStringUTFChars(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1555 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1556 jboolean *isCopy))
a61af66fc99e Initial load
duke
parents:
diff changeset
1557 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1558 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1559 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1560 )
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1561 char* new_result = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1562 const char *result = UNCHECKED()->GetStringUTFChars(env,str,isCopy);
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1563 assert (isCopy == NULL || *isCopy == JNI_TRUE, "GetStringUTFChars didn't return a copy as expected");
12819
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1564 if (result != NULL) {
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1565 size_t len = strlen(result) + 1; // + 1 for NULL termination
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1566 new_result = (char*) GuardedMemory::wrap_copy(result, len, STRING_UTF_TAG);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1567 if (new_result == NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1568 vm_exit_out_of_memory(len, OOM_MALLOC_ERROR, "checked_jni_GetStringUTFChars");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1569 }
12819
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1570 // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1571 // Note that the dtrace arguments for the allocated memory will not match up with this solution.
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1572 FreeHeap((char*)result, mtInternal);
f9be370a7d54 8025922: JNI access to Strings need to check if the value field is non-null
sla
parents: 11150
diff changeset
1573 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1574 functionExit(thr);
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1575 return new_result;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1576 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1577
a61af66fc99e Initial load
duke
parents:
diff changeset
1578 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1579 checked_jni_ReleaseStringUTFChars(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1580 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1581 const char* chars))
a61af66fc99e Initial load
duke
parents:
diff changeset
1582 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1583 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1584 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1585 )
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1586 if (chars == NULL) {
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1587 // still do the unchecked call to allow dtrace probes
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1588 UNCHECKED()->ReleaseStringUTFChars(env,str,chars);
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1589 }
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1590 else {
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1591 GuardedMemory guarded((void*)chars);
20319
29a5c2fd2d2e 8046662: Check JNI ReleaseStringChars / ReleaseStringUTFChars verify_guards test inverted
dsimms
parents: 20318
diff changeset
1592 if (!guarded.verify_guards()) {
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1593 tty->print_cr("ReleaseStringUTFChars: release chars failed bounds check. "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1594 "string: " PTR_FORMAT " chars: " PTR_FORMAT, p2i(str), p2i(chars));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1595 guarded.print_on(tty);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1596 NativeReportJNIFatalError(thr, "ReleaseStringUTFChars: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1597 "release chars failed bounds check.");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1598 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1599 if (guarded.get_tag() != STRING_UTF_TAG) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1600 tty->print_cr("ReleaseStringUTFChars: called on something not "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1601 "allocated by GetStringUTFChars. string: " PTR_FORMAT " chars: "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1602 PTR_FORMAT, p2i(str), p2i(chars));
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1603 NativeReportJNIFatalError(thr, "ReleaseStringUTFChars "
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1604 "called on something not allocated by GetStringUTFChars");
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1605 }
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1606 UNCHECKED()->ReleaseStringUTFChars(env, str,
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1607 (const char*) guarded.release_for_freeing());
1989
017cd8bce8a8 6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents: 1972
diff changeset
1608 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1609 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1610 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1611
a61af66fc99e Initial load
duke
parents:
diff changeset
1612 JNI_ENTRY_CHECKED(jsize,
a61af66fc99e Initial load
duke
parents:
diff changeset
1613 checked_jni_GetArrayLength(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1614 jarray array))
a61af66fc99e Initial load
duke
parents:
diff changeset
1615 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1616 IN_VM(
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1617 check_is_array(thr, array);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1618 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1619 jsize result = UNCHECKED()->GetArrayLength(env,array);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1620 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1621 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1622 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1623
a61af66fc99e Initial load
duke
parents:
diff changeset
1624 JNI_ENTRY_CHECKED(jobjectArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
1625 checked_jni_NewObjectArray(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1626 jsize len,
a61af66fc99e Initial load
duke
parents:
diff changeset
1627 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1628 jobject init))
a61af66fc99e Initial load
duke
parents:
diff changeset
1629 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1630 jobjectArray result = UNCHECKED()->NewObjectArray(env,len,clazz,init);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1631 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1632 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1633 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1634
a61af66fc99e Initial load
duke
parents:
diff changeset
1635 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
1636 checked_jni_GetObjectArrayElement(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1637 jobjectArray array,
a61af66fc99e Initial load
duke
parents:
diff changeset
1638 jsize index))
a61af66fc99e Initial load
duke
parents:
diff changeset
1639 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1640 IN_VM(
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1641 check_is_obj_array(thr, array);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1642 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1643 jobject result = UNCHECKED()->GetObjectArrayElement(env,array,index);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1644 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1645 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1646 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1647
a61af66fc99e Initial load
duke
parents:
diff changeset
1648 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1649 checked_jni_SetObjectArrayElement(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1650 jobjectArray array,
a61af66fc99e Initial load
duke
parents:
diff changeset
1651 jsize index,
a61af66fc99e Initial load
duke
parents:
diff changeset
1652 jobject val))
a61af66fc99e Initial load
duke
parents:
diff changeset
1653 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1654 IN_VM(
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1655 check_is_obj_array(thr, array);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1656 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1657 UNCHECKED()->SetObjectArrayElement(env,array,index,val);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1658 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1659 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1660
a61af66fc99e Initial load
duke
parents:
diff changeset
1661 #define WRAPPER_NewScalarArray(Return, Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1662 JNI_ENTRY_CHECKED(Return, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1663 checked_jni_New##Result##Array(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1664 jsize len)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1665 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1666 Return result = UNCHECKED()->New##Result##Array(env,len); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1667 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1668 return (Return) result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1669 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1670
a61af66fc99e Initial load
duke
parents:
diff changeset
1671 WRAPPER_NewScalarArray(jbooleanArray, Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1672 WRAPPER_NewScalarArray(jbyteArray, Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1673 WRAPPER_NewScalarArray(jshortArray, Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1674 WRAPPER_NewScalarArray(jcharArray, Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1675 WRAPPER_NewScalarArray(jintArray, Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1676 WRAPPER_NewScalarArray(jlongArray, Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1677 WRAPPER_NewScalarArray(jfloatArray, Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1678 WRAPPER_NewScalarArray(jdoubleArray, Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1679
a61af66fc99e Initial load
duke
parents:
diff changeset
1680 #define WRAPPER_GetScalarArrayElements(ElementTag,ElementType,Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1681 JNI_ENTRY_CHECKED(ElementType *, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1682 checked_jni_Get##Result##ArrayElements(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1683 ElementType##Array array, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1684 jboolean *isCopy)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1685 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1686 IN_VM( \
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1687 check_primitive_array_type(thr, array, ElementTag); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1688 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1689 ElementType *result = UNCHECKED()->Get##Result##ArrayElements(env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1690 array, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1691 isCopy); \
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1692 if (result != NULL) { \
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1693 result = (ElementType *) check_jni_wrap_copy_array(thr, array, result); \
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1694 } \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1695 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1696 return result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1697 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1698
a61af66fc99e Initial load
duke
parents:
diff changeset
1699 WRAPPER_GetScalarArrayElements(T_BOOLEAN, jboolean, Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1700 WRAPPER_GetScalarArrayElements(T_BYTE, jbyte, Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1701 WRAPPER_GetScalarArrayElements(T_SHORT, jshort, Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1702 WRAPPER_GetScalarArrayElements(T_CHAR, jchar, Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1703 WRAPPER_GetScalarArrayElements(T_INT, jint, Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1704 WRAPPER_GetScalarArrayElements(T_LONG, jlong, Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1705 WRAPPER_GetScalarArrayElements(T_FLOAT, jfloat, Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1706 WRAPPER_GetScalarArrayElements(T_DOUBLE, jdouble, Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1707
a61af66fc99e Initial load
duke
parents:
diff changeset
1708 #define WRAPPER_ReleaseScalarArrayElements(ElementTag,ElementType,Result,Tag) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1709 JNI_ENTRY_CHECKED(void, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1710 checked_jni_Release##Result##ArrayElements(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1711 ElementType##Array array, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1712 ElementType *elems, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1713 jint mode)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1714 functionEnterExceptionAllowed(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1715 IN_VM( \
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1716 check_primitive_array_type(thr, array, ElementTag); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1717 ASSERT_OOPS_ALLOWED; \
a61af66fc99e Initial load
duke
parents:
diff changeset
1718 typeArrayOop a = typeArrayOop(JNIHandles::resolve_non_null(array)); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1719 ) \
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1720 ElementType* orig_result = (ElementType *) check_wrapped_array_release( \
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1721 thr, "checked_jni_Release"#Result"ArrayElements", array, elems, mode); \
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1722 UNCHECKED()->Release##Result##ArrayElements(env, array, orig_result, mode); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1723 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1724 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1725
a61af66fc99e Initial load
duke
parents:
diff changeset
1726 WRAPPER_ReleaseScalarArrayElements(T_BOOLEAN,jboolean, Boolean, bool)
a61af66fc99e Initial load
duke
parents:
diff changeset
1727 WRAPPER_ReleaseScalarArrayElements(T_BYTE, jbyte, Byte, byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1728 WRAPPER_ReleaseScalarArrayElements(T_SHORT, jshort, Short, short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1729 WRAPPER_ReleaseScalarArrayElements(T_CHAR, jchar, Char, char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1730 WRAPPER_ReleaseScalarArrayElements(T_INT, jint, Int, int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1731 WRAPPER_ReleaseScalarArrayElements(T_LONG, jlong, Long, long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1732 WRAPPER_ReleaseScalarArrayElements(T_FLOAT, jfloat, Float, float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1733 WRAPPER_ReleaseScalarArrayElements(T_DOUBLE, jdouble, Double, double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1734
a61af66fc99e Initial load
duke
parents:
diff changeset
1735 #define WRAPPER_GetScalarArrayRegion(ElementTag,ElementType,Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1736 JNI_ENTRY_CHECKED(void, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1737 checked_jni_Get##Result##ArrayRegion(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1738 ElementType##Array array, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1739 jsize start, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1740 jsize len, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1741 ElementType *buf)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1742 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1743 IN_VM( \
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1744 check_primitive_array_type(thr, array, ElementTag); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1745 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1746 UNCHECKED()->Get##Result##ArrayRegion(env,array,start,len,buf); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1747 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1748 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1749
a61af66fc99e Initial load
duke
parents:
diff changeset
1750 WRAPPER_GetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1751 WRAPPER_GetScalarArrayRegion(T_BYTE, jbyte, Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1752 WRAPPER_GetScalarArrayRegion(T_SHORT, jshort, Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1753 WRAPPER_GetScalarArrayRegion(T_CHAR, jchar, Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1754 WRAPPER_GetScalarArrayRegion(T_INT, jint, Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1755 WRAPPER_GetScalarArrayRegion(T_LONG, jlong, Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1756 WRAPPER_GetScalarArrayRegion(T_FLOAT, jfloat, Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1757 WRAPPER_GetScalarArrayRegion(T_DOUBLE, jdouble, Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1758
a61af66fc99e Initial load
duke
parents:
diff changeset
1759 #define WRAPPER_SetScalarArrayRegion(ElementTag,ElementType,Result) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1760 JNI_ENTRY_CHECKED(void, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1761 checked_jni_Set##Result##ArrayRegion(JNIEnv *env, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1762 ElementType##Array array, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1763 jsize start, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1764 jsize len, \
a61af66fc99e Initial load
duke
parents:
diff changeset
1765 const ElementType *buf)) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1766 functionEnter(thr); \
a61af66fc99e Initial load
duke
parents:
diff changeset
1767 IN_VM( \
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1768 check_primitive_array_type(thr, array, ElementTag); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1769 ) \
a61af66fc99e Initial load
duke
parents:
diff changeset
1770 UNCHECKED()->Set##Result##ArrayRegion(env,array,start,len,buf); \
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1771 functionExit(thr); \
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1772 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1773
a61af66fc99e Initial load
duke
parents:
diff changeset
1774 WRAPPER_SetScalarArrayRegion(T_BOOLEAN, jboolean, Boolean)
a61af66fc99e Initial load
duke
parents:
diff changeset
1775 WRAPPER_SetScalarArrayRegion(T_BYTE, jbyte, Byte)
a61af66fc99e Initial load
duke
parents:
diff changeset
1776 WRAPPER_SetScalarArrayRegion(T_SHORT, jshort, Short)
a61af66fc99e Initial load
duke
parents:
diff changeset
1777 WRAPPER_SetScalarArrayRegion(T_CHAR, jchar, Char)
a61af66fc99e Initial load
duke
parents:
diff changeset
1778 WRAPPER_SetScalarArrayRegion(T_INT, jint, Int)
a61af66fc99e Initial load
duke
parents:
diff changeset
1779 WRAPPER_SetScalarArrayRegion(T_LONG, jlong, Long)
a61af66fc99e Initial load
duke
parents:
diff changeset
1780 WRAPPER_SetScalarArrayRegion(T_FLOAT, jfloat, Float)
a61af66fc99e Initial load
duke
parents:
diff changeset
1781 WRAPPER_SetScalarArrayRegion(T_DOUBLE, jdouble, Double)
a61af66fc99e Initial load
duke
parents:
diff changeset
1782
a61af66fc99e Initial load
duke
parents:
diff changeset
1783 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1784 checked_jni_RegisterNatives(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1785 jclass clazz,
a61af66fc99e Initial load
duke
parents:
diff changeset
1786 const JNINativeMethod *methods,
a61af66fc99e Initial load
duke
parents:
diff changeset
1787 jint nMethods))
a61af66fc99e Initial load
duke
parents:
diff changeset
1788 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1789 jint result = UNCHECKED()->RegisterNatives(env,clazz,methods,nMethods);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1790 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1791 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1792 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1793
a61af66fc99e Initial load
duke
parents:
diff changeset
1794 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1795 checked_jni_UnregisterNatives(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1796 jclass clazz))
a61af66fc99e Initial load
duke
parents:
diff changeset
1797 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1798 jint result = UNCHECKED()->UnregisterNatives(env,clazz);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1799 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1800 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1801 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1802
a61af66fc99e Initial load
duke
parents:
diff changeset
1803 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1804 checked_jni_MonitorEnter(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1805 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
1806 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1807 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1808 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
1809 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1810 jint result = UNCHECKED()->MonitorEnter(env,obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1811 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1812 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1813 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1814
a61af66fc99e Initial load
duke
parents:
diff changeset
1815 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1816 checked_jni_MonitorExit(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1817 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
1818 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1819 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1820 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
1821 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1822 jint result = UNCHECKED()->MonitorExit(env,obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1823 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1824 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1825 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1826
a61af66fc99e Initial load
duke
parents:
diff changeset
1827 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1828 checked_jni_GetJavaVM(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1829 JavaVM **vm))
a61af66fc99e Initial load
duke
parents:
diff changeset
1830 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1831 jint result = UNCHECKED()->GetJavaVM(env,vm);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1832 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1833 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1834 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1835
a61af66fc99e Initial load
duke
parents:
diff changeset
1836 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1837 checked_jni_GetStringRegion(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1838 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1839 jsize start,
a61af66fc99e Initial load
duke
parents:
diff changeset
1840 jsize len,
a61af66fc99e Initial load
duke
parents:
diff changeset
1841 jchar *buf))
a61af66fc99e Initial load
duke
parents:
diff changeset
1842 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1843 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1844 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1845 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1846 UNCHECKED()->GetStringRegion(env, str, start, len, buf);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1847 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1848 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1849
a61af66fc99e Initial load
duke
parents:
diff changeset
1850 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1851 checked_jni_GetStringUTFRegion(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1852 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1853 jsize start,
a61af66fc99e Initial load
duke
parents:
diff changeset
1854 jsize len,
a61af66fc99e Initial load
duke
parents:
diff changeset
1855 char *buf))
a61af66fc99e Initial load
duke
parents:
diff changeset
1856 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1857 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1858 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1859 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1860 UNCHECKED()->GetStringUTFRegion(env, str, start, len, buf);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1861 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1862 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1863
a61af66fc99e Initial load
duke
parents:
diff changeset
1864 JNI_ENTRY_CHECKED(void *,
a61af66fc99e Initial load
duke
parents:
diff changeset
1865 checked_jni_GetPrimitiveArrayCritical(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1866 jarray array,
a61af66fc99e Initial load
duke
parents:
diff changeset
1867 jboolean *isCopy))
a61af66fc99e Initial load
duke
parents:
diff changeset
1868 functionEnterCritical(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1869 IN_VM(
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1870 check_is_primitive_array(thr, array);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1871 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1872 void *result = UNCHECKED()->GetPrimitiveArrayCritical(env, array, isCopy);
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1873 if (result != NULL) {
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1874 result = check_jni_wrap_copy_array(thr, array, result);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1875 }
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1876 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1877 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1878 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1879
a61af66fc99e Initial load
duke
parents:
diff changeset
1880 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1881 checked_jni_ReleasePrimitiveArrayCritical(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1882 jarray array,
a61af66fc99e Initial load
duke
parents:
diff changeset
1883 void *carray,
a61af66fc99e Initial load
duke
parents:
diff changeset
1884 jint mode))
a61af66fc99e Initial load
duke
parents:
diff changeset
1885 functionEnterCriticalExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1886 IN_VM(
11145
39deebbc90b3 6671508: JNI GetPrimitiveArrayCritical should not be callable on object arrays
mgerdin
parents: 6983
diff changeset
1887 check_is_primitive_array(thr, array);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1888 )
20318
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1889 // Check the element array...
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1890 void* orig_result = check_wrapped_array_release(thr, "ReleasePrimitiveArrayCritical", array, carray, mode);
fa62fb12cdca 6311046: -Xcheck:jni should support checking of GetPrimitiveArrayCritical.
dsimms
parents: 20197
diff changeset
1891 UNCHECKED()->ReleasePrimitiveArrayCritical(env, array, orig_result, mode);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1892 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1893 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1894
a61af66fc99e Initial load
duke
parents:
diff changeset
1895 JNI_ENTRY_CHECKED(const jchar*,
a61af66fc99e Initial load
duke
parents:
diff changeset
1896 checked_jni_GetStringCritical(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1897 jstring string,
a61af66fc99e Initial load
duke
parents:
diff changeset
1898 jboolean *isCopy))
a61af66fc99e Initial load
duke
parents:
diff changeset
1899 functionEnterCritical(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1900 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1901 checkString(thr, string);
a61af66fc99e Initial load
duke
parents:
diff changeset
1902 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1903 const jchar *result = UNCHECKED()->GetStringCritical(env, string, isCopy);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1904 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1905 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1906 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1907
a61af66fc99e Initial load
duke
parents:
diff changeset
1908 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1909 checked_jni_ReleaseStringCritical(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1910 jstring str,
a61af66fc99e Initial load
duke
parents:
diff changeset
1911 const jchar *chars))
a61af66fc99e Initial load
duke
parents:
diff changeset
1912 functionEnterCriticalExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1913 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1914 checkString(thr, str);
a61af66fc99e Initial load
duke
parents:
diff changeset
1915 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1916 /* The Hotspot JNI code does not use the parameters, so just check the
a61af66fc99e Initial load
duke
parents:
diff changeset
1917 * string parameter as a minor sanity check
a61af66fc99e Initial load
duke
parents:
diff changeset
1918 */
a61af66fc99e Initial load
duke
parents:
diff changeset
1919 UNCHECKED()->ReleaseStringCritical(env, str, chars);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1920 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1921 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1922
a61af66fc99e Initial load
duke
parents:
diff changeset
1923 JNI_ENTRY_CHECKED(jweak,
a61af66fc99e Initial load
duke
parents:
diff changeset
1924 checked_jni_NewWeakGlobalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1925 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
1926 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1927 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1928 if (obj != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1929 jniCheck::validate_handle(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
1930 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1931 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1932 jweak result = UNCHECKED()->NewWeakGlobalRef(env, obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1933 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1934 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1935 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1936
a61af66fc99e Initial load
duke
parents:
diff changeset
1937 JNI_ENTRY_CHECKED(void,
a61af66fc99e Initial load
duke
parents:
diff changeset
1938 checked_jni_DeleteWeakGlobalRef(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1939 jweak ref))
a61af66fc99e Initial load
duke
parents:
diff changeset
1940 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1941 UNCHECKED()->DeleteWeakGlobalRef(env, ref);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1942 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1943 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1944
a61af66fc99e Initial load
duke
parents:
diff changeset
1945 JNI_ENTRY_CHECKED(jboolean,
a61af66fc99e Initial load
duke
parents:
diff changeset
1946 checked_jni_ExceptionCheck(JNIEnv *env))
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1947 thr->clear_pending_jni_exception_check();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1948 functionEnterExceptionAllowed(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1949 jboolean result = UNCHECKED()->ExceptionCheck(env);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1950 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1951 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1952 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1953
a61af66fc99e Initial load
duke
parents:
diff changeset
1954 JNI_ENTRY_CHECKED(jobject,
a61af66fc99e Initial load
duke
parents:
diff changeset
1955 checked_jni_NewDirectByteBuffer(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1956 void *address,
a61af66fc99e Initial load
duke
parents:
diff changeset
1957 jlong capacity))
a61af66fc99e Initial load
duke
parents:
diff changeset
1958 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1959 jobject result = UNCHECKED()->NewDirectByteBuffer(env, address, capacity);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1960 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1961 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1962 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1963
a61af66fc99e Initial load
duke
parents:
diff changeset
1964 JNI_ENTRY_CHECKED(void *,
a61af66fc99e Initial load
duke
parents:
diff changeset
1965 checked_jni_GetDirectBufferAddress(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1966 jobject buf))
a61af66fc99e Initial load
duke
parents:
diff changeset
1967 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1968 void* result = UNCHECKED()->GetDirectBufferAddress(env, buf);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1969 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1970 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1971 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1972
a61af66fc99e Initial load
duke
parents:
diff changeset
1973 JNI_ENTRY_CHECKED(jlong,
a61af66fc99e Initial load
duke
parents:
diff changeset
1974 checked_jni_GetDirectBufferCapacity(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1975 jobject buf))
a61af66fc99e Initial load
duke
parents:
diff changeset
1976 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1977 jlong result = UNCHECKED()->GetDirectBufferCapacity(env, buf);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1978 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1979 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1980 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1981
a61af66fc99e Initial load
duke
parents:
diff changeset
1982 JNI_ENTRY_CHECKED(jobjectRefType,
a61af66fc99e Initial load
duke
parents:
diff changeset
1983 checked_jni_GetObjectRefType(JNIEnv *env,
a61af66fc99e Initial load
duke
parents:
diff changeset
1984 jobject obj))
a61af66fc99e Initial load
duke
parents:
diff changeset
1985 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1986 /* validate the object being passed */
a61af66fc99e Initial load
duke
parents:
diff changeset
1987 IN_VM(
a61af66fc99e Initial load
duke
parents:
diff changeset
1988 jniCheck::validate_object(thr, obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
1989 )
a61af66fc99e Initial load
duke
parents:
diff changeset
1990 jobjectRefType result = UNCHECKED()->GetObjectRefType(env, obj);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
1991 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1992 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1993 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
1994
a61af66fc99e Initial load
duke
parents:
diff changeset
1995
a61af66fc99e Initial load
duke
parents:
diff changeset
1996 JNI_ENTRY_CHECKED(jint,
a61af66fc99e Initial load
duke
parents:
diff changeset
1997 checked_jni_GetVersion(JNIEnv *env))
a61af66fc99e Initial load
duke
parents:
diff changeset
1998 functionEnter(thr);
a61af66fc99e Initial load
duke
parents:
diff changeset
1999 jint result = UNCHECKED()->GetVersion(env);
22877
d68158e12cea 8043224: -Xcheck:jni improvements to exception checking and excessive local refs
poonam
parents: 20319
diff changeset
2000 functionExit(thr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2001 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
2002 JNI_END
a61af66fc99e Initial load
duke
parents:
diff changeset
2003
a61af66fc99e Initial load
duke
parents:
diff changeset
2004
a61af66fc99e Initial load
duke
parents:
diff changeset
2005
a61af66fc99e Initial load
duke
parents:
diff changeset
2006 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2007 * Structure containing all checked jni functions
a61af66fc99e Initial load
duke
parents:
diff changeset
2008 */
a61af66fc99e Initial load
duke
parents:
diff changeset
2009 struct JNINativeInterface_ checked_jni_NativeInterface = {
a61af66fc99e Initial load
duke
parents:
diff changeset
2010 NULL,
a61af66fc99e Initial load
duke
parents:
diff changeset
2011 NULL,
a61af66fc99e Initial load
duke
parents:
diff changeset
2012 NULL,
a61af66fc99e Initial load
duke
parents:
diff changeset
2013
a61af66fc99e Initial load
duke
parents:
diff changeset
2014 NULL,
a61af66fc99e Initial load
duke
parents:
diff changeset
2015
a61af66fc99e Initial load
duke
parents:
diff changeset
2016 checked_jni_GetVersion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2017
a61af66fc99e Initial load
duke
parents:
diff changeset
2018 checked_jni_DefineClass,
a61af66fc99e Initial load
duke
parents:
diff changeset
2019 checked_jni_FindClass,
a61af66fc99e Initial load
duke
parents:
diff changeset
2020
a61af66fc99e Initial load
duke
parents:
diff changeset
2021 checked_jni_FromReflectedMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2022 checked_jni_FromReflectedField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2023
a61af66fc99e Initial load
duke
parents:
diff changeset
2024 checked_jni_ToReflectedMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2025
a61af66fc99e Initial load
duke
parents:
diff changeset
2026 checked_jni_GetSuperclass,
a61af66fc99e Initial load
duke
parents:
diff changeset
2027 checked_jni_IsAssignableFrom,
a61af66fc99e Initial load
duke
parents:
diff changeset
2028
a61af66fc99e Initial load
duke
parents:
diff changeset
2029 checked_jni_ToReflectedField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2030
a61af66fc99e Initial load
duke
parents:
diff changeset
2031 checked_jni_Throw,
a61af66fc99e Initial load
duke
parents:
diff changeset
2032 checked_jni_ThrowNew,
a61af66fc99e Initial load
duke
parents:
diff changeset
2033 checked_jni_ExceptionOccurred,
a61af66fc99e Initial load
duke
parents:
diff changeset
2034 checked_jni_ExceptionDescribe,
a61af66fc99e Initial load
duke
parents:
diff changeset
2035 checked_jni_ExceptionClear,
a61af66fc99e Initial load
duke
parents:
diff changeset
2036 checked_jni_FatalError,
a61af66fc99e Initial load
duke
parents:
diff changeset
2037
a61af66fc99e Initial load
duke
parents:
diff changeset
2038 checked_jni_PushLocalFrame,
a61af66fc99e Initial load
duke
parents:
diff changeset
2039 checked_jni_PopLocalFrame,
a61af66fc99e Initial load
duke
parents:
diff changeset
2040
a61af66fc99e Initial load
duke
parents:
diff changeset
2041 checked_jni_NewGlobalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2042 checked_jni_DeleteGlobalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2043 checked_jni_DeleteLocalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2044 checked_jni_IsSameObject,
a61af66fc99e Initial load
duke
parents:
diff changeset
2045
a61af66fc99e Initial load
duke
parents:
diff changeset
2046 checked_jni_NewLocalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2047 checked_jni_EnsureLocalCapacity,
a61af66fc99e Initial load
duke
parents:
diff changeset
2048
a61af66fc99e Initial load
duke
parents:
diff changeset
2049 checked_jni_AllocObject,
a61af66fc99e Initial load
duke
parents:
diff changeset
2050 checked_jni_NewObject,
a61af66fc99e Initial load
duke
parents:
diff changeset
2051 checked_jni_NewObjectV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2052 checked_jni_NewObjectA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2053
a61af66fc99e Initial load
duke
parents:
diff changeset
2054 checked_jni_GetObjectClass,
a61af66fc99e Initial load
duke
parents:
diff changeset
2055 checked_jni_IsInstanceOf,
a61af66fc99e Initial load
duke
parents:
diff changeset
2056
a61af66fc99e Initial load
duke
parents:
diff changeset
2057 checked_jni_GetMethodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
2058
a61af66fc99e Initial load
duke
parents:
diff changeset
2059 checked_jni_CallObjectMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2060 checked_jni_CallObjectMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2061 checked_jni_CallObjectMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2062 checked_jni_CallBooleanMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2063 checked_jni_CallBooleanMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2064 checked_jni_CallBooleanMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2065 checked_jni_CallByteMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2066 checked_jni_CallByteMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2067 checked_jni_CallByteMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2068 checked_jni_CallCharMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2069 checked_jni_CallCharMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2070 checked_jni_CallCharMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2071 checked_jni_CallShortMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2072 checked_jni_CallShortMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2073 checked_jni_CallShortMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2074 checked_jni_CallIntMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2075 checked_jni_CallIntMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2076 checked_jni_CallIntMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2077 checked_jni_CallLongMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2078 checked_jni_CallLongMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2079 checked_jni_CallLongMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2080 checked_jni_CallFloatMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2081 checked_jni_CallFloatMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2082 checked_jni_CallFloatMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2083 checked_jni_CallDoubleMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2084 checked_jni_CallDoubleMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2085 checked_jni_CallDoubleMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2086 checked_jni_CallVoidMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2087 checked_jni_CallVoidMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2088 checked_jni_CallVoidMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2089
a61af66fc99e Initial load
duke
parents:
diff changeset
2090 checked_jni_CallNonvirtualObjectMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2091 checked_jni_CallNonvirtualObjectMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2092 checked_jni_CallNonvirtualObjectMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2093 checked_jni_CallNonvirtualBooleanMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2094 checked_jni_CallNonvirtualBooleanMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2095 checked_jni_CallNonvirtualBooleanMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2096 checked_jni_CallNonvirtualByteMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2097 checked_jni_CallNonvirtualByteMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2098 checked_jni_CallNonvirtualByteMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2099 checked_jni_CallNonvirtualCharMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2100 checked_jni_CallNonvirtualCharMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2101 checked_jni_CallNonvirtualCharMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2102 checked_jni_CallNonvirtualShortMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2103 checked_jni_CallNonvirtualShortMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2104 checked_jni_CallNonvirtualShortMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2105 checked_jni_CallNonvirtualIntMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2106 checked_jni_CallNonvirtualIntMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2107 checked_jni_CallNonvirtualIntMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2108 checked_jni_CallNonvirtualLongMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2109 checked_jni_CallNonvirtualLongMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2110 checked_jni_CallNonvirtualLongMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2111 checked_jni_CallNonvirtualFloatMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2112 checked_jni_CallNonvirtualFloatMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2113 checked_jni_CallNonvirtualFloatMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2114 checked_jni_CallNonvirtualDoubleMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2115 checked_jni_CallNonvirtualDoubleMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2116 checked_jni_CallNonvirtualDoubleMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2117 checked_jni_CallNonvirtualVoidMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2118 checked_jni_CallNonvirtualVoidMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2119 checked_jni_CallNonvirtualVoidMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2120
a61af66fc99e Initial load
duke
parents:
diff changeset
2121 checked_jni_GetFieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
2122
a61af66fc99e Initial load
duke
parents:
diff changeset
2123 checked_jni_GetObjectField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2124 checked_jni_GetBooleanField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2125 checked_jni_GetByteField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2126 checked_jni_GetCharField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2127 checked_jni_GetShortField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2128 checked_jni_GetIntField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2129 checked_jni_GetLongField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2130 checked_jni_GetFloatField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2131 checked_jni_GetDoubleField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2132
a61af66fc99e Initial load
duke
parents:
diff changeset
2133 checked_jni_SetObjectField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2134 checked_jni_SetBooleanField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2135 checked_jni_SetByteField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2136 checked_jni_SetCharField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2137 checked_jni_SetShortField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2138 checked_jni_SetIntField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2139 checked_jni_SetLongField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2140 checked_jni_SetFloatField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2141 checked_jni_SetDoubleField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2142
a61af66fc99e Initial load
duke
parents:
diff changeset
2143 checked_jni_GetStaticMethodID,
a61af66fc99e Initial load
duke
parents:
diff changeset
2144
a61af66fc99e Initial load
duke
parents:
diff changeset
2145 checked_jni_CallStaticObjectMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2146 checked_jni_CallStaticObjectMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2147 checked_jni_CallStaticObjectMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2148 checked_jni_CallStaticBooleanMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2149 checked_jni_CallStaticBooleanMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2150 checked_jni_CallStaticBooleanMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2151 checked_jni_CallStaticByteMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2152 checked_jni_CallStaticByteMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2153 checked_jni_CallStaticByteMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2154 checked_jni_CallStaticCharMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2155 checked_jni_CallStaticCharMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2156 checked_jni_CallStaticCharMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2157 checked_jni_CallStaticShortMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2158 checked_jni_CallStaticShortMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2159 checked_jni_CallStaticShortMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2160 checked_jni_CallStaticIntMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2161 checked_jni_CallStaticIntMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2162 checked_jni_CallStaticIntMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2163 checked_jni_CallStaticLongMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2164 checked_jni_CallStaticLongMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2165 checked_jni_CallStaticLongMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2166 checked_jni_CallStaticFloatMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2167 checked_jni_CallStaticFloatMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2168 checked_jni_CallStaticFloatMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2169 checked_jni_CallStaticDoubleMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2170 checked_jni_CallStaticDoubleMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2171 checked_jni_CallStaticDoubleMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2172 checked_jni_CallStaticVoidMethod,
a61af66fc99e Initial load
duke
parents:
diff changeset
2173 checked_jni_CallStaticVoidMethodV,
a61af66fc99e Initial load
duke
parents:
diff changeset
2174 checked_jni_CallStaticVoidMethodA,
a61af66fc99e Initial load
duke
parents:
diff changeset
2175
a61af66fc99e Initial load
duke
parents:
diff changeset
2176 checked_jni_GetStaticFieldID,
a61af66fc99e Initial load
duke
parents:
diff changeset
2177
a61af66fc99e Initial load
duke
parents:
diff changeset
2178 checked_jni_GetStaticObjectField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2179 checked_jni_GetStaticBooleanField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2180 checked_jni_GetStaticByteField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2181 checked_jni_GetStaticCharField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2182 checked_jni_GetStaticShortField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2183 checked_jni_GetStaticIntField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2184 checked_jni_GetStaticLongField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2185 checked_jni_GetStaticFloatField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2186 checked_jni_GetStaticDoubleField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2187
a61af66fc99e Initial load
duke
parents:
diff changeset
2188 checked_jni_SetStaticObjectField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2189 checked_jni_SetStaticBooleanField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2190 checked_jni_SetStaticByteField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2191 checked_jni_SetStaticCharField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2192 checked_jni_SetStaticShortField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2193 checked_jni_SetStaticIntField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2194 checked_jni_SetStaticLongField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2195 checked_jni_SetStaticFloatField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2196 checked_jni_SetStaticDoubleField,
a61af66fc99e Initial load
duke
parents:
diff changeset
2197
a61af66fc99e Initial load
duke
parents:
diff changeset
2198 checked_jni_NewString,
a61af66fc99e Initial load
duke
parents:
diff changeset
2199 checked_jni_GetStringLength,
a61af66fc99e Initial load
duke
parents:
diff changeset
2200 checked_jni_GetStringChars,
a61af66fc99e Initial load
duke
parents:
diff changeset
2201 checked_jni_ReleaseStringChars,
a61af66fc99e Initial load
duke
parents:
diff changeset
2202
a61af66fc99e Initial load
duke
parents:
diff changeset
2203 checked_jni_NewStringUTF,
a61af66fc99e Initial load
duke
parents:
diff changeset
2204 checked_jni_GetStringUTFLength,
a61af66fc99e Initial load
duke
parents:
diff changeset
2205 checked_jni_GetStringUTFChars,
a61af66fc99e Initial load
duke
parents:
diff changeset
2206 checked_jni_ReleaseStringUTFChars,
a61af66fc99e Initial load
duke
parents:
diff changeset
2207
a61af66fc99e Initial load
duke
parents:
diff changeset
2208 checked_jni_GetArrayLength,
a61af66fc99e Initial load
duke
parents:
diff changeset
2209
a61af66fc99e Initial load
duke
parents:
diff changeset
2210 checked_jni_NewObjectArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2211 checked_jni_GetObjectArrayElement,
a61af66fc99e Initial load
duke
parents:
diff changeset
2212 checked_jni_SetObjectArrayElement,
a61af66fc99e Initial load
duke
parents:
diff changeset
2213
a61af66fc99e Initial load
duke
parents:
diff changeset
2214 checked_jni_NewBooleanArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2215 checked_jni_NewByteArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2216 checked_jni_NewCharArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2217 checked_jni_NewShortArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2218 checked_jni_NewIntArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2219 checked_jni_NewLongArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2220 checked_jni_NewFloatArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2221 checked_jni_NewDoubleArray,
a61af66fc99e Initial load
duke
parents:
diff changeset
2222
a61af66fc99e Initial load
duke
parents:
diff changeset
2223 checked_jni_GetBooleanArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2224 checked_jni_GetByteArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2225 checked_jni_GetCharArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2226 checked_jni_GetShortArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2227 checked_jni_GetIntArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2228 checked_jni_GetLongArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2229 checked_jni_GetFloatArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2230 checked_jni_GetDoubleArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2231
a61af66fc99e Initial load
duke
parents:
diff changeset
2232 checked_jni_ReleaseBooleanArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2233 checked_jni_ReleaseByteArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2234 checked_jni_ReleaseCharArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2235 checked_jni_ReleaseShortArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2236 checked_jni_ReleaseIntArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2237 checked_jni_ReleaseLongArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2238 checked_jni_ReleaseFloatArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2239 checked_jni_ReleaseDoubleArrayElements,
a61af66fc99e Initial load
duke
parents:
diff changeset
2240
a61af66fc99e Initial load
duke
parents:
diff changeset
2241 checked_jni_GetBooleanArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2242 checked_jni_GetByteArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2243 checked_jni_GetCharArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2244 checked_jni_GetShortArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2245 checked_jni_GetIntArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2246 checked_jni_GetLongArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2247 checked_jni_GetFloatArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2248 checked_jni_GetDoubleArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2249
a61af66fc99e Initial load
duke
parents:
diff changeset
2250 checked_jni_SetBooleanArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2251 checked_jni_SetByteArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2252 checked_jni_SetCharArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2253 checked_jni_SetShortArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2254 checked_jni_SetIntArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2255 checked_jni_SetLongArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2256 checked_jni_SetFloatArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2257 checked_jni_SetDoubleArrayRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2258
a61af66fc99e Initial load
duke
parents:
diff changeset
2259 checked_jni_RegisterNatives,
a61af66fc99e Initial load
duke
parents:
diff changeset
2260 checked_jni_UnregisterNatives,
a61af66fc99e Initial load
duke
parents:
diff changeset
2261
a61af66fc99e Initial load
duke
parents:
diff changeset
2262 checked_jni_MonitorEnter,
a61af66fc99e Initial load
duke
parents:
diff changeset
2263 checked_jni_MonitorExit,
a61af66fc99e Initial load
duke
parents:
diff changeset
2264
a61af66fc99e Initial load
duke
parents:
diff changeset
2265 checked_jni_GetJavaVM,
a61af66fc99e Initial load
duke
parents:
diff changeset
2266
a61af66fc99e Initial load
duke
parents:
diff changeset
2267 checked_jni_GetStringRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2268 checked_jni_GetStringUTFRegion,
a61af66fc99e Initial load
duke
parents:
diff changeset
2269
a61af66fc99e Initial load
duke
parents:
diff changeset
2270 checked_jni_GetPrimitiveArrayCritical,
a61af66fc99e Initial load
duke
parents:
diff changeset
2271 checked_jni_ReleasePrimitiveArrayCritical,
a61af66fc99e Initial load
duke
parents:
diff changeset
2272
a61af66fc99e Initial load
duke
parents:
diff changeset
2273 checked_jni_GetStringCritical,
a61af66fc99e Initial load
duke
parents:
diff changeset
2274 checked_jni_ReleaseStringCritical,
a61af66fc99e Initial load
duke
parents:
diff changeset
2275
a61af66fc99e Initial load
duke
parents:
diff changeset
2276 checked_jni_NewWeakGlobalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2277 checked_jni_DeleteWeakGlobalRef,
a61af66fc99e Initial load
duke
parents:
diff changeset
2278
a61af66fc99e Initial load
duke
parents:
diff changeset
2279 checked_jni_ExceptionCheck,
a61af66fc99e Initial load
duke
parents:
diff changeset
2280
a61af66fc99e Initial load
duke
parents:
diff changeset
2281 checked_jni_NewDirectByteBuffer,
a61af66fc99e Initial load
duke
parents:
diff changeset
2282 checked_jni_GetDirectBufferAddress,
a61af66fc99e Initial load
duke
parents:
diff changeset
2283 checked_jni_GetDirectBufferCapacity,
a61af66fc99e Initial load
duke
parents:
diff changeset
2284
a61af66fc99e Initial load
duke
parents:
diff changeset
2285 // New 1.6 Features
a61af66fc99e Initial load
duke
parents:
diff changeset
2286
a61af66fc99e Initial load
duke
parents:
diff changeset
2287 checked_jni_GetObjectRefType
a61af66fc99e Initial load
duke
parents:
diff changeset
2288 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2289
a61af66fc99e Initial load
duke
parents:
diff changeset
2290
a61af66fc99e Initial load
duke
parents:
diff changeset
2291 // Returns the function structure
a61af66fc99e Initial load
duke
parents:
diff changeset
2292 struct JNINativeInterface_* jni_functions_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
2293
a61af66fc99e Initial load
duke
parents:
diff changeset
2294 unchecked_jni_NativeInterface = jni_functions_nocheck();
a61af66fc99e Initial load
duke
parents:
diff changeset
2295
a61af66fc99e Initial load
duke
parents:
diff changeset
2296 // make sure the last pointer in the checked table is not null, indicating
a61af66fc99e Initial load
duke
parents:
diff changeset
2297 // an addition to the JNINativeInterface_ structure without initializing
a61af66fc99e Initial load
duke
parents:
diff changeset
2298 // it in the checked table.
a61af66fc99e Initial load
duke
parents:
diff changeset
2299 debug_only(int *lastPtr = (int *)((char *)&checked_jni_NativeInterface + \
a61af66fc99e Initial load
duke
parents:
diff changeset
2300 sizeof(*unchecked_jni_NativeInterface) - sizeof(char *));)
a61af66fc99e Initial load
duke
parents:
diff changeset
2301 assert(*lastPtr != 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
2302 "Mismatched JNINativeInterface tables, check for new entries");
a61af66fc99e Initial load
duke
parents:
diff changeset
2303
a61af66fc99e Initial load
duke
parents:
diff changeset
2304 // with -verbose:jni this message will print
a61af66fc99e Initial load
duke
parents:
diff changeset
2305 if (PrintJNIResolving) {
a61af66fc99e Initial load
duke
parents:
diff changeset
2306 tty->print_cr("Checked JNI functions are being used to " \
a61af66fc99e Initial load
duke
parents:
diff changeset
2307 "validate JNI usage");
a61af66fc99e Initial load
duke
parents:
diff changeset
2308 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2309
a61af66fc99e Initial load
duke
parents:
diff changeset
2310 return &checked_jni_NativeInterface;
a61af66fc99e Initial load
duke
parents:
diff changeset
2311 }