comparison src/share/vm/prims/jni.cpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents 957c266d8bc5 18fb7da42534
children 2cb439954abf
comparison
equal deleted inserted replaced
6711:ae13cc658b80 6948:e522a00b91aa
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012 Red Hat, Inc.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 5 *
5 * This code is free software; you can redistribute it and/or modify it 6 * 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 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
45 #include "memory/oopFactory.hpp" 46 #include "memory/oopFactory.hpp"
46 #include "memory/universe.inline.hpp" 47 #include "memory/universe.inline.hpp"
47 #include "oops/instanceKlass.hpp" 48 #include "oops/instanceKlass.hpp"
48 #include "oops/instanceOop.hpp" 49 #include "oops/instanceOop.hpp"
49 #include "oops/markOop.hpp" 50 #include "oops/markOop.hpp"
50 #include "oops/methodOop.hpp" 51 #include "oops/method.hpp"
51 #include "oops/objArrayKlass.hpp" 52 #include "oops/objArrayKlass.hpp"
52 #include "oops/objArrayOop.hpp" 53 #include "oops/objArrayOop.hpp"
53 #include "oops/oop.inline.hpp" 54 #include "oops/oop.inline.hpp"
54 #include "oops/symbol.hpp" 55 #include "oops/symbol.hpp"
55 #include "oops/typeArrayKlass.hpp" 56 #include "oops/typeArrayKlass.hpp"
212 DT_RETURN_MARK(name, type, ref), DT_VOID_RETURN_MARK(name) ) 213 DT_RETURN_MARK(name, type, ref), DT_VOID_RETURN_MARK(name) )
213 214
214 215
215 // out-of-line helpers for class jfieldIDWorkaround: 216 // out-of-line helpers for class jfieldIDWorkaround:
216 217
217 bool jfieldIDWorkaround::is_valid_jfieldID(klassOop k, jfieldID id) { 218 bool jfieldIDWorkaround::is_valid_jfieldID(Klass* k, jfieldID id) {
218 if (jfieldIDWorkaround::is_instance_jfieldID(k, id)) { 219 if (jfieldIDWorkaround::is_instance_jfieldID(k, id)) {
219 uintptr_t as_uint = (uintptr_t) id; 220 uintptr_t as_uint = (uintptr_t) id;
220 intptr_t offset = raw_instance_offset(id); 221 intptr_t offset = raw_instance_offset(id);
221 if (is_checked_jfieldID(id)) { 222 if (is_checked_jfieldID(id)) {
222 if (!klass_hash_ok(k, id)) { 223 if (!klass_hash_ok(k, id)) {
223 return false; 224 return false;
224 } 225 }
225 } 226 }
226 return instanceKlass::cast(k)->contains_field_offset(offset); 227 return InstanceKlass::cast(k)->contains_field_offset(offset);
227 } else { 228 } else {
228 JNIid* result = (JNIid*) id; 229 JNIid* result = (JNIid*) id;
229 #ifdef ASSERT 230 #ifdef ASSERT
230 return result != NULL && result->is_static_field_id(); 231 return result != NULL && result->is_static_field_id();
231 #else 232 #else
233 #endif 234 #endif
234 } 235 }
235 } 236 }
236 237
237 238
238 intptr_t jfieldIDWorkaround::encode_klass_hash(klassOop k, intptr_t offset) { 239 intptr_t jfieldIDWorkaround::encode_klass_hash(Klass* k, intptr_t offset) {
239 if (offset <= small_offset_mask) { 240 if (offset <= small_offset_mask) {
240 klassOop field_klass = k; 241 Klass* field_klass = k;
241 klassOop super_klass = Klass::cast(field_klass)->super(); 242 Klass* super_klass = Klass::cast(field_klass)->super();
242 // With compressed oops the most super class with nonstatic fields would 243 // With compressed oops the most super class with nonstatic fields would
243 // be the owner of fields embedded in the header. 244 // be the owner of fields embedded in the header.
244 while (instanceKlass::cast(super_klass)->has_nonstatic_fields() && 245 while (InstanceKlass::cast(super_klass)->has_nonstatic_fields() &&
245 instanceKlass::cast(super_klass)->contains_field_offset(offset)) { 246 InstanceKlass::cast(super_klass)->contains_field_offset(offset)) {
246 field_klass = super_klass; // super contains the field also 247 field_klass = super_klass; // super contains the field also
247 super_klass = Klass::cast(field_klass)->super(); 248 super_klass = Klass::cast(field_klass)->super();
248 } 249 }
249 debug_only(No_Safepoint_Verifier nosafepoint;) 250 debug_only(No_Safepoint_Verifier nosafepoint;)
250 uintptr_t klass_hash = field_klass->identity_hash(); 251 uintptr_t klass_hash = field_klass->identity_hash();
260 #endif 261 #endif
261 return 0; 262 return 0;
262 } 263 }
263 } 264 }
264 265
265 bool jfieldIDWorkaround::klass_hash_ok(klassOop k, jfieldID id) { 266 bool jfieldIDWorkaround::klass_hash_ok(Klass* k, jfieldID id) {
266 uintptr_t as_uint = (uintptr_t) id; 267 uintptr_t as_uint = (uintptr_t) id;
267 intptr_t klass_hash = (as_uint >> klass_shift) & klass_mask; 268 intptr_t klass_hash = (as_uint >> klass_shift) & klass_mask;
268 do { 269 do {
269 debug_only(No_Safepoint_Verifier nosafepoint;) 270 debug_only(No_Safepoint_Verifier nosafepoint;)
270 // Could use a non-blocking query for identity_hash here... 271 // Could use a non-blocking query for identity_hash here...
273 k = Klass::cast(k)->super(); 274 k = Klass::cast(k)->super();
274 } while (k != NULL); 275 } while (k != NULL);
275 return false; 276 return false;
276 } 277 }
277 278
278 void jfieldIDWorkaround::verify_instance_jfieldID(klassOop k, jfieldID id) { 279 void jfieldIDWorkaround::verify_instance_jfieldID(Klass* k, jfieldID id) {
279 guarantee(jfieldIDWorkaround::is_instance_jfieldID(k, id), "must be an instance field" ); 280 guarantee(jfieldIDWorkaround::is_instance_jfieldID(k, id), "must be an instance field" );
280 uintptr_t as_uint = (uintptr_t) id; 281 uintptr_t as_uint = (uintptr_t) id;
281 intptr_t offset = raw_instance_offset(id); 282 intptr_t offset = raw_instance_offset(id);
282 if (VerifyJNIFields) { 283 if (VerifyJNIFields) {
283 if (is_checked_jfieldID(id)) { 284 if (is_checked_jfieldID(id)) {
292 } 293 }
293 #endif 294 #endif
294 #endif 295 #endif
295 } 296 }
296 } 297 }
297 guarantee(instanceKlass::cast(k)->contains_field_offset(offset), 298 guarantee(InstanceKlass::cast(k)->contains_field_offset(offset),
298 "Bug in native code: jfieldID offset must address interior of object"); 299 "Bug in native code: jfieldID offset must address interior of object");
299 } 300 }
300 301
301 // Pick a reasonable higher bound for local capacity requested 302 // Pick a reasonable higher bound for local capacity requested
302 // for EnsureLocalCapacity and PushLocalFrame. We don't want it too 303 // for EnsureLocalCapacity and PushLocalFrame. We don't want it too
409 query_lock_ownership((JavaThread*)THREAD, class_loader) != 410 query_lock_ownership((JavaThread*)THREAD, class_loader) !=
410 ObjectSynchronizer::owner_self) { 411 ObjectSynchronizer::owner_self) {
411 ClassLoader::sync_JNIDefineClassLockFreeCounter()->inc(); 412 ClassLoader::sync_JNIDefineClassLockFreeCounter()->inc();
412 } 413 }
413 } 414 }
414 klassOop k = SystemDictionary::resolve_from_stream(class_name, class_loader, 415 Klass* k = SystemDictionary::resolve_from_stream(class_name, class_loader,
415 Handle(), &st, true, 416 Handle(), &st, true,
416 CHECK_NULL); 417 CHECK_NULL);
417 418
418 if (TraceClassResolution && k != NULL) { 419 if (TraceClassResolution && k != NULL) {
419 trace_class_resolution(k); 420 trace_class_resolution(k);
478 CLEAR_PENDING_EXCEPTION; 479 CLEAR_PENDING_EXCEPTION;
479 THROW_HANDLE_0(ex); 480 THROW_HANDLE_0(ex);
480 } 481 }
481 oop mirror = (oop) result.get_jobject(); 482 oop mirror = (oop) result.get_jobject();
482 loader = Handle(THREAD, 483 loader = Handle(THREAD,
483 instanceKlass::cast(java_lang_Class::as_klassOop(mirror))->class_loader()); 484 InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->class_loader());
484 protection_domain = Handle(THREAD, 485 protection_domain = Handle(THREAD,
485 instanceKlass::cast(java_lang_Class::as_klassOop(mirror))->protection_domain()); 486 InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->protection_domain());
486 } 487 }
487 } else { 488 } else {
488 // We call ClassLoader.getSystemClassLoader to obtain the system class loader. 489 // We call ClassLoader.getSystemClassLoader to obtain the system class loader.
489 loader = Handle(THREAD, SystemDictionary::java_system_loader()); 490 loader = Handle(THREAD, SystemDictionary::java_system_loader());
490 } 491 }
492 TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL); 493 TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL);
493 result = find_class_from_class_loader(env, sym, true, loader, 494 result = find_class_from_class_loader(env, sym, true, loader,
494 protection_domain, true, thread); 495 protection_domain, true, thread);
495 496
496 if (TraceClassResolution && result != NULL) { 497 if (TraceClassResolution && result != NULL) {
497 trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); 498 trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
498 } 499 }
499 500
500 // If we were the first invocation of jni_FindClass, we enable compilation again 501 // If we were the first invocation of jni_FindClass, we enable compilation again
501 // rather than just allowing invocation counter to overflow and decay. 502 // rather than just allowing invocation counter to overflow and decay.
502 // Controlled by flag DelayCompilationDuringStartup. 503 // Controlled by flag DelayCompilationDuringStartup.
535 } else { 536 } else {
536 assert(reflected->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); 537 assert(reflected->klass() == SystemDictionary::reflect_Method_klass(), "wrong type");
537 mirror = java_lang_reflect_Method::clazz(reflected); 538 mirror = java_lang_reflect_Method::clazz(reflected);
538 slot = java_lang_reflect_Method::slot(reflected); 539 slot = java_lang_reflect_Method::slot(reflected);
539 } 540 }
540 klassOop k = java_lang_Class::as_klassOop(mirror); 541 Klass* k = java_lang_Class::as_Klass(mirror);
541 542
542 KlassHandle k1(THREAD, k); 543 KlassHandle k1(THREAD, k);
543 // Make sure class is initialized before handing id's out to methods 544 // Make sure class is initialized before handing id's out to methods
544 Klass::cast(k1())->initialize(CHECK_NULL); 545 Klass::cast(k1())->initialize(CHECK_NULL);
545 methodOop m = instanceKlass::cast(k1())->method_with_idnum(slot); 546 Method* m = InstanceKlass::cast(k1())->method_with_idnum(slot);
546 ret = m==NULL? NULL : m->jmethod_id(); // return NULL if reflected method deleted 547 ret = m==NULL? NULL : m->jmethod_id(); // return NULL if reflected method deleted
547 return ret; 548 return ret;
548 JNI_END 549 JNI_END
549 550
550 #ifndef USDT2 551 #ifndef USDT2
566 DT_RETURN_MARK(FromReflectedField, jfieldID, (const jfieldID&)ret); 567 DT_RETURN_MARK(FromReflectedField, jfieldID, (const jfieldID&)ret);
567 568
568 // field is a handle to a java.lang.reflect.Field object 569 // field is a handle to a java.lang.reflect.Field object
569 oop reflected = JNIHandles::resolve_non_null(field); 570 oop reflected = JNIHandles::resolve_non_null(field);
570 oop mirror = java_lang_reflect_Field::clazz(reflected); 571 oop mirror = java_lang_reflect_Field::clazz(reflected);
571 klassOop k = java_lang_Class::as_klassOop(mirror); 572 Klass* k = java_lang_Class::as_Klass(mirror);
572 int slot = java_lang_reflect_Field::slot(reflected); 573 int slot = java_lang_reflect_Field::slot(reflected);
573 int modifiers = java_lang_reflect_Field::modifiers(reflected); 574 int modifiers = java_lang_reflect_Field::modifiers(reflected);
574 575
575 KlassHandle k1(THREAD, k); 576 KlassHandle k1(THREAD, k);
576 // Make sure class is initialized before handing id's out to fields 577 // Make sure class is initialized before handing id's out to fields
577 Klass::cast(k1())->initialize(CHECK_NULL); 578 Klass::cast(k1())->initialize(CHECK_NULL);
578 579
579 // First check if this is a static field 580 // First check if this is a static field
580 if (modifiers & JVM_ACC_STATIC) { 581 if (modifiers & JVM_ACC_STATIC) {
581 intptr_t offset = instanceKlass::cast(k1())->field_offset( slot ); 582 intptr_t offset = InstanceKlass::cast(k1())->field_offset( slot );
582 JNIid* id = instanceKlass::cast(k1())->jni_id_for(offset); 583 JNIid* id = InstanceKlass::cast(k1())->jni_id_for(offset);
583 assert(id != NULL, "corrupt Field object"); 584 assert(id != NULL, "corrupt Field object");
584 debug_only(id->set_is_static_field_id();) 585 debug_only(id->set_is_static_field_id();)
585 // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the klassOop 586 // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the Klass*
586 ret = jfieldIDWorkaround::to_static_jfieldID(id); 587 ret = jfieldIDWorkaround::to_static_jfieldID(id);
587 return ret; 588 return ret;
588 } 589 }
589 590
590 // The slot is the index of the field description in the field-array 591 // The slot is the index of the field description in the field-array
591 // The jfieldID is the offset of the field within the object 592 // The jfieldID is the offset of the field within the object
592 // It may also have hash bits for k, if VerifyJNIFields is turned on. 593 // It may also have hash bits for k, if VerifyJNIFields is turned on.
593 intptr_t offset = instanceKlass::cast(k1())->field_offset( slot ); 594 intptr_t offset = InstanceKlass::cast(k1())->field_offset( slot );
594 assert(instanceKlass::cast(k1())->contains_field_offset(offset), "stay within object"); 595 assert(InstanceKlass::cast(k1())->contains_field_offset(offset), "stay within object");
595 ret = jfieldIDWorkaround::to_instance_jfieldID(k1(), offset); 596 ret = jfieldIDWorkaround::to_instance_jfieldID(k1(), offset);
596 return ret; 597 return ret;
597 JNI_END 598 JNI_END
598 599
599 #ifndef USDT2 600 #ifndef USDT2
612 env, cls, (uintptr_t) method_id, isStatic); 613 env, cls, (uintptr_t) method_id, isStatic);
613 #endif /* USDT2 */ 614 #endif /* USDT2 */
614 jobject ret = NULL; 615 jobject ret = NULL;
615 DT_RETURN_MARK(ToReflectedMethod, jobject, (const jobject&)ret); 616 DT_RETURN_MARK(ToReflectedMethod, jobject, (const jobject&)ret);
616 617
617 methodHandle m (THREAD, JNIHandles::resolve_jmethod_id(method_id)); 618 methodHandle m (THREAD, Method::resolve_jmethod_id(method_id));
618 assert(m->is_static() == (isStatic != 0), "jni_ToReflectedMethod access flags doesn't match"); 619 assert(m->is_static() == (isStatic != 0), "jni_ToReflectedMethod access flags doesn't match");
619 oop reflection_method; 620 oop reflection_method;
620 if (m->is_initializer()) { 621 if (m->is_initializer()) {
621 reflection_method = Reflection::new_constructor(m, CHECK_NULL); 622 reflection_method = Reflection::new_constructor(m, CHECK_NULL);
622 } else { 623 } else {
650 651
651 // Rules of Class.getSuperClass as implemented by KLass::java_super: 652 // Rules of Class.getSuperClass as implemented by KLass::java_super:
652 // arrays return Object 653 // arrays return Object
653 // interfaces return NULL 654 // interfaces return NULL
654 // proper classes return Klass::super() 655 // proper classes return Klass::super()
655 klassOop k = java_lang_Class::as_klassOop(mirror); 656 Klass* k = java_lang_Class::as_Klass(mirror);
656 if (Klass::cast(k)->is_interface()) return NULL; 657 if (Klass::cast(k)->is_interface()) return NULL;
657 658
658 // return mirror for superclass 659 // return mirror for superclass
659 klassOop super = Klass::cast(k)->java_super(); 660 Klass* super = Klass::cast(k)->java_super();
660 // super2 is the value computed by the compiler's getSuperClass intrinsic: 661 // super2 is the value computed by the compiler's getSuperClass intrinsic:
661 debug_only(klassOop super2 = ( Klass::cast(k)->oop_is_javaArray() 662 debug_only(Klass* super2 = ( Klass::cast(k)->oop_is_array()
662 ? SystemDictionary::Object_klass() 663 ? SystemDictionary::Object_klass()
663 : Klass::cast(k)->super() ) ); 664 : Klass::cast(k)->super() ) );
664 assert(super == super2, 665 assert(super == super2,
665 "java_super computation depends on interface, array, other super"); 666 "java_super computation depends on interface, array, other super");
666 obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror()); 667 obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror());
686 HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN( 687 HOTSPOT_JNI_ISASSIGNABLEFROM_RETURN(
687 ret); 688 ret);
688 #endif /* USDT2 */ 689 #endif /* USDT2 */
689 return ret; 690 return ret;
690 } 691 }
691 klassOop sub_klass = java_lang_Class::as_klassOop(sub_mirror); 692 Klass* sub_klass = java_lang_Class::as_Klass(sub_mirror);
692 klassOop super_klass = java_lang_Class::as_klassOop(super_mirror); 693 Klass* super_klass = java_lang_Class::as_Klass(super_mirror);
693 assert(sub_klass != NULL && super_klass != NULL, "invalid arguments to jni_IsAssignableFrom"); 694 assert(sub_klass != NULL && super_klass != NULL, "invalid arguments to jni_IsAssignableFrom");
694 jboolean ret = Klass::cast(sub_klass)->is_subtype_of(super_klass) ? 695 jboolean ret = Klass::cast(sub_klass)->is_subtype_of(super_klass) ?
695 JNI_TRUE : JNI_FALSE; 696 JNI_TRUE : JNI_FALSE;
696 #ifndef USDT2 697 #ifndef USDT2
697 DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret); 698 DTRACE_PROBE1(hotspot_jni, IsAssignableFrom__return, ret);
740 env, clazz, (char *) message); 741 env, clazz, (char *) message);
741 #endif /* USDT2 */ 742 #endif /* USDT2 */
742 jint ret = JNI_OK; 743 jint ret = JNI_OK;
743 DT_RETURN_MARK(ThrowNew, jint, (const jint&)ret); 744 DT_RETURN_MARK(ThrowNew, jint, (const jint&)ret);
744 745
745 instanceKlass* k = instanceKlass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 746 InstanceKlass* k = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
746 Symbol* name = k->name(); 747 Symbol* name = k->name();
747 Handle class_loader (THREAD, k->class_loader()); 748 Handle class_loader (THREAD, k->class_loader());
748 Handle protection_domain (THREAD, k->protection_domain()); 749 Handle protection_domain (THREAD, k->protection_domain());
749 THROW_MSG_LOADER_(name, (char *)message, class_loader, protection_domain, JNI_OK); 750 THROW_MSG_LOADER_(name, (char *)message, class_loader, protection_domain, JNI_OK);
750 ShouldNotReachHere(); 751 ShouldNotReachHere();
1161 JNI_ArgumentPusherVaArg(Symbol* signature, va_list rap) 1162 JNI_ArgumentPusherVaArg(Symbol* signature, va_list rap)
1162 : JNI_ArgumentPusher(signature) { 1163 : JNI_ArgumentPusher(signature) {
1163 set_ap(rap); 1164 set_ap(rap);
1164 } 1165 }
1165 JNI_ArgumentPusherVaArg(jmethodID method_id, va_list rap) 1166 JNI_ArgumentPusherVaArg(jmethodID method_id, va_list rap)
1166 : JNI_ArgumentPusher(JNIHandles::resolve_jmethod_id(method_id)->signature()) { 1167 : JNI_ArgumentPusher(Method::resolve_jmethod_id(method_id)->signature()) {
1167 set_ap(rap); 1168 set_ap(rap);
1168 } 1169 }
1169 1170
1170 // Optimized path if we have the bitvector form of signature 1171 // Optimized path if we have the bitvector form of signature
1171 void iterate( uint64_t fingerprint ) { 1172 void iterate( uint64_t fingerprint ) {
1232 JNI_ArgumentPusherArray(Symbol* signature, const jvalue *rap) 1233 JNI_ArgumentPusherArray(Symbol* signature, const jvalue *rap)
1233 : JNI_ArgumentPusher(signature) { 1234 : JNI_ArgumentPusher(signature) {
1234 set_ap(rap); 1235 set_ap(rap);
1235 } 1236 }
1236 JNI_ArgumentPusherArray(jmethodID method_id, const jvalue *rap) 1237 JNI_ArgumentPusherArray(jmethodID method_id, const jvalue *rap)
1237 : JNI_ArgumentPusher(JNIHandles::resolve_jmethod_id(method_id)->signature()) { 1238 : JNI_ArgumentPusher(Method::resolve_jmethod_id(method_id)->signature()) {
1238 set_ap(rap); 1239 set_ap(rap);
1239 } 1240 }
1240 1241
1241 // Optimized path if we have the bitvector form of signature 1242 // Optimized path if we have the bitvector form of signature
1242 void iterate( uint64_t fingerprint ) { 1243 void iterate( uint64_t fingerprint ) {
1323 1324
1324 1325
1325 static bool first_time_InvokeMain = true; 1326 static bool first_time_InvokeMain = true;
1326 1327
1327 static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) { 1328 static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
1328 methodHandle method(THREAD, JNIHandles::resolve_jmethod_id(method_id)); 1329 methodHandle method(THREAD, Method::resolve_jmethod_id(method_id));
1329 1330
1330 // Create object to hold arguments for the JavaCall, and associate it with 1331 // Create object to hold arguments for the JavaCall, and associate it with
1331 // the jni parser 1332 // the jni parser
1332 ResourceMark rm(THREAD); 1333 ResourceMark rm(THREAD);
1333 int number_of_parameters = method->size_of_parameters(); 1334 int number_of_parameters = method->size_of_parameters();
1378 THROW(vmSymbols::java_lang_NullPointerException()); 1379 THROW(vmSymbols::java_lang_NullPointerException());
1379 } 1380 }
1380 Handle h_recv(THREAD, recv); 1381 Handle h_recv(THREAD, recv);
1381 1382
1382 int number_of_parameters; 1383 int number_of_parameters;
1383 methodOop selected_method; 1384 Method* selected_method;
1384 { 1385 {
1385 methodOop m = JNIHandles::resolve_jmethod_id(method_id); 1386 Method* m = Method::resolve_jmethod_id(method_id);
1386 number_of_parameters = m->size_of_parameters(); 1387 number_of_parameters = m->size_of_parameters();
1387 klassOop holder = m->method_holder(); 1388 Klass* holder = m->method_holder();
1388 if (!(Klass::cast(holder))->is_interface()) { 1389 if (!(Klass::cast(holder))->is_interface()) {
1389 // non-interface call -- for that little speed boost, don't handlize 1390 // non-interface call -- for that little speed boost, don't handlize
1390 debug_only(No_Safepoint_Verifier nosafepoint;) 1391 debug_only(No_Safepoint_Verifier nosafepoint;)
1391 if (call_type == JNI_VIRTUAL) { 1392 if (call_type == JNI_VIRTUAL) {
1392 // jni_GetMethodID makes sure class is linked and initialized 1393 // jni_GetMethodID makes sure class is linked and initialized
1393 // so m should have a valid vtable index. 1394 // so m should have a valid vtable index.
1394 int vtbl_index = m->vtable_index(); 1395 int vtbl_index = m->vtable_index();
1395 if (vtbl_index != methodOopDesc::nonvirtual_vtable_index) { 1396 if (vtbl_index != Method::nonvirtual_vtable_index) {
1396 klassOop k = h_recv->klass(); 1397 Klass* k = h_recv->klass();
1397 // k might be an arrayKlassOop but all vtables start at 1398 // k might be an arrayKlassOop but all vtables start at
1398 // the same place. The cast is to avoid virtual call and assertion. 1399 // the same place. The cast is to avoid virtual call and assertion.
1399 instanceKlass *ik = (instanceKlass*)k->klass_part(); 1400 InstanceKlass *ik = (InstanceKlass*)k;
1400 selected_method = ik->method_at_vtable(vtbl_index); 1401 selected_method = ik->method_at_vtable(vtbl_index);
1401 } else { 1402 } else {
1402 // final method 1403 // final method
1403 selected_method = m; 1404 selected_method = m;
1404 } 1405 }
1414 if (itbl_index == -1) { 1415 if (itbl_index == -1) {
1415 itbl_index = klassItable::compute_itable_index(m); 1416 itbl_index = klassItable::compute_itable_index(m);
1416 m->set_cached_itable_index(itbl_index); 1417 m->set_cached_itable_index(itbl_index);
1417 // the above may have grabbed a lock, 'm' and anything non-handlized can't be used again 1418 // the above may have grabbed a lock, 'm' and anything non-handlized can't be used again
1418 } 1419 }
1419 klassOop k = h_recv->klass(); 1420 Klass* k = h_recv->klass();
1420 selected_method = instanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK); 1421 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
1421 } 1422 }
1422 } 1423 }
1423 1424
1424 methodHandle method(THREAD, selected_method); 1425 methodHandle method(THREAD, selected_method);
1425 1426
1447 } 1448 }
1448 } 1449 }
1449 1450
1450 1451
1451 static instanceOop alloc_object(jclass clazz, TRAPS) { 1452 static instanceOop alloc_object(jclass clazz, TRAPS) {
1452 KlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 1453 KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
1453 Klass::cast(k())->check_valid_for_instantiation(false, CHECK_NULL); 1454 Klass::cast(k())->check_valid_for_instantiation(false, CHECK_NULL);
1454 instanceKlass::cast(k())->initialize(CHECK_NULL); 1455 InstanceKlass::cast(k())->initialize(CHECK_NULL);
1455 instanceOop ih = instanceKlass::cast(k())->allocate_instance(THREAD); 1456 instanceOop ih = InstanceKlass::cast(k())->allocate_instance(THREAD);
1456 return ih; 1457 return ih;
1457 } 1458 }
1458 1459
1459 #ifndef USDT2 1460 #ifndef USDT2
1460 DT_RETURN_MARK_DECL(AllocObject, jobject); 1461 DT_RETURN_MARK_DECL(AllocObject, jobject);
1568 DTRACE_PROBE2(hotspot_jni, GetObjectClass__entry, env, obj); 1569 DTRACE_PROBE2(hotspot_jni, GetObjectClass__entry, env, obj);
1569 #else /* USDT2 */ 1570 #else /* USDT2 */
1570 HOTSPOT_JNI_GETOBJECTCLASS_ENTRY( 1571 HOTSPOT_JNI_GETOBJECTCLASS_ENTRY(
1571 env, obj); 1572 env, obj);
1572 #endif /* USDT2 */ 1573 #endif /* USDT2 */
1573 klassOop k = JNIHandles::resolve_non_null(obj)->klass(); 1574 Klass* k = JNIHandles::resolve_non_null(obj)->klass();
1574 jclass ret = 1575 jclass ret =
1575 (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror()); 1576 (jclass) JNIHandles::make_local(env, Klass::cast(k)->java_mirror());
1576 #ifndef USDT2 1577 #ifndef USDT2
1577 DTRACE_PROBE1(hotspot_jni, GetObjectClass__return, ret); 1578 DTRACE_PROBE1(hotspot_jni, GetObjectClass__return, ret);
1578 #else /* USDT2 */ 1579 #else /* USDT2 */
1591 env, obj, clazz); 1592 env, obj, clazz);
1592 #endif /* USDT2 */ 1593 #endif /* USDT2 */
1593 jboolean ret = JNI_TRUE; 1594 jboolean ret = JNI_TRUE;
1594 if (obj != NULL) { 1595 if (obj != NULL) {
1595 ret = JNI_FALSE; 1596 ret = JNI_FALSE;
1596 klassOop k = java_lang_Class::as_klassOop( 1597 Klass* k = java_lang_Class::as_Klass(
1597 JNIHandles::resolve_non_null(clazz)); 1598 JNIHandles::resolve_non_null(clazz));
1598 if (k != NULL) { 1599 if (k != NULL) {
1599 ret = JNIHandles::resolve_non_null(obj)->is_a(k) ? JNI_TRUE : JNI_FALSE; 1600 ret = JNIHandles::resolve_non_null(obj)->is_a(k) ? JNI_TRUE : JNI_FALSE;
1600 } 1601 }
1601 } 1602 }
1631 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(clazz))) { 1632 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(clazz))) {
1632 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); 1633 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str);
1633 } 1634 }
1634 1635
1635 KlassHandle klass(THREAD, 1636 KlassHandle klass(THREAD,
1636 java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 1637 java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
1637 1638
1638 // Make sure class is linked and initialized before handing id's out to 1639 // Make sure class is linked and initialized before handing id's out to
1639 // methodOops. 1640 // Method*s.
1640 Klass::cast(klass())->initialize(CHECK_NULL); 1641 Klass::cast(klass())->initialize(CHECK_NULL);
1641 1642
1642 methodOop m; 1643 Method* m;
1643 if (name == vmSymbols::object_initializer_name() || 1644 if (name == vmSymbols::object_initializer_name() ||
1644 name == vmSymbols::class_initializer_name()) { 1645 name == vmSymbols::class_initializer_name()) {
1645 // Never search superclasses for constructors 1646 // Never search superclasses for constructors
1646 if (klass->oop_is_instance()) { 1647 if (klass->oop_is_instance()) {
1647 m = instanceKlass::cast(klass())->find_method(name, signature); 1648 m = InstanceKlass::cast(klass())->find_method(name, signature);
1648 } else { 1649 } else {
1649 m = NULL; 1650 m = NULL;
1650 } 1651 }
1651 } else { 1652 } else {
1652 m = klass->lookup_method(name, signature); 1653 m = klass->lookup_method(name, signature);
1653 // Look up interfaces 1654 // Look up interfaces
1654 if (m == NULL && klass->oop_is_instance()) { 1655 if (m == NULL && klass->oop_is_instance()) {
1655 m = instanceKlass::cast(klass())->lookup_method_in_all_interfaces(name, 1656 m = InstanceKlass::cast(klass())->lookup_method_in_all_interfaces(name,
1656 signature); 1657 signature);
1657 } 1658 }
1658 } 1659 }
1659 if (m == NULL || (m->is_static() != is_static)) { 1660 if (m == NULL || (m->is_static() != is_static)) {
1660 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); 1661 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str);
2450 (const ResultType&)ret);\ 2451 (const ResultType&)ret);\
2451 \ 2452 \
2452 JavaValue jvalue(Tag); \ 2453 JavaValue jvalue(Tag); \
2453 JNI_ArgumentPusherVaArg ap(methodID, args); \ 2454 JNI_ArgumentPusherVaArg ap(methodID, args); \
2454 /* Make sure class is initialized before trying to invoke its method */ \ 2455 /* Make sure class is initialized before trying to invoke its method */ \
2455 KlassHandle k(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls))); \ 2456 KlassHandle k(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls))); \
2456 Klass::cast(k())->initialize(CHECK_0); \ 2457 Klass::cast(k())->initialize(CHECK_0); \
2457 jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \ 2458 jni_invoke_static(env, &jvalue, NULL, JNI_STATIC, methodID, &ap, CHECK_0); \
2458 va_end(args); \ 2459 va_end(args); \
2459 ret = jvalue.get_##ResultType(); \ 2460 ret = jvalue.get_##ResultType(); \
2460 return ret;\ 2461 return ret;\
2634 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig)); 2635 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig));
2635 if (fieldname == NULL || signame == NULL) { 2636 if (fieldname == NULL || signame == NULL) {
2636 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); 2637 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
2637 } 2638 }
2638 KlassHandle k(THREAD, 2639 KlassHandle k(THREAD,
2639 java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 2640 java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
2640 // Make sure class is initialized before handing id's out to fields 2641 // Make sure class is initialized before handing id's out to fields
2641 Klass::cast(k())->initialize(CHECK_NULL); 2642 Klass::cast(k())->initialize(CHECK_NULL);
2642 2643
2643 fieldDescriptor fd; 2644 fieldDescriptor fd;
2644 if (!Klass::cast(k())->oop_is_instance() || 2645 if (!Klass::cast(k())->oop_is_instance() ||
2645 !instanceKlass::cast(k())->find_field(fieldname, signame, false, &fd)) { 2646 !InstanceKlass::cast(k())->find_field(fieldname, signame, false, &fd)) {
2646 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); 2647 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
2647 } 2648 }
2648 2649
2649 // A jfieldID for a non-static field is simply the offset of the field within the instanceOop 2650 // A jfieldID for a non-static field is simply the offset of the field within the instanceOop
2650 // It may also have hash bits for k, if VerifyJNIFields is turned on. 2651 // It may also have hash bits for k, if VerifyJNIFields is turned on.
2660 #else /* USDT2 */ 2661 #else /* USDT2 */
2661 HOTSPOT_JNI_GETOBJECTFIELD_ENTRY( 2662 HOTSPOT_JNI_GETOBJECTFIELD_ENTRY(
2662 env, obj, (uintptr_t) fieldID); 2663 env, obj, (uintptr_t) fieldID);
2663 #endif /* USDT2 */ 2664 #endif /* USDT2 */
2664 oop o = JNIHandles::resolve_non_null(obj); 2665 oop o = JNIHandles::resolve_non_null(obj);
2665 klassOop k = o->klass(); 2666 Klass* k = o->klass();
2666 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); 2667 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID);
2667 // Keep JVMTI addition small and only check enabled flag here. 2668 // Keep JVMTI addition small and only check enabled flag here.
2668 // jni_GetField_probe() assumes that is okay to create handles. 2669 // jni_GetField_probe() assumes that is okay to create handles.
2669 if (JvmtiExport::should_post_field_access()) { 2670 if (JvmtiExport::should_post_field_access()) {
2670 o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false); 2671 o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false);
2677 if (UseG1GC) { 2678 if (UseG1GC) {
2678 bool needs_barrier = false; 2679 bool needs_barrier = false;
2679 2680
2680 if (ret != NULL && 2681 if (ret != NULL &&
2681 offset == java_lang_ref_Reference::referent_offset && 2682 offset == java_lang_ref_Reference::referent_offset &&
2682 instanceKlass::cast(k)->reference_type() != REF_NONE) { 2683 InstanceKlass::cast(k)->reference_type() != REF_NONE) {
2683 assert(instanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity"); 2684 assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
2684 needs_barrier = true; 2685 needs_barrier = true;
2685 } 2686 }
2686 2687
2687 if (needs_barrier) { 2688 if (needs_barrier) {
2688 oop referent = JNIHandles::resolve(ret); 2689 oop referent = JNIHandles::resolve(ret);
2711 DTRACE_PROBE3(hotspot_jni, Get##Result##Field__entry, env, obj, fieldID);\ 2712 DTRACE_PROBE3(hotspot_jni, Get##Result##Field__entry, env, obj, fieldID);\
2712 Return ret = 0;\ 2713 Return ret = 0;\
2713 DT_RETURN_MARK_FOR(Result, Get##Result##Field, Return, (const Return&)ret);\ 2714 DT_RETURN_MARK_FOR(Result, Get##Result##Field, Return, (const Return&)ret);\
2714 \ 2715 \
2715 oop o = JNIHandles::resolve_non_null(obj); \ 2716 oop o = JNIHandles::resolve_non_null(obj); \
2716 klassOop k = o->klass(); \ 2717 Klass* k = o->klass(); \
2717 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \ 2718 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \
2718 /* Keep JVMTI addition small and only check enabled flag here. */ \ 2719 /* Keep JVMTI addition small and only check enabled flag here. */ \
2719 /* jni_GetField_probe_nh() assumes that is not okay to create handles */ \ 2720 /* jni_GetField_probe_nh() assumes that is not okay to create handles */ \
2720 /* and creates a ResetNoHandleMark. */ \ 2721 /* and creates a ResetNoHandleMark. */ \
2721 if (JvmtiExport::should_post_field_access()) { \ 2722 if (JvmtiExport::should_post_field_access()) { \
2748 EntryProbe; \ 2749 EntryProbe; \
2749 Return ret = 0;\ 2750 Return ret = 0;\
2750 DT_RETURN_MARK_FOR(Result, Get##Result##Field, Return, (const Return&)ret);\ 2751 DT_RETURN_MARK_FOR(Result, Get##Result##Field, Return, (const Return&)ret);\
2751 \ 2752 \
2752 oop o = JNIHandles::resolve_non_null(obj); \ 2753 oop o = JNIHandles::resolve_non_null(obj); \
2753 klassOop k = o->klass(); \ 2754 Klass* k = o->klass(); \
2754 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \ 2755 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \
2755 /* Keep JVMTI addition small and only check enabled flag here. */ \ 2756 /* Keep JVMTI addition small and only check enabled flag here. */ \
2756 /* jni_GetField_probe_nh() assumes that is not okay to create handles */ \ 2757 /* jni_GetField_probe_nh() assumes that is not okay to create handles */ \
2757 /* and creates a ResetNoHandleMark. */ \ 2758 /* and creates a ResetNoHandleMark. */ \
2758 if (JvmtiExport::should_post_field_access()) { \ 2759 if (JvmtiExport::should_post_field_access()) { \
2821 #else /* USDT2 */ 2822 #else /* USDT2 */
2822 HOTSPOT_JNI_SETOBJECTFIELD_ENTRY( 2823 HOTSPOT_JNI_SETOBJECTFIELD_ENTRY(
2823 env, obj, (uintptr_t) fieldID, value); 2824 env, obj, (uintptr_t) fieldID, value);
2824 #endif /* USDT2 */ 2825 #endif /* USDT2 */
2825 oop o = JNIHandles::resolve_non_null(obj); 2826 oop o = JNIHandles::resolve_non_null(obj);
2826 klassOop k = o->klass(); 2827 Klass* k = o->klass();
2827 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); 2828 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID);
2828 // Keep JVMTI addition small and only check enabled flag here. 2829 // Keep JVMTI addition small and only check enabled flag here.
2829 // jni_SetField_probe_nh() assumes that is not okay to create handles 2830 // jni_SetField_probe_nh() assumes that is not okay to create handles
2830 // and creates a ResetNoHandleMark. 2831 // and creates a ResetNoHandleMark.
2831 if (JvmtiExport::should_post_field_modification()) { 2832 if (JvmtiExport::should_post_field_modification()) {
2846 #define DEFINE_SETFIELD(Argument,Fieldname,Result,SigType,unionType) \ 2847 #define DEFINE_SETFIELD(Argument,Fieldname,Result,SigType,unionType) \
2847 \ 2848 \
2848 JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \ 2849 JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \
2849 JNIWrapper("Set" XSTR(Result) "Field"); \ 2850 JNIWrapper("Set" XSTR(Result) "Field"); \
2850 \ 2851 \
2851 HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \ 2852 FP_SELECT_##Result( \
2852 ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ 2853 DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value), \
2853 HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \ 2854 DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \
2854 ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \
2855 \ 2855 \
2856 oop o = JNIHandles::resolve_non_null(obj); \ 2856 oop o = JNIHandles::resolve_non_null(obj); \
2857 klassOop k = o->klass(); \ 2857 Klass* k = o->klass(); \
2858 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \ 2858 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \
2859 /* Keep JVMTI addition small and only check enabled flag here. */ \ 2859 /* Keep JVMTI addition small and only check enabled flag here. */ \
2860 /* jni_SetField_probe_nh() assumes that is not okay to create handles */ \ 2860 /* jni_SetField_probe_nh() assumes that is not okay to create handles */ \
2861 /* and creates a ResetNoHandleMark. */ \ 2861 /* and creates a ResetNoHandleMark. */ \
2862 if (JvmtiExport::should_post_field_modification()) { \ 2862 if (JvmtiExport::should_post_field_modification()) { \
2886 JNIWrapper("Set" XSTR(Result) "Field"); \ 2886 JNIWrapper("Set" XSTR(Result) "Field"); \
2887 \ 2887 \
2888 EntryProbe; \ 2888 EntryProbe; \
2889 \ 2889 \
2890 oop o = JNIHandles::resolve_non_null(obj); \ 2890 oop o = JNIHandles::resolve_non_null(obj); \
2891 klassOop k = o->klass(); \ 2891 Klass* k = o->klass(); \
2892 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \ 2892 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \
2893 /* Keep JVMTI addition small and only check enabled flag here. */ \ 2893 /* Keep JVMTI addition small and only check enabled flag here. */ \
2894 /* jni_SetField_probe_nh() assumes that is not okay to create handles */ \ 2894 /* jni_SetField_probe_nh() assumes that is not okay to create handles */ \
2895 /* and creates a ResetNoHandleMark. */ \ 2895 /* and creates a ResetNoHandleMark. */ \
2896 if (JvmtiExport::should_post_field_modification()) { \ 2896 if (JvmtiExport::should_post_field_modification()) { \
2948 jobject ret = NULL; 2948 jobject ret = NULL;
2949 DT_RETURN_MARK(ToReflectedField, jobject, (const jobject&)ret); 2949 DT_RETURN_MARK(ToReflectedField, jobject, (const jobject&)ret);
2950 2950
2951 fieldDescriptor fd; 2951 fieldDescriptor fd;
2952 bool found = false; 2952 bool found = false;
2953 klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(cls)); 2953 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
2954 2954
2955 assert(jfieldIDWorkaround::is_static_jfieldID(fieldID) == (isStatic != 0), "invalid fieldID"); 2955 assert(jfieldIDWorkaround::is_static_jfieldID(fieldID) == (isStatic != 0), "invalid fieldID");
2956 2956
2957 if (isStatic) { 2957 if (isStatic) {
2958 // Static field. The fieldID a JNIid specifying the field holder and the offset within the klassOop. 2958 // Static field. The fieldID a JNIid specifying the field holder and the offset within the Klass*.
2959 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); 2959 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID);
2960 assert(id->is_static_field_id(), "invalid static field id"); 2960 assert(id->is_static_field_id(), "invalid static field id");
2961 found = id->find_local_field(&fd); 2961 found = id->find_local_field(&fd);
2962 } else { 2962 } else {
2963 // Non-static field. The fieldID is really the offset of the field within the instanceOop. 2963 // Non-static field. The fieldID is really the offset of the field within the instanceOop.
2964 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); 2964 int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID);
2965 found = instanceKlass::cast(k)->find_field_from_offset(offset, false, &fd); 2965 found = InstanceKlass::cast(k)->find_field_from_offset(offset, false, &fd);
2966 } 2966 }
2967 assert(found, "bad fieldID passed into jni_ToReflectedField"); 2967 assert(found, "bad fieldID passed into jni_ToReflectedField");
2968 oop reflected = Reflection::new_field(&fd, UseNewReflection, CHECK_NULL); 2968 oop reflected = Reflection::new_field(&fd, UseNewReflection, CHECK_NULL);
2969 ret = JNIHandles::make_local(env, reflected); 2969 ret = JNIHandles::make_local(env, reflected);
2970 return ret; 2970 return ret;
3000 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig)); 3000 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig));
3001 if (fieldname == NULL || signame == NULL) { 3001 if (fieldname == NULL || signame == NULL) {
3002 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); 3002 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
3003 } 3003 }
3004 KlassHandle k(THREAD, 3004 KlassHandle k(THREAD,
3005 java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 3005 java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
3006 // Make sure class is initialized before handing id's out to static fields 3006 // Make sure class is initialized before handing id's out to static fields
3007 Klass::cast(k())->initialize(CHECK_NULL); 3007 Klass::cast(k())->initialize(CHECK_NULL);
3008 3008
3009 fieldDescriptor fd; 3009 fieldDescriptor fd;
3010 if (!Klass::cast(k())->oop_is_instance() || 3010 if (!Klass::cast(k())->oop_is_instance() ||
3011 !instanceKlass::cast(k())->find_field(fieldname, signame, true, &fd)) { 3011 !InstanceKlass::cast(k())->find_field(fieldname, signame, true, &fd)) {
3012 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); 3012 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name);
3013 } 3013 }
3014 3014
3015 // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the klassOop 3015 // A jfieldID for a static field is a JNIid specifying the field holder and the offset within the Klass*
3016 JNIid* id = instanceKlass::cast(fd.field_holder())->jni_id_for(fd.offset()); 3016 JNIid* id = fd.field_holder()->jni_id_for(fd.offset());
3017 debug_only(id->set_is_static_field_id();) 3017 debug_only(id->set_is_static_field_id();)
3018 3018
3019 debug_only(id->verify(fd.field_holder())); 3019 debug_only(id->verify(fd.field_holder()));
3020 3020
3021 ret = jfieldIDWorkaround::to_static_jfieldID(id); 3021 ret = jfieldIDWorkaround::to_static_jfieldID(id);
3029 DTRACE_PROBE3(hotspot_jni, GetStaticObjectField__entry, env, clazz, fieldID); 3029 DTRACE_PROBE3(hotspot_jni, GetStaticObjectField__entry, env, clazz, fieldID);
3030 #else /* USDT2 */ 3030 #else /* USDT2 */
3031 HOTSPOT_JNI_GETSTATICOBJECTFIELD_ENTRY( 3031 HOTSPOT_JNI_GETSTATICOBJECTFIELD_ENTRY(
3032 env, clazz, (uintptr_t) fieldID); 3032 env, clazz, (uintptr_t) fieldID);
3033 #endif /* USDT2 */ 3033 #endif /* USDT2 */
3034 #ifndef JNICHECK_KERNEL 3034 #if INCLUDE_JNI_CHECK
3035 DEBUG_ONLY(klassOop param_k = jniCheck::validate_class(thread, clazz);) 3035 DEBUG_ONLY(Klass* param_k = jniCheck::validate_class(thread, clazz);)
3036 #endif // JNICHECK_KERNEL 3036 #endif // INCLUDE_JNI_CHECK
3037 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); 3037 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID);
3038 assert(id->is_static_field_id(), "invalid static field id"); 3038 assert(id->is_static_field_id(), "invalid static field id");
3039 // Keep JVMTI addition small and only check enabled flag here. 3039 // Keep JVMTI addition small and only check enabled flag here.
3040 // jni_GetField_probe() assumes that is okay to create handles. 3040 // jni_GetField_probe() assumes that is okay to create handles.
3041 if (JvmtiExport::should_post_field_access()) { 3041 if (JvmtiExport::should_post_field_access()) {
3156 #ifndef USDT2 3156 #ifndef USDT2
3157 #define DEFINE_SETSTATICFIELD(Argument,Fieldname,Result,SigType,unionType) \ 3157 #define DEFINE_SETSTATICFIELD(Argument,Fieldname,Result,SigType,unionType) \
3158 \ 3158 \
3159 JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \ 3159 JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \
3160 JNIWrapper("SetStatic" XSTR(Result) "Field"); \ 3160 JNIWrapper("SetStatic" XSTR(Result) "Field"); \
3161 HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\ 3161 FP_SELECT_##Result( \
3162 ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \ 3162 DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value), \
3163 HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \ 3163 DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \
3164 ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \
3165 \ 3164 \
3166 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \ 3165 JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \
3167 assert(id->is_static_field_id(), "invalid static field id"); \ 3166 assert(id->is_static_field_id(), "invalid static field id"); \
3168 /* Keep JVMTI addition small and only check enabled flag here. */ \ 3167 /* Keep JVMTI addition small and only check enabled flag here. */ \
3169 /* jni_SetField_probe() assumes that is okay to create handles. */ \ 3168 /* jni_SetField_probe() assumes that is okay to create handles. */ \
3465 HOTSPOT_JNI_NEWOBJECTARRAY_ENTRY( 3464 HOTSPOT_JNI_NEWOBJECTARRAY_ENTRY(
3466 env, length, elementClass, initialElement); 3465 env, length, elementClass, initialElement);
3467 #endif /* USDT2 */ 3466 #endif /* USDT2 */
3468 jobjectArray ret = NULL; 3467 jobjectArray ret = NULL;
3469 DT_RETURN_MARK(NewObjectArray, jobjectArray, (const jobjectArray&)ret); 3468 DT_RETURN_MARK(NewObjectArray, jobjectArray, (const jobjectArray&)ret);
3470 KlassHandle ek(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(elementClass))); 3469 KlassHandle ek(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(elementClass)));
3471 klassOop ako = Klass::cast(ek())->array_klass(CHECK_NULL); 3470 Klass* ako = Klass::cast(ek())->array_klass(CHECK_NULL);
3472 KlassHandle ak = KlassHandle(THREAD, ako); 3471 KlassHandle ak = KlassHandle(THREAD, ako);
3473 objArrayKlass::cast(ak())->initialize(CHECK_NULL); 3472 ObjArrayKlass::cast(ak())->initialize(CHECK_NULL);
3474 objArrayOop result = objArrayKlass::cast(ak())->allocate(length, CHECK_NULL); 3473 objArrayOop result = ObjArrayKlass::cast(ak())->allocate(length, CHECK_NULL);
3475 oop initial_value = JNIHandles::resolve(initialElement); 3474 oop initial_value = JNIHandles::resolve(initialElement);
3476 if (initial_value != NULL) { // array already initialized with NULL 3475 if (initial_value != NULL) { // array already initialized with NULL
3477 for (int index = 0; index < length; index++) { 3476 for (int index = 0; index < length; index++) {
3478 result->obj_at_put(index, initial_value); 3477 result->obj_at_put(index, initial_value);
3479 } 3478 }
3528 DT_VOID_RETURN_MARK(SetObjectArrayElement); 3527 DT_VOID_RETURN_MARK(SetObjectArrayElement);
3529 3528
3530 objArrayOop a = objArrayOop(JNIHandles::resolve_non_null(array)); 3529 objArrayOop a = objArrayOop(JNIHandles::resolve_non_null(array));
3531 oop v = JNIHandles::resolve(value); 3530 oop v = JNIHandles::resolve(value);
3532 if (a->is_within_bounds(index)) { 3531 if (a->is_within_bounds(index)) {
3533 if (v == NULL || v->is_a(objArrayKlass::cast(a->klass())->element_klass())) { 3532 if (v == NULL || v->is_a(ObjArrayKlass::cast(a->klass())->element_klass())) {
3534 a->obj_at_put(index, v); 3533 a->obj_at_put(index, v);
3535 } else { 3534 } else {
3536 THROW(vmSymbols::java_lang_ArrayStoreException()); 3535 THROW(vmSymbols::java_lang_ArrayStoreException());
3537 } 3536 }
3538 } else { 3537 } else {
3813 typeArrayOop src = typeArrayOop(JNIHandles::resolve_non_null(array)); \ 3812 typeArrayOop src = typeArrayOop(JNIHandles::resolve_non_null(array)); \
3814 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)src->length())) { \ 3813 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)src->length())) { \
3815 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \ 3814 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
3816 } else { \ 3815 } else { \
3817 if (len > 0) { \ 3816 if (len > 0) { \
3818 int sc = typeArrayKlass::cast(src->klass())->log2_element_size(); \ 3817 int sc = TypeArrayKlass::cast(src->klass())->log2_element_size(); \
3819 memcpy((u_char*) buf, \ 3818 memcpy((u_char*) buf, \
3820 (u_char*) src->Tag##_at_addr(start), \ 3819 (u_char*) src->Tag##_at_addr(start), \
3821 len << sc); \ 3820 len << sc); \
3822 } \ 3821 } \
3823 } \ 3822 } \
3848 typeArrayOop src = typeArrayOop(JNIHandles::resolve_non_null(array)); \ 3847 typeArrayOop src = typeArrayOop(JNIHandles::resolve_non_null(array)); \
3849 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)src->length())) { \ 3848 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)src->length())) { \
3850 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \ 3849 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
3851 } else { \ 3850 } else { \
3852 if (len > 0) { \ 3851 if (len > 0) { \
3853 int sc = typeArrayKlass::cast(src->klass())->log2_element_size(); \ 3852 int sc = TypeArrayKlass::cast(src->klass())->log2_element_size(); \
3854 memcpy((u_char*) buf, \ 3853 memcpy((u_char*) buf, \
3855 (u_char*) src->Tag##_at_addr(start), \ 3854 (u_char*) src->Tag##_at_addr(start), \
3856 len << sc); \ 3855 len << sc); \
3857 } \ 3856 } \
3858 } \ 3857 } \
3897 typeArrayOop dst = typeArrayOop(JNIHandles::resolve_non_null(array)); \ 3896 typeArrayOop dst = typeArrayOop(JNIHandles::resolve_non_null(array)); \
3898 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)dst->length())) { \ 3897 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)dst->length())) { \
3899 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \ 3898 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
3900 } else { \ 3899 } else { \
3901 if (len > 0) { \ 3900 if (len > 0) { \
3902 int sc = typeArrayKlass::cast(dst->klass())->log2_element_size(); \ 3901 int sc = TypeArrayKlass::cast(dst->klass())->log2_element_size(); \
3903 memcpy((u_char*) dst->Tag##_at_addr(start), \ 3902 memcpy((u_char*) dst->Tag##_at_addr(start), \
3904 (u_char*) buf, \ 3903 (u_char*) buf, \
3905 len << sc); \ 3904 len << sc); \
3906 } \ 3905 } \
3907 } \ 3906 } \
3932 typeArrayOop dst = typeArrayOop(JNIHandles::resolve_non_null(array)); \ 3931 typeArrayOop dst = typeArrayOop(JNIHandles::resolve_non_null(array)); \
3933 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)dst->length())) { \ 3932 if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)dst->length())) { \
3934 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \ 3933 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
3935 } else { \ 3934 } else { \
3936 if (len > 0) { \ 3935 if (len > 0) { \
3937 int sc = typeArrayKlass::cast(dst->klass())->log2_element_size(); \ 3936 int sc = TypeArrayKlass::cast(dst->klass())->log2_element_size(); \
3938 memcpy((u_char*) dst->Tag##_at_addr(start), \ 3937 memcpy((u_char*) dst->Tag##_at_addr(start), \
3939 (u_char*) buf, \ 3938 (u_char*) buf, \
3940 len << sc); \ 3939 len << sc); \
3941 } \ 3940 } \
3942 } \ 3941 } \
3975 3974
3976 // The RegisterNatives call being attempted tried to register with a method that 3975 // The RegisterNatives call being attempted tried to register with a method that
3977 // is not native. Ask JVM TI what prefixes have been specified. Then check 3976 // is not native. Ask JVM TI what prefixes have been specified. Then check
3978 // to see if the native method is now wrapped with the prefixes. See the 3977 // to see if the native method is now wrapped with the prefixes. See the
3979 // SetNativeMethodPrefix(es) functions in the JVM TI Spec for details. 3978 // SetNativeMethodPrefix(es) functions in the JVM TI Spec for details.
3980 static methodOop find_prefixed_native(KlassHandle k, 3979 static Method* find_prefixed_native(KlassHandle k,
3981 Symbol* name, Symbol* signature, TRAPS) { 3980 Symbol* name, Symbol* signature, TRAPS) {
3981 #if INCLUDE_JVMTI
3982 ResourceMark rm(THREAD); 3982 ResourceMark rm(THREAD);
3983 methodOop method; 3983 Method* method;
3984 int name_len = name->utf8_length(); 3984 int name_len = name->utf8_length();
3985 char* name_str = name->as_utf8(); 3985 char* name_str = name->as_utf8();
3986 int prefix_count; 3986 int prefix_count;
3987 char** prefixes = JvmtiExport::get_all_native_method_prefixes(&prefix_count); 3987 char** prefixes = JvmtiExport::get_all_native_method_prefixes(&prefix_count);
3988 for (int i = 0; i < prefix_count; i++) { 3988 for (int i = 0; i < prefix_count; i++) {
4008 } 4008 }
4009 // found as non-native, so prefix is good, add it, probably just need more prefixes 4009 // found as non-native, so prefix is good, add it, probably just need more prefixes
4010 name_len = trial_len; 4010 name_len = trial_len;
4011 name_str = trial_name_str; 4011 name_str = trial_name_str;
4012 } 4012 }
4013 #endif // INCLUDE_JVMTI
4013 return NULL; // not found 4014 return NULL; // not found
4014 } 4015 }
4015 4016
4016 static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) { 4017 static bool register_native(KlassHandle k, Symbol* name, Symbol* signature, address entry, TRAPS) {
4017 methodOop method = Klass::cast(k())->lookup_method(name, signature); 4018 Method* method = Klass::cast(k())->lookup_method(name, signature);
4018 if (method == NULL) { 4019 if (method == NULL) {
4019 ResourceMark rm; 4020 ResourceMark rm;
4020 stringStream st; 4021 stringStream st;
4021 st.print("Method %s name or signature does not match", 4022 st.print("Method %s name or signature does not match",
4022 methodOopDesc::name_and_sig_as_C_string(Klass::cast(k()), name, signature)); 4023 Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
4023 THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false); 4024 THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
4024 } 4025 }
4025 if (!method->is_native()) { 4026 if (!method->is_native()) {
4026 // trying to register to a non-native method, see if a JVM TI agent has added prefix(es) 4027 // trying to register to a non-native method, see if a JVM TI agent has added prefix(es)
4027 method = find_prefixed_native(k, name, signature, THREAD); 4028 method = find_prefixed_native(k, name, signature, THREAD);
4028 if (method == NULL) { 4029 if (method == NULL) {
4029 ResourceMark rm; 4030 ResourceMark rm;
4030 stringStream st; 4031 stringStream st;
4031 st.print("Method %s is not declared as native", 4032 st.print("Method %s is not declared as native",
4032 methodOopDesc::name_and_sig_as_C_string(Klass::cast(k()), name, signature)); 4033 Method::name_and_sig_as_C_string(Klass::cast(k()), name, signature));
4033 THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false); 4034 THROW_MSG_(vmSymbols::java_lang_NoSuchMethodError(), st.as_string(), false);
4034 } 4035 }
4035 } 4036 }
4036 4037
4037 if (entry != NULL) { 4038 if (entry != NULL) {
4038 method->set_native_function(entry, 4039 method->set_native_function(entry,
4039 methodOopDesc::native_bind_event_is_interesting); 4040 Method::native_bind_event_is_interesting);
4040 } else { 4041 } else {
4041 method->clear_native_function(); 4042 method->clear_native_function();
4042 } 4043 }
4043 if (PrintJNIResolving) { 4044 if (PrintJNIResolving) {
4044 ResourceMark rm(THREAD); 4045 ResourceMark rm(THREAD);
4045 tty->print_cr("[Registering JNI native method %s.%s]", 4046 tty->print_cr("[Registering JNI native method %s.%s]",
4046 Klass::cast(method->method_holder())->external_name(), 4047 method->method_holder()->external_name(),
4047 method->name()->as_C_string()); 4048 method->name()->as_C_string());
4048 } 4049 }
4049 return true; 4050 return true;
4050 } 4051 }
4051 4052
4067 env, clazz, (void *) methods, nMethods); 4068 env, clazz, (void *) methods, nMethods);
4068 #endif /* USDT2 */ 4069 #endif /* USDT2 */
4069 jint ret = 0; 4070 jint ret = 0;
4070 DT_RETURN_MARK(RegisterNatives, jint, (const jint&)ret); 4071 DT_RETURN_MARK(RegisterNatives, jint, (const jint&)ret);
4071 4072
4072 KlassHandle h_k(thread, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz))); 4073 KlassHandle h_k(thread, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
4073 4074
4074 for (int index = 0; index < nMethods; index++) { 4075 for (int index = 0; index < nMethods; index++) {
4075 const char* meth_name = methods[index].name; 4076 const char* meth_name = methods[index].name;
4076 const char* meth_sig = methods[index].signature; 4077 const char* meth_sig = methods[index].signature;
4077 int meth_name_len = (int)strlen(meth_name); 4078 int meth_name_len = (int)strlen(meth_name);
4107 DTRACE_PROBE2(hotspot_jni, UnregisterNatives__entry, env, clazz); 4108 DTRACE_PROBE2(hotspot_jni, UnregisterNatives__entry, env, clazz);
4108 #else /* USDT2 */ 4109 #else /* USDT2 */
4109 HOTSPOT_JNI_UNREGISTERNATIVES_ENTRY( 4110 HOTSPOT_JNI_UNREGISTERNATIVES_ENTRY(
4110 env, clazz); 4111 env, clazz);
4111 #endif /* USDT2 */ 4112 #endif /* USDT2 */
4112 klassOop k = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz)); 4113 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
4113 //%note jni_2 4114 //%note jni_2
4114 if (Klass::cast(k)->oop_is_instance()) { 4115 if (Klass::cast(k)->oop_is_instance()) {
4115 for (int index = 0; index < instanceKlass::cast(k)->methods()->length(); index++) { 4116 for (int index = 0; index < InstanceKlass::cast(k)->methods()->length(); index++) {
4116 methodOop m = methodOop(instanceKlass::cast(k)->methods()->obj_at(index)); 4117 Method* m = InstanceKlass::cast(k)->methods()->at(index);
4117 if (m->is_native()) { 4118 if (m->is_native()) {
4118 m->clear_native_function(); 4119 m->clear_native_function();
4119 m->set_signature_handler(NULL); 4120 m->set_signature_handler(NULL);
4120 } 4121 }
4121 } 4122 }
4277 assert(a->is_array(), "just checking"); 4278 assert(a->is_array(), "just checking");
4278 BasicType type; 4279 BasicType type;
4279 if (a->is_objArray()) { 4280 if (a->is_objArray()) {
4280 type = T_OBJECT; 4281 type = T_OBJECT;
4281 } else { 4282 } else {
4282 type = typeArrayKlass::cast(a->klass())->element_type(); 4283 type = TypeArrayKlass::cast(a->klass())->element_type();
4283 } 4284 }
4284 void* ret = arrayOop(a)->base(type); 4285 void* ret = arrayOop(a)->base(type);
4285 #ifndef USDT2 4286 #ifndef USDT2
4286 DTRACE_PROBE1(hotspot_jni, GetPrimitiveArrayCritical__return, ret); 4287 DTRACE_PROBE1(hotspot_jni, GetPrimitiveArrayCritical__return, ret);
4287 #else /* USDT2 */ 4288 #else /* USDT2 */
4438 4439
4439 TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL); 4440 TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL);
4440 jclass result = find_class_from_class_loader(env, sym, true, loader, protection_domain, true, CHECK_NULL); 4441 jclass result = find_class_from_class_loader(env, sym, true, loader, protection_domain, true, CHECK_NULL);
4441 4442
4442 if (TraceClassResolution && result != NULL) { 4443 if (TraceClassResolution && result != NULL) {
4443 trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); 4444 trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
4444 } 4445 }
4445 return result; 4446 return result;
4446 } 4447 }
4447 4448
4448 // These lookups are done with the NULL (bootstrap) ClassLoader to 4449 // These lookups are done with the NULL (bootstrap) ClassLoader to
5001 } 5002 }
5002 } 5003 }
5003 5004
5004 // Returns the function structure 5005 // Returns the function structure
5005 struct JNINativeInterface_* jni_functions() { 5006 struct JNINativeInterface_* jni_functions() {
5006 #ifndef JNICHECK_KERNEL 5007 #if INCLUDE_JNI_CHECK
5007 if (CheckJNICalls) return jni_functions_check(); 5008 if (CheckJNICalls) return jni_functions_check();
5008 #else // JNICHECK_KERNEL 5009 #endif // INCLUDE_JNI_CHECK
5009 if (CheckJNICalls) warning("-Xcheck:jni is not supported in kernel vm.");
5010 #endif // JNICHECK_KERNEL
5011 return &jni_NativeInterface; 5010 return &jni_NativeInterface;
5012 } 5011 }
5013 5012
5014 // Returns the function structure 5013 // Returns the function structure
5015 struct JNINativeInterface_* jni_functions_nocheck() { 5014 struct JNINativeInterface_* jni_functions_nocheck() {