src/share/vm/oops/method.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/oops

src/share/vm/oops/method.cpp

Print this page




 548   }
 549 #endif
 550   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 551   return vtable_index() == nonvirtual_vtable_index;
 552 }
 553 
 554 bool Method::can_be_statically_bound() const {
 555   return can_be_statically_bound(method_holder()->access_flags());
 556 }
 557 
 558 bool Method::is_accessor() const {
 559   if (code_size() != 5) return false;
 560   if (size_of_parameters() != 1) return false;
 561   if (java_code_at(0) != Bytecodes::_aload_0 ) return false;
 562   if (java_code_at(1) != Bytecodes::_getfield) return false;
 563   if (java_code_at(4) != Bytecodes::_areturn &&
 564       java_code_at(4) != Bytecodes::_ireturn ) return false;
 565   return true;
 566 }
 567 









 568 
 569 bool Method::is_initializer() const {
 570   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
 571 }
 572 
 573 bool Method::has_valid_initializer_flags() const {
 574   return (is_static() ||
 575           method_holder()->major_version() < 51);
 576 }
 577 
 578 bool Method::is_static_initializer() const {
 579   // For classfiles version 51 or greater, ensure that the clinit method is
 580   // static.  Non-static methods with the name "<clinit>" are not static
 581   // initializers. (older classfiles exempted for backward compatibility)
 582   return name() == vmSymbols::class_initializer_name() &&
 583          has_valid_initializer_flags();
 584 }
 585 
 586 
 587 objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {




 548   }
 549 #endif
 550   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 551   return vtable_index() == nonvirtual_vtable_index;
 552 }
 553 
 554 bool Method::can_be_statically_bound() const {
 555   return can_be_statically_bound(method_holder()->access_flags());
 556 }
 557 
 558 bool Method::is_accessor() const {
 559   if (code_size() != 5) return false;
 560   if (size_of_parameters() != 1) return false;
 561   if (java_code_at(0) != Bytecodes::_aload_0 ) return false;
 562   if (java_code_at(1) != Bytecodes::_getfield) return false;
 563   if (java_code_at(4) != Bytecodes::_areturn &&
 564       java_code_at(4) != Bytecodes::_ireturn ) return false;
 565   return true;
 566 }
 567 
 568 bool Method::is_constant_getter() const {
 569   int last_index = code_size() - 1;
 570   // Check if the first 1-3 bytecodes are a constant push
 571   // and the last bytecode is a return.
 572   return (2 <= code_size() && code_size() <= 4 &&
 573           Bytecodes::is_const(java_code_at(0)) &&
 574           Bytecodes::length_for(java_code_at(0)) == last_index &&
 575           Bytecodes::is_return(java_code_at(last_index)));
 576 }
 577 
 578 bool Method::is_initializer() const {
 579   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
 580 }
 581 
 582 bool Method::has_valid_initializer_flags() const {
 583   return (is_static() ||
 584           method_holder()->major_version() < 51);
 585 }
 586 
 587 bool Method::is_static_initializer() const {
 588   // For classfiles version 51 or greater, ensure that the clinit method is
 589   // static.  Non-static methods with the name "<clinit>" are not static
 590   // initializers. (older classfiles exempted for backward compatibility)
 591   return name() == vmSymbols::class_initializer_name() &&
 592          has_valid_initializer_flags();
 593 }
 594 
 595 
 596 objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {


src/share/vm/oops/method.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File