Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jni.cpp @ 23286:dd9cc155639c
Merge with jdk8u66-b17
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Thu, 07 Jan 2016 17:28:46 +0100 |
parents | 939d5da65929 3300e511bc3a |
children | 6ee2af864395 |
comparison
equal
deleted
inserted
replaced
22786:ac649db7fec4 | 23286:dd9cc155639c |
---|---|
1327 Method* selected_method; | 1327 Method* selected_method; |
1328 { | 1328 { |
1329 Method* m = Method::resolve_jmethod_id(method_id); | 1329 Method* m = Method::resolve_jmethod_id(method_id); |
1330 number_of_parameters = m->size_of_parameters(); | 1330 number_of_parameters = m->size_of_parameters(); |
1331 Klass* holder = m->method_holder(); | 1331 Klass* holder = m->method_holder(); |
1332 if (!(holder)->is_interface()) { | 1332 if (call_type != JNI_VIRTUAL) { |
1333 selected_method = m; | |
1334 } else if (!m->has_itable_index()) { | |
1333 // non-interface call -- for that little speed boost, don't handlize | 1335 // non-interface call -- for that little speed boost, don't handlize |
1334 debug_only(No_Safepoint_Verifier nosafepoint;) | 1336 debug_only(No_Safepoint_Verifier nosafepoint;) |
1335 if (call_type == JNI_VIRTUAL) { | 1337 // jni_GetMethodID makes sure class is linked and initialized |
1336 // jni_GetMethodID makes sure class is linked and initialized | 1338 // so m should have a valid vtable index. |
1337 // so m should have a valid vtable index. | 1339 assert(m->valid_vtable_index(), "no valid vtable index"); |
1338 assert(!m->has_itable_index(), ""); | 1340 int vtbl_index = m->vtable_index(); |
1339 int vtbl_index = m->vtable_index(); | 1341 if (vtbl_index != Method::nonvirtual_vtable_index) { |
1340 if (vtbl_index != Method::nonvirtual_vtable_index) { | 1342 Klass* k = h_recv->klass(); |
1341 Klass* k = h_recv->klass(); | 1343 // k might be an arrayKlassOop but all vtables start at |
1342 // k might be an arrayKlassOop but all vtables start at | 1344 // the same place. The cast is to avoid virtual call and assertion. |
1343 // the same place. The cast is to avoid virtual call and assertion. | 1345 InstanceKlass *ik = (InstanceKlass*)k; |
1344 InstanceKlass *ik = (InstanceKlass*)k; | 1346 selected_method = ik->method_at_vtable(vtbl_index); |
1345 selected_method = ik->method_at_vtable(vtbl_index); | |
1346 } else { | |
1347 // final method | |
1348 selected_method = m; | |
1349 } | |
1350 } else { | 1347 } else { |
1351 // JNI_NONVIRTUAL call | 1348 // final method |
1352 selected_method = m; | 1349 selected_method = m; |
1353 } | 1350 } |
1354 } else { | 1351 } else { |
1355 // interface call | 1352 // interface call |
1356 KlassHandle h_holder(THREAD, holder); | 1353 KlassHandle h_holder(THREAD, holder); |
1357 | 1354 |
1358 if (call_type == JNI_VIRTUAL) { | 1355 int itbl_index = m->itable_index(); |
1359 int itbl_index = m->itable_index(); | 1356 Klass* k = h_recv->klass(); |
1360 Klass* k = h_recv->klass(); | 1357 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); | |
1362 } else { | |
1363 selected_method = m; | |
1364 } | |
1365 } | 1358 } |
1366 } | 1359 } |
1367 | 1360 |
1368 methodHandle method(THREAD, selected_method); | 1361 methodHandle method(THREAD, selected_method); |
1369 | 1362 |
5073 #define run_unit_test(unit_test_function_call) \ | 5066 #define run_unit_test(unit_test_function_call) \ |
5074 tty->print_cr("Running test: " #unit_test_function_call); \ | 5067 tty->print_cr("Running test: " #unit_test_function_call); \ |
5075 unit_test_function_call | 5068 unit_test_function_call |
5076 | 5069 |
5077 // Forward declaration | 5070 // Forward declaration |
5071 void TestOS_test(); | |
5078 void TestReservedSpace_test(); | 5072 void TestReservedSpace_test(); |
5079 void TestReserveMemorySpecial_test(); | 5073 void TestReserveMemorySpecial_test(); |
5080 void TestVirtualSpace_test(); | 5074 void TestVirtualSpace_test(); |
5081 void TestMetaspaceAux_test(); | 5075 void TestMetaspaceAux_test(); |
5082 void TestMetachunk_test(); | 5076 void TestMetachunk_test(); |
5094 #endif | 5088 #endif |
5095 | 5089 |
5096 void execute_internal_vm_tests() { | 5090 void execute_internal_vm_tests() { |
5097 if (ExecuteInternalVMTests) { | 5091 if (ExecuteInternalVMTests) { |
5098 tty->print_cr("Running internal VM tests"); | 5092 tty->print_cr("Running internal VM tests"); |
5093 run_unit_test(TestOS_test()); | |
5099 run_unit_test(TestReservedSpace_test()); | 5094 run_unit_test(TestReservedSpace_test()); |
5100 run_unit_test(TestReserveMemorySpecial_test()); | 5095 run_unit_test(TestReserveMemorySpecial_test()); |
5101 run_unit_test(TestVirtualSpace_test()); | 5096 run_unit_test(TestVirtualSpace_test()); |
5102 run_unit_test(TestMetaspaceAux_test()); | 5097 run_unit_test(TestMetaspaceAux_test()); |
5103 run_unit_test(TestMetachunk_test()); | 5098 run_unit_test(TestMetachunk_test()); |