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




 571   }
 572 #endif
 573   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 574   return vtable_index() == nonvirtual_vtable_index;
 575 }
 576 
 577 bool Method::can_be_statically_bound() const {
 578   return can_be_statically_bound(method_holder()->access_flags());
 579 }
 580 
 581 bool Method::is_accessor() const {
 582   if (code_size() != 5) return false;
 583   if (size_of_parameters() != 1) return false;
 584   if (java_code_at(0) != Bytecodes::_aload_0 ) return false;
 585   if (java_code_at(1) != Bytecodes::_getfield) return false;
 586   if (java_code_at(4) != Bytecodes::_areturn &&
 587       java_code_at(4) != Bytecodes::_ireturn ) return false;
 588   return true;
 589 }
 590 









 591 
 592 bool Method::is_initializer() const {
 593   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
 594 }
 595 
 596 bool Method::has_valid_initializer_flags() const {
 597   return (is_static() ||
 598           method_holder()->major_version() < 51);
 599 }
 600 
 601 bool Method::is_static_initializer() const {
 602   // For classfiles version 51 or greater, ensure that the clinit method is
 603   // static.  Non-static methods with the name "<clinit>" are not static
 604   // initializers. (older classfiles exempted for backward compatibility)
 605   return name() == vmSymbols::class_initializer_name() &&
 606          has_valid_initializer_flags();
 607 }
 608 
 609 
 610 objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {




 571   }
 572 #endif
 573   assert(valid_vtable_index() || valid_itable_index(), "method must be linked before we ask this question");
 574   return vtable_index() == nonvirtual_vtable_index;
 575 }
 576 
 577 bool Method::can_be_statically_bound() const {
 578   return can_be_statically_bound(method_holder()->access_flags());
 579 }
 580 
 581 bool Method::is_accessor() const {
 582   if (code_size() != 5) return false;
 583   if (size_of_parameters() != 1) return false;
 584   if (java_code_at(0) != Bytecodes::_aload_0 ) return false;
 585   if (java_code_at(1) != Bytecodes::_getfield) return false;
 586   if (java_code_at(4) != Bytecodes::_areturn &&
 587       java_code_at(4) != Bytecodes::_ireturn ) return false;
 588   return true;
 589 }
 590 
 591 bool Method::is_constant_getter() const {
 592   int last_index = code_size() - 1;
 593   // Check if the first 1-3 bytecodes are a constant push
 594   // and the last bytecode is a return.
 595   return (2 <= code_size() && code_size() <= 4 &&
 596           Bytecodes::is_const(java_code_at(0)) &&
 597           Bytecodes::length_for(java_code_at(0)) == last_index &&
 598           Bytecodes::is_return(java_code_at(last_index)));
 599 }
 600 
 601 bool Method::is_initializer() const {
 602   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
 603 }
 604 
 605 bool Method::has_valid_initializer_flags() const {
 606   return (is_static() ||
 607           method_holder()->major_version() < 51);
 608 }
 609 
 610 bool Method::is_static_initializer() const {
 611   // For classfiles version 51 or greater, ensure that the clinit method is
 612   // static.  Non-static methods with the name "<clinit>" are not static
 613   // initializers. (older classfiles exempted for backward compatibility)
 614   return name() == vmSymbols::class_initializer_name() &&
 615          has_valid_initializer_flags();
 616 }
 617 
 618 
 619 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