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