hotspot/src/share/vm/prims/jni.cpp
changeset 4571 80b553bddc26
parent 4561 4dfa5956fbb9
child 5041 5bce37d77dde
equal deleted inserted replaced
4569:f372ea9e5ed4 4571:80b553bddc26
   394   // method is a handle to a java.lang.reflect.Method object
   394   // method is a handle to a java.lang.reflect.Method object
   395   oop reflected  = JNIHandles::resolve_non_null(method);
   395   oop reflected  = JNIHandles::resolve_non_null(method);
   396   oop mirror     = NULL;
   396   oop mirror     = NULL;
   397   int slot       = 0;
   397   int slot       = 0;
   398 
   398 
   399   if (reflected->klass() == SystemDictionary::reflect_constructor_klass()) {
   399   if (reflected->klass() == SystemDictionary::reflect_Constructor_klass()) {
   400     mirror = java_lang_reflect_Constructor::clazz(reflected);
   400     mirror = java_lang_reflect_Constructor::clazz(reflected);
   401     slot   = java_lang_reflect_Constructor::slot(reflected);
   401     slot   = java_lang_reflect_Constructor::slot(reflected);
   402   } else {
   402   } else {
   403     assert(reflected->klass() == SystemDictionary::reflect_method_klass(), "wrong type");
   403     assert(reflected->klass() == SystemDictionary::reflect_Method_klass(), "wrong type");
   404     mirror = java_lang_reflect_Method::clazz(reflected);
   404     mirror = java_lang_reflect_Method::clazz(reflected);
   405     slot   = java_lang_reflect_Method::slot(reflected);
   405     slot   = java_lang_reflect_Method::slot(reflected);
   406   }
   406   }
   407   klassOop k     = java_lang_Class::as_klassOop(mirror);
   407   klassOop k     = java_lang_Class::as_klassOop(mirror);
   408 
   408 
   494 
   494 
   495   // return mirror for superclass
   495   // return mirror for superclass
   496   klassOop super = Klass::cast(k)->java_super();
   496   klassOop super = Klass::cast(k)->java_super();
   497   // super2 is the value computed by the compiler's getSuperClass intrinsic:
   497   // super2 is the value computed by the compiler's getSuperClass intrinsic:
   498   debug_only(klassOop super2 = ( Klass::cast(k)->oop_is_javaArray()
   498   debug_only(klassOop super2 = ( Klass::cast(k)->oop_is_javaArray()
   499                                  ? SystemDictionary::object_klass()
   499                                  ? SystemDictionary::Object_klass()
   500                                  : Klass::cast(k)->super() ) );
   500                                  : Klass::cast(k)->super() ) );
   501   assert(super == super2,
   501   assert(super == super2,
   502          "java_super computation depends on interface, array, other super");
   502          "java_super computation depends on interface, array, other super");
   503   obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror());
   503   obj = (super == NULL) ? NULL : (jclass) JNIHandles::make_local(Klass::cast(super)->java_mirror());
   504   return obj;
   504   return obj;
   582   JNIWrapper("ExceptionDescribe");
   582   JNIWrapper("ExceptionDescribe");
   583   DTRACE_PROBE1(hotspot_jni, ExceptionDescribe__entry, env);
   583   DTRACE_PROBE1(hotspot_jni, ExceptionDescribe__entry, env);
   584   if (thread->has_pending_exception()) {
   584   if (thread->has_pending_exception()) {
   585     Handle ex(thread, thread->pending_exception());
   585     Handle ex(thread, thread->pending_exception());
   586     thread->clear_pending_exception();
   586     thread->clear_pending_exception();
   587     if (ex->is_a(SystemDictionary::threaddeath_klass())) {
   587     if (ex->is_a(SystemDictionary::ThreadDeath_klass())) {
   588       // Don't print anything if we are being killed.
   588       // Don't print anything if we are being killed.
   589     } else {
   589     } else {
   590       jio_fprintf(defaultStream::error_stream(), "Exception ");
   590       jio_fprintf(defaultStream::error_stream(), "Exception ");
   591       if (thread != NULL && thread->threadObj() != NULL) {
   591       if (thread != NULL && thread->threadObj() != NULL) {
   592         ResourceMark rm(THREAD);
   592         ResourceMark rm(THREAD);
   593         jio_fprintf(defaultStream::error_stream(),
   593         jio_fprintf(defaultStream::error_stream(),
   594         "in thread \"%s\" ", thread->get_thread_name());
   594         "in thread \"%s\" ", thread->get_thread_name());
   595       }
   595       }
   596       if (ex->is_a(SystemDictionary::throwable_klass())) {
   596       if (ex->is_a(SystemDictionary::Throwable_klass())) {
   597         JavaValue result(T_VOID);
   597         JavaValue result(T_VOID);
   598         JavaCalls::call_virtual(&result,
   598         JavaCalls::call_virtual(&result,
   599                                 ex,
   599                                 ex,
   600                                 KlassHandle(THREAD,
   600                                 KlassHandle(THREAD,
   601                                   SystemDictionary::throwable_klass()),
   601                                   SystemDictionary::Throwable_klass()),
   602                                 vmSymbolHandles::printStackTrace_name(),
   602                                 vmSymbolHandles::printStackTrace_name(),
   603                                 vmSymbolHandles::void_method_signature(),
   603                                 vmSymbolHandles::void_method_signature(),
   604                                 THREAD);
   604                                 THREAD);
   605         // If an exception is thrown in the call it gets thrown away. Not much
   605         // If an exception is thrown in the call it gets thrown away. Not much
   606         // we can do with it. The native code that calls this, does not check
   606         // we can do with it. The native code that calls this, does not check