Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/method.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | 359f7e70ae7f bd3237e0e18d |
children | de839ec35cc7 |
comparison
equal
deleted
inserted
replaced
12782:92b7ec34ddfa | 13086:096c224171c4 |
---|---|
509 return _access_flags.has_loops(); | 509 return _access_flags.has_loops(); |
510 } | 510 } |
511 | 511 |
512 bool Method::is_final_method(AccessFlags class_access_flags) const { | 512 bool Method::is_final_method(AccessFlags class_access_flags) const { |
513 // or "does_not_require_vtable_entry" | 513 // or "does_not_require_vtable_entry" |
514 // overpass can occur, is not final (reuses vtable entry) | 514 // default method or overpass can occur, is not final (reuses vtable entry) |
515 // private methods get vtable entries for backward class compatibility. | 515 // private methods get vtable entries for backward class compatibility. |
516 if (is_overpass()) return false; | 516 if (is_overpass() || is_default_method()) return false; |
517 return is_final() || class_access_flags.is_final(); | 517 return is_final() || class_access_flags.is_final(); |
518 } | 518 } |
519 | 519 |
520 bool Method::is_final_method() const { | 520 bool Method::is_final_method() const { |
521 return is_final_method(method_holder()->access_flags()); | 521 return is_final_method(method_holder()->access_flags()); |
522 } | |
523 | |
524 bool Method::is_default_method() const { | |
525 if (method_holder() != NULL && | |
526 method_holder()->is_interface() && | |
527 !is_abstract()) { | |
528 return true; | |
529 } else { | |
530 return false; | |
531 } | |
522 } | 532 } |
523 | 533 |
524 bool Method::can_be_statically_bound(AccessFlags class_access_flags) const { | 534 bool Method::can_be_statically_bound(AccessFlags class_access_flags) const { |
525 if (is_final_method(class_access_flags)) return true; | 535 if (is_final_method(class_access_flags)) return true; |
526 #ifdef ASSERT | 536 #ifdef ASSERT |
537 ResourceMark rm; | |
527 bool is_nonv = (vtable_index() == nonvirtual_vtable_index); | 538 bool is_nonv = (vtable_index() == nonvirtual_vtable_index); |
528 if (class_access_flags.is_interface()) assert(is_nonv == is_static(), err_msg("is_nonv=%s", is_nonv)); | 539 if (class_access_flags.is_interface()) { |
540 assert(is_nonv == is_static(), err_msg("is_nonv=%s", name_and_sig_as_C_string())); | |
541 } | |
529 #endif | 542 #endif |
530 assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question"); | 543 assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question"); |
531 return vtable_index() == nonvirtual_vtable_index; | 544 return vtable_index() == nonvirtual_vtable_index; |
532 } | 545 } |
533 | 546 |
1380 static int method_comparator(Method* a, Method* b) { | 1393 static int method_comparator(Method* a, Method* b) { |
1381 return a->name()->fast_compare(b->name()); | 1394 return a->name()->fast_compare(b->name()); |
1382 } | 1395 } |
1383 | 1396 |
1384 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array | 1397 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array |
1385 void Method::sort_methods(Array<Method*>* methods, bool idempotent) { | 1398 // default_methods also uses this without the ordering for fast find_method |
1399 void Method::sort_methods(Array<Method*>* methods, bool idempotent, bool set_idnums) { | |
1386 int length = methods->length(); | 1400 int length = methods->length(); |
1387 if (length > 1) { | 1401 if (length > 1) { |
1388 { | 1402 { |
1389 No_Safepoint_Verifier nsv; | 1403 No_Safepoint_Verifier nsv; |
1390 QuickSort::sort<Method*>(methods->data(), length, method_comparator, idempotent); | 1404 QuickSort::sort<Method*>(methods->data(), length, method_comparator, idempotent); |
1391 } | 1405 } |
1392 // Reset method ordering | 1406 // Reset method ordering |
1393 for (int i = 0; i < length; i++) { | 1407 if (set_idnums) { |
1394 Method* m = methods->at(i); | 1408 for (int i = 0; i < length; i++) { |
1395 m->set_method_idnum(i); | 1409 Method* m = methods->at(i); |
1396 } | 1410 m->set_method_idnum(i); |
1397 } | 1411 } |
1398 } | 1412 } |
1399 | 1413 } |
1414 } | |
1400 | 1415 |
1401 //----------------------------------------------------------------------------------- | 1416 //----------------------------------------------------------------------------------- |
1402 // Non-product code unless JVM/TI needs it | 1417 // Non-product code unless JVM/TI needs it |
1403 | 1418 |
1404 #if !defined(PRODUCT) || INCLUDE_JVMTI | 1419 #if !defined(PRODUCT) || INCLUDE_JVMTI |
1509 for (; bp != NULL; bp = bp->next()) { | 1524 for (; bp != NULL; bp = bp->next()) { |
1510 if (bp->match(this, bci)) { | 1525 if (bp->match(this, bci)) { |
1511 return bp->orig_bytecode(); | 1526 return bp->orig_bytecode(); |
1512 } | 1527 } |
1513 } | 1528 } |
1514 ShouldNotReachHere(); | 1529 { |
1530 ResourceMark rm; | |
1531 fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci)); | |
1532 } | |
1515 return Bytecodes::_shouldnotreachhere; | 1533 return Bytecodes::_shouldnotreachhere; |
1516 } | 1534 } |
1517 | 1535 |
1518 void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) { | 1536 void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) { |
1519 assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way"); | 1537 assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way"); |