< prev index next >

src/hotspot/share/oops/method.cpp

Print this page

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

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