1334 // non-interface call -- for that little speed boost, don't handlize |
1334 // non-interface call -- for that little speed boost, don't handlize |
1335 debug_only(No_Safepoint_Verifier nosafepoint;) |
1335 debug_only(No_Safepoint_Verifier nosafepoint;) |
1336 if (call_type == JNI_VIRTUAL) { |
1336 if (call_type == JNI_VIRTUAL) { |
1337 // jni_GetMethodID makes sure class is linked and initialized |
1337 // jni_GetMethodID makes sure class is linked and initialized |
1338 // so m should have a valid vtable index. |
1338 // so m should have a valid vtable index. |
|
1339 assert(!m->has_itable_index(), ""); |
1339 int vtbl_index = m->vtable_index(); |
1340 int vtbl_index = m->vtable_index(); |
1340 if (vtbl_index != Method::nonvirtual_vtable_index) { |
1341 if (vtbl_index != Method::nonvirtual_vtable_index) { |
1341 Klass* k = h_recv->klass(); |
1342 Klass* k = h_recv->klass(); |
1342 // k might be an arrayKlassOop but all vtables start at |
1343 // k might be an arrayKlassOop but all vtables start at |
1343 // the same place. The cast is to avoid virtual call and assertion. |
1344 // the same place. The cast is to avoid virtual call and assertion. |
1353 } |
1354 } |
1354 } else { |
1355 } else { |
1355 // interface call |
1356 // interface call |
1356 KlassHandle h_holder(THREAD, holder); |
1357 KlassHandle h_holder(THREAD, holder); |
1357 |
1358 |
1358 int itbl_index = m->cached_itable_index(); |
1359 int itbl_index = m->itable_index(); |
1359 if (itbl_index == -1) { |
|
1360 itbl_index = klassItable::compute_itable_index(m); |
|
1361 m->set_cached_itable_index(itbl_index); |
|
1362 // the above may have grabbed a lock, 'm' and anything non-handlized can't be used again |
|
1363 } |
|
1364 Klass* k = h_recv->klass(); |
1360 Klass* k = h_recv->klass(); |
1365 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK); |
1361 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK); |
1366 } |
1362 } |
1367 } |
1363 } |
1368 |
1364 |