< prev index next >

src/share/vm/prims/jni.cpp

Print this page
rev 8430 : 8081674: EmptyStackException at startup if running on unsupported locale


 390   Handle protection_domain;
 391   // Find calling class
 392   instanceKlassHandle k (THREAD, thread->security_get_caller_class(0));
 393   if (k.not_null()) {
 394     loader = Handle(THREAD, k->class_loader());
 395     // Special handling to make sure JNI_OnLoad and JNI_OnUnload are executed
 396     // in the correct class context.
 397     if (loader.is_null() &&
 398         k->name() == vmSymbols::java_lang_ClassLoader_NativeLibrary()) {
 399       JavaValue result(T_OBJECT);
 400       JavaCalls::call_static(&result, k,
 401                                       vmSymbols::getFromClass_name(),
 402                                       vmSymbols::void_class_signature(),
 403                                       thread);
 404       if (HAS_PENDING_EXCEPTION) {
 405         Handle ex(thread, thread->pending_exception());
 406         CLEAR_PENDING_EXCEPTION;
 407         THROW_HANDLE_0(ex);
 408       }
 409       oop mirror = (oop) result.get_jobject();



 410       loader = Handle(THREAD,
 411         InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->class_loader());
 412       protection_domain = Handle(THREAD,
 413         InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->protection_domain());

 414     }
 415   } else {
 416     // We call ClassLoader.getSystemClassLoader to obtain the system class loader.
 417     loader = Handle(THREAD, SystemDictionary::java_system_loader());
 418   }
 419 
 420   TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL);
 421   result = find_class_from_class_loader(env, sym, true, loader,
 422                                         protection_domain, true, thread);
 423 
 424   if (TraceClassResolution && result != NULL) {
 425     trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
 426   }
 427 
 428   // If we were the first invocation of jni_FindClass, we enable compilation again
 429   // rather than just allowing invocation counter to overflow and decay.
 430   // Controlled by flag DelayCompilationDuringStartup.
 431   if (first_time && !CompileTheWorld)
 432     CompilationPolicy::completed_vm_startup();
 433 




 390   Handle protection_domain;
 391   // Find calling class
 392   instanceKlassHandle k (THREAD, thread->security_get_caller_class(0));
 393   if (k.not_null()) {
 394     loader = Handle(THREAD, k->class_loader());
 395     // Special handling to make sure JNI_OnLoad and JNI_OnUnload are executed
 396     // in the correct class context.
 397     if (loader.is_null() &&
 398         k->name() == vmSymbols::java_lang_ClassLoader_NativeLibrary()) {
 399       JavaValue result(T_OBJECT);
 400       JavaCalls::call_static(&result, k,
 401                                       vmSymbols::getFromClass_name(),
 402                                       vmSymbols::void_class_signature(),
 403                                       thread);
 404       if (HAS_PENDING_EXCEPTION) {
 405         Handle ex(thread, thread->pending_exception());
 406         CLEAR_PENDING_EXCEPTION;
 407         THROW_HANDLE_0(ex);
 408       }
 409       oop mirror = (oop) result.get_jobject();
 410       if (oopDesc::is_null(mirror)) {
 411         loader = Handle(THREAD, SystemDictionary::java_system_loader());
 412       } else {
 413         loader = Handle(THREAD,
 414           InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->class_loader());
 415         protection_domain = Handle(THREAD,
 416           InstanceKlass::cast(java_lang_Class::as_Klass(mirror))->protection_domain());
 417       }
 418     }
 419   } else {
 420     // We call ClassLoader.getSystemClassLoader to obtain the system class loader.
 421     loader = Handle(THREAD, SystemDictionary::java_system_loader());
 422   }
 423 
 424   TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL);
 425   result = find_class_from_class_loader(env, sym, true, loader,
 426                                         protection_domain, true, thread);
 427 
 428   if (TraceClassResolution && result != NULL) {
 429     trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
 430   }
 431 
 432   // If we were the first invocation of jni_FindClass, we enable compilation again
 433   // rather than just allowing invocation counter to overflow and decay.
 434   // Controlled by flag DelayCompilationDuringStartup.
 435   if (first_time && !CompileTheWorld)
 436     CompilationPolicy::completed_vm_startup();
 437 


< prev index next >