src/share/vm/prims/jni.cpp

changeset 7866
3300e511bc3a
parent 7778
c2ce24504334
child 7994
04ff2f6cd0eb
child 8189
c60b9a314312
child 8368
32b682649973
     1.1 --- a/src/share/vm/prims/jni.cpp	Thu May 07 15:05:46 2015 +0200
     1.2 +++ b/src/share/vm/prims/jni.cpp	Tue Jun 02 10:41:18 2015 +0200
     1.3 @@ -1325,39 +1325,32 @@
     1.4      Method* m = Method::resolve_jmethod_id(method_id);
     1.5      number_of_parameters = m->size_of_parameters();
     1.6      Klass* holder = m->method_holder();
     1.7 -    if (!(holder)->is_interface()) {
     1.8 +    if (call_type != JNI_VIRTUAL) {
     1.9 +        selected_method = m;
    1.10 +    } else if (!m->has_itable_index()) {
    1.11        // non-interface call -- for that little speed boost, don't handlize
    1.12        debug_only(No_Safepoint_Verifier nosafepoint;)
    1.13 -      if (call_type == JNI_VIRTUAL) {
    1.14 -        // jni_GetMethodID makes sure class is linked and initialized
    1.15 -        // so m should have a valid vtable index.
    1.16 -        assert(!m->has_itable_index(), "");
    1.17 -        int vtbl_index = m->vtable_index();
    1.18 -        if (vtbl_index != Method::nonvirtual_vtable_index) {
    1.19 -          Klass* k = h_recv->klass();
    1.20 -          // k might be an arrayKlassOop but all vtables start at
    1.21 -          // the same place. The cast is to avoid virtual call and assertion.
    1.22 -          InstanceKlass *ik = (InstanceKlass*)k;
    1.23 -          selected_method = ik->method_at_vtable(vtbl_index);
    1.24 -        } else {
    1.25 -          // final method
    1.26 -          selected_method = m;
    1.27 -        }
    1.28 +      // jni_GetMethodID makes sure class is linked and initialized
    1.29 +      // so m should have a valid vtable index.
    1.30 +      assert(m->valid_vtable_index(), "no valid vtable index");
    1.31 +      int vtbl_index = m->vtable_index();
    1.32 +      if (vtbl_index != Method::nonvirtual_vtable_index) {
    1.33 +        Klass* k = h_recv->klass();
    1.34 +        // k might be an arrayKlassOop but all vtables start at
    1.35 +        // the same place. The cast is to avoid virtual call and assertion.
    1.36 +        InstanceKlass *ik = (InstanceKlass*)k;
    1.37 +        selected_method = ik->method_at_vtable(vtbl_index);
    1.38        } else {
    1.39 -        // JNI_NONVIRTUAL call
    1.40 +        // final method
    1.41          selected_method = m;
    1.42        }
    1.43      } else {
    1.44        // interface call
    1.45        KlassHandle h_holder(THREAD, holder);
    1.46  
    1.47 -      if (call_type == JNI_VIRTUAL) {
    1.48 -        int itbl_index = m->itable_index();
    1.49 -        Klass* k = h_recv->klass();
    1.50 -        selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
    1.51 -      } else {
    1.52 -        selected_method = m;
    1.53 -      }
    1.54 +      int itbl_index = m->itable_index();
    1.55 +      Klass* k = h_recv->klass();
    1.56 +      selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
    1.57      }
    1.58    }
    1.59  

mercurial