< prev index next >

src/share/vm/classfile/systemDictionary.hpp

Print this page
rev 11945 : 8023697: failed class resolution reports different class name in detail message for the first and subsequent times
Summary: Cache detail message when we cache exception for constant pool resolution.
Reviewed-by: acorn, twisti, jrose
rev 11952 : Merge jdk8u272-b02


 224 
 225     Opt,                        // preload tried; NULL if not present
 226     Opt_Only_JDK14NewRef,       // preload tried; use only with NewReflection
 227     Opt_Only_JDK15,             // preload tried; use only with JDK1.5+
 228     OPTION_LIMIT,
 229     CEIL_LG_OPTION_LIMIT = 4    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
 230   };
 231 
 232 
 233   // Returns a class with a given class name and class loader.  Loads the
 234   // class if needed. If not found a NoClassDefFoundError or a
 235   // ClassNotFoundException is thrown, depending on the value on the
 236   // throw_error flag.  For most uses the throw_error argument should be set
 237   // to true.
 238 
 239   static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
 240   // Convenient call for null loader and protection domain.
 241   static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS);
 242 protected:
 243   // handle error translation for resolve_or_null results
 244   static Klass* handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS);
 245 
 246 public:
 247 
 248   // Returns a class with a given class name and class loader.
 249   // Loads the class if needed. If not found NULL is returned.
 250   static Klass* resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
 251   // Version with null loader and protection domain
 252   static Klass* resolve_or_null(Symbol* class_name, TRAPS);
 253 
 254   // Resolve a superclass or superinterface. Called from ClassFileParser,
 255   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
 256   // "child_name" is the class whose super class or interface is being resolved.
 257   static Klass* resolve_super_or_fail(Symbol* child_name,
 258                                         Symbol* class_name,
 259                                         Handle class_loader,
 260                                         Handle protection_domain,
 261                                         bool is_superclass,
 262                                         TRAPS);
 263 
 264   // Parse new stream. This won't update the system dictionary or


 532   static methodHandle find_dynamic_call_site_invoker(KlassHandle caller,
 533                                                      Handle bootstrap_method,
 534                                                      Symbol* name,
 535                                                      Symbol* type,
 536                                                      Handle *appendix_result,
 537                                                      Handle *method_type_result,
 538                                                      TRAPS);
 539 
 540   // Utility for printing loader "name" as part of tracing constraints
 541   static const char* loader_name(oop loader) {
 542     return ((loader) == NULL ? "<bootloader>" :
 543             InstanceKlass::cast((loader)->klass())->name()->as_C_string() );
 544   }
 545   static const char* loader_name(ClassLoaderData* loader_data) {
 546     return (loader_data->class_loader() == NULL ? "<bootloader>" :
 547             InstanceKlass::cast((loader_data->class_loader())->klass())->name()->as_C_string() );
 548   }
 549 
 550   // Record the error when the first attempt to resolve a reference from a constant
 551   // pool entry to a class fails.
 552   static void add_resolution_error(constantPoolHandle pool, int which, Symbol* error);

 553   static void delete_resolution_error(ConstantPool* pool);
 554   static Symbol* find_resolution_error(constantPoolHandle pool, int which);

 555 
 556  protected:
 557 
 558   enum Constants {
 559     _loader_constraint_size = 107,                     // number of entries in constraint table
 560     _resolution_error_size  = 107,                     // number of entries in resolution error table
 561     _invoke_method_size     = 139,                     // number of entries in invoke method table
 562     _nof_buckets            = 1009,                    // number of buckets in hash table for placeholders
 563     _old_default_sdsize     = 1009,                    // backward compat for system dictionary size
 564     _prime_array_size       = 8,                       // array of primes for system dictionary size
 565     _average_depth_goal     = 3                        // goal for lookup length
 566   };
 567 
 568 
 569   // Static variables
 570 
 571   // hashtable sizes for system dictionary to allow growth
 572   // prime numbers for system dictionary size
 573   static int                     _sdgeneration;
 574   static const int               _primelist[_prime_array_size];




 224 
 225     Opt,                        // preload tried; NULL if not present
 226     Opt_Only_JDK14NewRef,       // preload tried; use only with NewReflection
 227     Opt_Only_JDK15,             // preload tried; use only with JDK1.5+
 228     OPTION_LIMIT,
 229     CEIL_LG_OPTION_LIMIT = 4    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
 230   };
 231 
 232 
 233   // Returns a class with a given class name and class loader.  Loads the
 234   // class if needed. If not found a NoClassDefFoundError or a
 235   // ClassNotFoundException is thrown, depending on the value on the
 236   // throw_error flag.  For most uses the throw_error argument should be set
 237   // to true.
 238 
 239   static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
 240   // Convenient call for null loader and protection domain.
 241   static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS);
 242 protected:
 243   // handle error translation for resolve_or_null results
 244   static Klass* handle_resolution_exception(Symbol* class_name, bool throw_error, KlassHandle klass_h, TRAPS);
 245 
 246 public:
 247 
 248   // Returns a class with a given class name and class loader.
 249   // Loads the class if needed. If not found NULL is returned.
 250   static Klass* resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
 251   // Version with null loader and protection domain
 252   static Klass* resolve_or_null(Symbol* class_name, TRAPS);
 253 
 254   // Resolve a superclass or superinterface. Called from ClassFileParser,
 255   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
 256   // "child_name" is the class whose super class or interface is being resolved.
 257   static Klass* resolve_super_or_fail(Symbol* child_name,
 258                                         Symbol* class_name,
 259                                         Handle class_loader,
 260                                         Handle protection_domain,
 261                                         bool is_superclass,
 262                                         TRAPS);
 263 
 264   // Parse new stream. This won't update the system dictionary or


 532   static methodHandle find_dynamic_call_site_invoker(KlassHandle caller,
 533                                                      Handle bootstrap_method,
 534                                                      Symbol* name,
 535                                                      Symbol* type,
 536                                                      Handle *appendix_result,
 537                                                      Handle *method_type_result,
 538                                                      TRAPS);
 539 
 540   // Utility for printing loader "name" as part of tracing constraints
 541   static const char* loader_name(oop loader) {
 542     return ((loader) == NULL ? "<bootloader>" :
 543             InstanceKlass::cast((loader)->klass())->name()->as_C_string() );
 544   }
 545   static const char* loader_name(ClassLoaderData* loader_data) {
 546     return (loader_data->class_loader() == NULL ? "<bootloader>" :
 547             InstanceKlass::cast((loader_data->class_loader())->klass())->name()->as_C_string() );
 548   }
 549 
 550   // Record the error when the first attempt to resolve a reference from a constant
 551   // pool entry to a class fails.
 552   static void add_resolution_error(constantPoolHandle pool, int which, Symbol* error,
 553                                    Symbol* message);
 554   static void delete_resolution_error(ConstantPool* pool);
 555   static Symbol* find_resolution_error(constantPoolHandle pool, int which,
 556                                        Symbol** message);
 557 
 558  protected:
 559 
 560   enum Constants {
 561     _loader_constraint_size = 107,                     // number of entries in constraint table
 562     _resolution_error_size  = 107,                     // number of entries in resolution error table
 563     _invoke_method_size     = 139,                     // number of entries in invoke method table
 564     _nof_buckets            = 1009,                    // number of buckets in hash table for placeholders
 565     _old_default_sdsize     = 1009,                    // backward compat for system dictionary size
 566     _prime_array_size       = 8,                       // array of primes for system dictionary size
 567     _average_depth_goal     = 3                        // goal for lookup length
 568   };
 569 
 570 
 571   // Static variables
 572 
 573   // hashtable sizes for system dictionary to allow growth
 574   // prime numbers for system dictionary size
 575   static int                     _sdgeneration;
 576   static const int               _primelist[_prime_array_size];


< prev index next >