< prev index next >

src/hotspot/share/oops/method.cpp

Print this page

 850   return (is_static() ||
 851           method_holder()->major_version() < 51);
 852 }
 853 
 854 bool Method::is_static_initializer() const {
 855   // For classfiles version 51 or greater, ensure that the clinit method is
 856   // static.  Non-static methods with the name "<clinit>" are not static
 857   // initializers. (older classfiles exempted for backward compatibility)
 858   return name() == vmSymbols::class_initializer_name() &&
 859          has_valid_initializer_flags();
 860 }
 861 
 862 bool Method::is_object_initializer() const {
 863    return name() == vmSymbols::object_initializer_name();
 864 }
 865 
 866 bool Method::needs_clinit_barrier() const {
 867   return is_static() && !method_holder()->is_initialized();
 868 }
 869 




 870 objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
 871   int length = method->checked_exceptions_length();
 872   if (length == 0) {  // common case
 873     return objArrayHandle(THREAD, Universe::the_empty_class_array());
 874   } else {
 875     methodHandle h_this(THREAD, method);
 876     objArrayOop m_oop = oopFactory::new_objArray(vmClasses::Class_klass(), length, CHECK_(objArrayHandle()));
 877     objArrayHandle mirrors (THREAD, m_oop);
 878     for (int i = 0; i < length; i++) {
 879       CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe
 880       Klass* k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle()));
 881       if (log_is_enabled(Warning, exceptions) &&
 882           !k->is_subclass_of(vmClasses::Throwable_klass())) {
 883         ResourceMark rm(THREAD);
 884         log_warning(exceptions)(
 885           "Class %s in throws clause of method %s is not a subtype of class java.lang.Throwable",
 886           k->external_name(), method->external_name());
 887       }
 888       mirrors->obj_at_put(i, k->java_mirror());
 889     }

 850   return (is_static() ||
 851           method_holder()->major_version() < 51);
 852 }
 853 
 854 bool Method::is_static_initializer() const {
 855   // For classfiles version 51 or greater, ensure that the clinit method is
 856   // static.  Non-static methods with the name "<clinit>" are not static
 857   // initializers. (older classfiles exempted for backward compatibility)
 858   return name() == vmSymbols::class_initializer_name() &&
 859          has_valid_initializer_flags();
 860 }
 861 
 862 bool Method::is_object_initializer() const {
 863    return name() == vmSymbols::object_initializer_name();
 864 }
 865 
 866 bool Method::needs_clinit_barrier() const {
 867   return is_static() && !method_holder()->is_initialized();
 868 }
 869 
 870 bool Method::is_object_wait0() const {
 871   return name() == vmSymbols::wait_name();
 872 }
 873 
 874 objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
 875   int length = method->checked_exceptions_length();
 876   if (length == 0) {  // common case
 877     return objArrayHandle(THREAD, Universe::the_empty_class_array());
 878   } else {
 879     methodHandle h_this(THREAD, method);
 880     objArrayOop m_oop = oopFactory::new_objArray(vmClasses::Class_klass(), length, CHECK_(objArrayHandle()));
 881     objArrayHandle mirrors (THREAD, m_oop);
 882     for (int i = 0; i < length; i++) {
 883       CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe
 884       Klass* k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle()));
 885       if (log_is_enabled(Warning, exceptions) &&
 886           !k->is_subclass_of(vmClasses::Throwable_klass())) {
 887         ResourceMark rm(THREAD);
 888         log_warning(exceptions)(
 889           "Class %s in throws clause of method %s is not a subtype of class java.lang.Throwable",
 890           k->external_name(), method->external_name());
 891       }
 892       mirrors->obj_at_put(i, k->java_mirror());
 893     }
< prev index next >