< prev index next >

src/hotspot/share/oops/method.cpp

Print this page




 568       case Bytecodes::_if_acmpeq:
 569       case Bytecodes::_if_acmpne:
 570       case Bytecodes::_goto:
 571       case Bytecodes::_jsr:
 572         if( bcs.dest() < bcs.next_bci() ) _access_flags.set_has_loops();
 573         break;
 574 
 575       case Bytecodes::_goto_w:
 576       case Bytecodes::_jsr_w:
 577         if( bcs.dest_w() < bcs.next_bci() ) _access_flags.set_has_loops();
 578         break;
 579 
 580       default:
 581         break;
 582     }
 583   }
 584   _access_flags.set_loops_flag_init();
 585   return _access_flags.has_loops();
 586 }
 587 
 588 bool Method::is_final_method(AccessFlags class_access_flags) const {
 589   // or "does_not_require_vtable_entry"
 590   // default method or overpass can occur, is not final (reuses vtable entry)
 591   // private methods in classes get vtable entries for backward class compatibility.
 592   if (is_overpass() || is_default_method())  return false;
 593   return is_final() || class_access_flags.is_final();
 594 }
 595 
 596 bool Method::is_final_method() const {
 597   return is_final_method(method_holder()->access_flags());
 598 }
 599 
 600 bool Method::is_default_method() const {
 601   if (method_holder() != NULL &&
 602       method_holder()->is_interface() &&
 603       !is_abstract() && !is_private()) {
 604     return true;
 605   } else {
 606     return false;
 607   }
 608 }
 609 
 610 bool Method::can_be_statically_bound(AccessFlags class_access_flags) const {
 611   if (is_final_method(class_access_flags))  return true;
 612 #ifdef ASSERT
 613   ResourceMark rm;
 614   bool is_nonv = (vtable_index() == nonvirtual_vtable_index);
 615   if (class_access_flags.is_interface()) {
 616       assert(is_nonv == is_static() || is_nonv == is_private(),
 617              "nonvirtual unexpected for non-static, non-private: %s",
 618              name_and_sig_as_C_string());
 619   }
 620 #endif
 621   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 622   return vtable_index() == nonvirtual_vtable_index;
 623 }
 624 
 625 bool Method::can_be_statically_bound() const {
 626   return can_be_statically_bound(method_holder()->access_flags());
 627 }
 628 
 629 bool Method::can_be_statically_bound(InstanceKlass* context) const {
 630   return (method_holder() == context) && can_be_statically_bound();
 631 }




 568       case Bytecodes::_if_acmpeq:
 569       case Bytecodes::_if_acmpne:
 570       case Bytecodes::_goto:
 571       case Bytecodes::_jsr:
 572         if( bcs.dest() < bcs.next_bci() ) _access_flags.set_has_loops();
 573         break;
 574 
 575       case Bytecodes::_goto_w:
 576       case Bytecodes::_jsr_w:
 577         if( bcs.dest_w() < bcs.next_bci() ) _access_flags.set_has_loops();
 578         break;
 579 
 580       default:
 581         break;
 582     }
 583   }
 584   _access_flags.set_loops_flag_init();
 585   return _access_flags.has_loops();
 586 }
 587 
 588 bool Method::is_final_method(AccessFlags class_access_flags, bool has_sealed_holder) const {
 589   // or "does_not_require_vtable_entry"
 590   // default method or overpass can occur, is not final (reuses vtable entry)
 591   // private methods in classes get vtable entries for backward class compatibility.
 592   if (is_overpass() || is_default_method())  return false;
 593   return is_final() || (class_access_flags.is_final() && !has_sealed_holder);
 594 }
 595 
 596 bool Method::is_final_method() const {
 597   return is_final_method(method_holder()->access_flags(), method_holder()->is_sealed());
 598 }
 599 
 600 bool Method::is_default_method() const {
 601   if (method_holder() != NULL &&
 602       method_holder()->is_interface() &&
 603       !is_abstract() && !is_private()) {
 604     return true;
 605   } else {
 606     return false;
 607   }
 608 }
 609 
 610 bool Method::can_be_statically_bound(AccessFlags class_access_flags) const {
 611   if (is_final_method(class_access_flags, method_holder()->is_sealed()))  return true;
 612 #ifdef ASSERT
 613   ResourceMark rm;
 614   bool is_nonv = (vtable_index() == nonvirtual_vtable_index);
 615   if (class_access_flags.is_interface()) {
 616       assert(is_nonv == is_static() || is_nonv == is_private(),
 617              "nonvirtual unexpected for non-static, non-private: %s",
 618              name_and_sig_as_C_string());
 619   }
 620 #endif
 621   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 622   return vtable_index() == nonvirtual_vtable_index;
 623 }
 624 
 625 bool Method::can_be_statically_bound() const {
 626   return can_be_statically_bound(method_holder()->access_flags());
 627 }
 628 
 629 bool Method::can_be_statically_bound(InstanceKlass* context) const {
 630   return (method_holder() == context) && can_be_statically_bound();
 631 }


< prev index next >