comparison src/share/vm/oops/method.cpp @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents 3cce976666d9 510fbd28919c
children 359f7e70ae7f
comparison
equal deleted inserted replaced
12058:ccb4f2af2319 12355:cefad50507d8
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;
718 xtty->stamp(); 725 xtty->stamp();
719 xtty->end_elem(); 726 xtty->end_elem();
720 } 727 }
721 } 728 }
722 729
730 bool Method::is_always_compilable() const {
731 // Generated adapters must be compiled
732 if (is_method_handle_intrinsic()) {
733 bool is_executeCompiled = intrinsic_id() == vmIntrinsics::_CompilerToVMImpl_executeCompiledMethod);
734 if (is_synthetic() || is_executeCompiled) {
735 assert(!is_not_c1_compilable() || is_executeCompiled, "sanity check");
736 assert(!is_not_c2_compilable() || is_executeCompiled, "sanity check");
737 return true;
738 }
739 }
740
741 return false;
742 }
743
723 bool Method::is_not_compilable(int comp_level) const { 744 bool Method::is_not_compilable(int comp_level) const {
724 if (number_of_breakpoints() > 0) 745 if (number_of_breakpoints() > 0)
725 return true; 746 return true;
726 if (is_method_handle_intrinsic()) 747 if (is_always_compilable())
727 return !is_synthetic() && intrinsic_id() != vmIntrinsics::_CompilerToVMImpl_executeCompiledMethod; // the generated adapters must be compiled 748 return false;
728 if (comp_level == CompLevel_any) 749 if (comp_level == CompLevel_any)
729 return is_not_c1_compilable() || is_not_c2_compilable(); 750 return is_not_c1_compilable() || is_not_c2_compilable();
730 if (is_c1_compile(comp_level)) 751 if (is_c1_compile(comp_level))
731 return is_not_c1_compilable(); 752 return is_not_c1_compilable();
732 if (is_c2_compile(comp_level)) 753 if (is_c2_compile(comp_level))
734 return false; 755 return false;
735 } 756 }
736 757
737 // call this when compiler finds that this method is not compilable 758 // call this when compiler finds that this method is not compilable
738 void Method::set_not_compilable(int comp_level, bool report, const char* reason) { 759 void Method::set_not_compilable(int comp_level, bool report, const char* reason) {
760 if (is_always_compilable()) {
761 // Don't mark a method which should be always compilable
762 return;
763 }
739 print_made_not_compilable(comp_level, /*is_osr*/ false, report, reason); 764 print_made_not_compilable(comp_level, /*is_osr*/ false, report, reason);
740 if (comp_level == CompLevel_all) { 765 if (comp_level == CompLevel_all) {
741 set_not_c1_compilable(); 766 set_not_c1_compilable();
742 set_not_c2_compilable(); 767 set_not_c2_compilable();
743 } else { 768 } else {
745 set_not_c1_compilable(); 770 set_not_c1_compilable();
746 if (is_c2_compile(comp_level)) 771 if (is_c2_compile(comp_level))
747 set_not_c2_compilable(); 772 set_not_c2_compilable();
748 } 773 }
749 CompilationPolicy::policy()->disable_compilation(this); 774 CompilationPolicy::policy()->disable_compilation(this);
775 assert(!CompilationPolicy::can_be_compiled(this, comp_level), "sanity check");
750 } 776 }
751 777
752 bool Method::is_not_osr_compilable(int comp_level) const { 778 bool Method::is_not_osr_compilable(int comp_level) const {
753 if (is_not_compilable(comp_level)) 779 if (is_not_compilable(comp_level))
754 return true; 780 return true;
771 set_not_c1_osr_compilable(); 797 set_not_c1_osr_compilable();
772 if (is_c2_compile(comp_level)) 798 if (is_c2_compile(comp_level))
773 set_not_c2_osr_compilable(); 799 set_not_c2_osr_compilable();
774 } 800 }
775 CompilationPolicy::policy()->disable_compilation(this); 801 CompilationPolicy::policy()->disable_compilation(this);
802 assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check");
776 } 803 }
777 804
778 // Revert to using the interpreter and clear out the nmethod 805 // Revert to using the interpreter and clear out the nmethod
779 void Method::clear_code() { 806 void Method::clear_code() {
780 807
883 // This function is called after potential safepoints so that nmethod 910 // This function is called after potential safepoints so that nmethod
884 // or adapter that it points to is still live and valid. 911 // or adapter that it points to is still live and valid.
885 // This function must not hit a safepoint! 912 // This function must not hit a safepoint!
886 address Method::verified_code_entry() { 913 address Method::verified_code_entry() {
887 debug_only(No_Safepoint_Verifier nsv;) 914 debug_only(No_Safepoint_Verifier nsv;)
888 nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code);
889 if (code == NULL && UseCodeCacheFlushing) {
890 nmethod *saved_code = CodeCache::reanimate_saved_code(this);
891 if (saved_code != NULL) {
892 methodHandle method(this);
893 assert( ! saved_code->is_osr_method(), "should not get here for osr" );
894 set_code( method, saved_code );
895 }
896 }
897
898 assert(_from_compiled_entry != NULL, "must be set"); 915 assert(_from_compiled_entry != NULL, "must be set");
899 return _from_compiled_entry; 916 return _from_compiled_entry;
900 } 917 }
901 918
902 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all 919 // Check that if an nmethod ref exists, it has a backlink to this or no backlink at all
956 return true; 973 return true;
957 } 974 }
958 975
959 assert(ik->is_subclass_of(method_holder()), "should be subklass"); 976 assert(ik->is_subclass_of(method_holder()), "should be subklass");
960 assert(ik->vtable() != NULL, "vtable should exist"); 977 assert(ik->vtable() != NULL, "vtable should exist");
961 if (vtable_index() == nonvirtual_vtable_index) { 978 if (!has_vtable_index()) {
962 return false; 979 return false;
963 } else { 980 } else {
964 Method* vt_m = ik->method_at_vtable(vtable_index()); 981 Method* vt_m = ik->method_at_vtable(vtable_index());
965 return vt_m != this; 982 return vt_m != this;
966 } 983 }
1948 1965
1949 #endif //PRODUCT 1966 #endif //PRODUCT
1950 1967
1951 void Method::print_value_on(outputStream* st) const { 1968 void Method::print_value_on(outputStream* st) const {
1952 assert(is_method(), "must be method"); 1969 assert(is_method(), "must be method");
1953 st->print_cr(internal_name()); 1970 st->print(internal_name());
1954 print_address_on(st); 1971 print_address_on(st);
1955 st->print(" "); 1972 st->print(" ");
1956 name()->print_value_on(st); 1973 name()->print_value_on(st);
1957 st->print(" "); 1974 st->print(" ");
1958 signature()->print_value_on(st); 1975 signature()->print_value_on(st);
1959 st->print(" in "); 1976 st->print(" in ");
1960 method_holder()->print_value_on(st); 1977 method_holder()->print_value_on(st);
1978 if (WizardMode) st->print("#%d", _vtable_index);
1961 if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals()); 1979 if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals());
1962 if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code()); 1980 if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code());
1963 } 1981 }
1964 1982
1965 #if INCLUDE_SERVICES 1983 #if INCLUDE_SERVICES