Mercurial > hg > truffle
comparison src/share/vm/oops/method.cpp @ 12264:b2e698d2276c
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
Summary: Enhance method resolution and resulting data structures, plus some refactoring.
Reviewed-by: twisti, acorn, jrose
author | drchase |
---|---|
date | Fri, 13 Sep 2013 22:38:02 -0400 |
parents | 8947af8a9cec |
children | 510fbd28919c |
comparison
equal
deleted
inserted
replaced
12261:2c98370f2611 | 12264:b2e698d2276c |
---|---|
507 } | 507 } |
508 _access_flags.set_loops_flag_init(); | 508 _access_flags.set_loops_flag_init(); |
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 { | |
513 // or "does_not_require_vtable_entry" | |
514 // overpass can occur, is not final (reuses vtable entry) | |
515 // private methods get vtable entries for backward class compatibility. | |
516 if (is_overpass()) return false; | |
517 return is_final() || class_access_flags.is_final(); | |
518 } | |
512 | 519 |
513 bool Method::is_final_method() const { | 520 bool Method::is_final_method() const { |
514 // %%% Should return true for private methods also, | 521 return is_final_method(method_holder()->access_flags()); |
515 // since there is no way to override them. | 522 } |
516 return is_final() || method_holder()->is_final(); | 523 |
517 } | 524 bool Method::can_be_statically_bound(AccessFlags class_access_flags) const { |
518 | 525 if (is_final_method(class_access_flags)) return true; |
519 | 526 #ifdef ASSERT |
520 bool Method::is_strict_method() const { | 527 bool is_nonv = (vtable_index() == nonvirtual_vtable_index); |
521 return is_strict(); | 528 if (class_access_flags.is_interface()) assert(is_nonv == is_static(), err_msg("is_nonv=%s", is_nonv)); |
522 } | 529 #endif |
523 | 530 assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question"); |
531 return vtable_index() == nonvirtual_vtable_index; | |
532 } | |
524 | 533 |
525 bool Method::can_be_statically_bound() const { | 534 bool Method::can_be_statically_bound() const { |
526 if (is_final_method()) return true; | 535 return can_be_statically_bound(method_holder()->access_flags()); |
527 return vtable_index() == nonvirtual_vtable_index; | 536 } |
528 } | |
529 | |
530 | 537 |
531 bool Method::is_accessor() const { | 538 bool Method::is_accessor() const { |
532 if (code_size() != 5) return false; | 539 if (code_size() != 5) return false; |
533 if (size_of_parameters() != 1) return false; | 540 if (size_of_parameters() != 1) return false; |
534 if (java_code_at(0) != Bytecodes::_aload_0 ) return false; | 541 if (java_code_at(0) != Bytecodes::_aload_0 ) return false; |
965 return true; | 972 return true; |
966 } | 973 } |
967 | 974 |
968 assert(ik->is_subclass_of(method_holder()), "should be subklass"); | 975 assert(ik->is_subclass_of(method_holder()), "should be subklass"); |
969 assert(ik->vtable() != NULL, "vtable should exist"); | 976 assert(ik->vtable() != NULL, "vtable should exist"); |
970 if (vtable_index() == nonvirtual_vtable_index) { | 977 if (!has_vtable_index()) { |
971 return false; | 978 return false; |
972 } else { | 979 } else { |
973 Method* vt_m = ik->method_at_vtable(vtable_index()); | 980 Method* vt_m = ik->method_at_vtable(vtable_index()); |
974 return vt_m != this; | 981 return vt_m != this; |
975 } | 982 } |
1957 | 1964 |
1958 #endif //PRODUCT | 1965 #endif //PRODUCT |
1959 | 1966 |
1960 void Method::print_value_on(outputStream* st) const { | 1967 void Method::print_value_on(outputStream* st) const { |
1961 assert(is_method(), "must be method"); | 1968 assert(is_method(), "must be method"); |
1962 st->print_cr(internal_name()); | 1969 st->print(internal_name()); |
1963 print_address_on(st); | 1970 print_address_on(st); |
1964 st->print(" "); | 1971 st->print(" "); |
1965 name()->print_value_on(st); | 1972 name()->print_value_on(st); |
1966 st->print(" "); | 1973 st->print(" "); |
1967 signature()->print_value_on(st); | 1974 signature()->print_value_on(st); |
1968 st->print(" in "); | 1975 st->print(" in "); |
1969 method_holder()->print_value_on(st); | 1976 method_holder()->print_value_on(st); |
1977 if (WizardMode) st->print("#%d", _vtable_index); | |
1970 if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals()); | 1978 if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals()); |
1971 if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code()); | 1979 if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code()); |
1972 } | 1980 } |
1973 | 1981 |
1974 #if INCLUDE_SERVICES | 1982 #if INCLUDE_SERVICES |