hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 13952 e3cf184080bc
parent 13753 1df4fd11c5b8
child 13961 aeaa21c167d1
equal deleted inserted replaced
13918:b01a48301e67 13952:e3cf184080bc
   242     if (k != NULL) {
   242     if (k != NULL) {
   243       k = Klass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
   243       k = Klass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
   244     }
   244     }
   245   } else {
   245   } else {
   246     k = Universe::typeArrayKlassObj(t);
   246     k = Universe::typeArrayKlassObj(t);
   247     k = typeArrayKlass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
   247     k = TypeArrayKlass::cast(k)->array_klass(fd.dimension(), CHECK_NULL);
   248   }
   248   }
   249   return k;
   249   return k;
   250 }
   250 }
   251 
   251 
   252 
   252 
   918 
   918 
   919 
   919 
   920 // Look for a loaded instance or array klass by name.  Do not do any loading.
   920 // Look for a loaded instance or array klass by name.  Do not do any loading.
   921 // return NULL in case of error.
   921 // return NULL in case of error.
   922 Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
   922 Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
   923                                                         Handle class_loader,
   923                                                       Handle class_loader,
   924                                                         Handle protection_domain,
   924                                                       Handle protection_domain,
   925                                                         TRAPS) {
   925                                                       TRAPS) {
   926   Klass* k = NULL;
   926   Klass* k = NULL;
   927   assert(class_name != NULL, "class name must be non NULL");
   927   assert(class_name != NULL, "class name must be non NULL");
   928 
   928 
   929   // Try to get one of the well-known klasses.
   929   // Try to get one of the well-known klasses.
   930   if (LinkWellKnownClasses) {
   930   if (LinkWellKnownClasses) {
   988 
   988 
   989 // Note: this method is much like resolve_from_stream, but
   989 // Note: this method is much like resolve_from_stream, but
   990 // updates no supplemental data structures.
   990 // updates no supplemental data structures.
   991 // TODO consolidate the two methods with a helper routine?
   991 // TODO consolidate the two methods with a helper routine?
   992 Klass* SystemDictionary::parse_stream(Symbol* class_name,
   992 Klass* SystemDictionary::parse_stream(Symbol* class_name,
   993                                         Handle class_loader,
   993                                       Handle class_loader,
   994                                         Handle protection_domain,
   994                                       Handle protection_domain,
   995                                         ClassFileStream* st,
   995                                       ClassFileStream* st,
   996                                         KlassHandle host_klass,
   996                                       KlassHandle host_klass,
   997                                         GrowableArray<Handle>* cp_patches,
   997                                       GrowableArray<Handle>* cp_patches,
   998                                         TRAPS) {
   998                                       TRAPS) {
   999   TempNewSymbol parsed_name = NULL;
   999   TempNewSymbol parsed_name = NULL;
  1000 
  1000 
  1001   // Parse the stream. Note that we do this even though this klass might
  1001   // Parse the stream. Note that we do this even though this klass might
  1002   // already be present in the SystemDictionary, otherwise we would not
  1002   // already be present in the SystemDictionary, otherwise we would not
  1003   // throw potential ClassFormatErrors.
  1003   // throw potential ClassFormatErrors.
  1074 // JVM_DefineClass).
  1074 // JVM_DefineClass).
  1075 // Note: class_name can be NULL. In that case we do not know the name of
  1075 // Note: class_name can be NULL. In that case we do not know the name of
  1076 // the class until we have parsed the stream.
  1076 // the class until we have parsed the stream.
  1077 
  1077 
  1078 Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
  1078 Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
  1079                                                Handle class_loader,
  1079                                              Handle class_loader,
  1080                                                Handle protection_domain,
  1080                                              Handle protection_domain,
  1081                                                ClassFileStream* st,
  1081                                              ClassFileStream* st,
  1082                                                bool verify,
  1082                                              bool verify,
  1083                                                TRAPS) {
  1083                                              TRAPS) {
  1084 
  1084 
  1085   // Classloaders that support parallelism, e.g. bootstrap classloader,
  1085   // Classloaders that support parallelism, e.g. bootstrap classloader,
  1086   // or all classloaders with UnsyncloadClass do not acquire lock here
  1086   // or all classloaders with UnsyncloadClass do not acquire lock here
  1087   bool DoObjectLock = true;
  1087   bool DoObjectLock = true;
  1088   if (is_parallelCapable(class_loader)) {
  1088   if (is_parallelCapable(class_loader)) {
  2185 
  2185 
  2186   // First see if it has been loaded directly.
  2186   // First see if it has been loaded directly.
  2187   // Force the protection domain to be null.  (This removes protection checks.)
  2187   // Force the protection domain to be null.  (This removes protection checks.)
  2188   Handle no_protection_domain;
  2188   Handle no_protection_domain;
  2189   Klass* klass = find_instance_or_array_klass(class_name, class_loader,
  2189   Klass* klass = find_instance_or_array_klass(class_name, class_loader,
  2190                                                 no_protection_domain, CHECK_NULL);
  2190                                               no_protection_domain, CHECK_NULL);
  2191   if (klass != NULL)
  2191   if (klass != NULL)
  2192     return klass;
  2192     return klass;
  2193 
  2193 
  2194   // Now look to see if it has been loaded elsewhere, and is subject to
  2194   // Now look to see if it has been loaded elsewhere, and is subject to
  2195   // a loader constraint that would require this loader to return the
  2195   // a loader constraint that would require this loader to return the
  2521     if (ss.is_object() && accessing_klass.not_null()) {
  2521     if (ss.is_object() && accessing_klass.not_null()) {
  2522       Klass* sel_klass = java_lang_Class::as_Klass(mirror);
  2522       Klass* sel_klass = java_lang_Class::as_Klass(mirror);
  2523       mirror = NULL;  // safety
  2523       mirror = NULL;  // safety
  2524       // Emulate ConstantPool::verify_constant_pool_resolve.
  2524       // Emulate ConstantPool::verify_constant_pool_resolve.
  2525       if (Klass::cast(sel_klass)->oop_is_objArray())
  2525       if (Klass::cast(sel_klass)->oop_is_objArray())
  2526         sel_klass = objArrayKlass::cast(sel_klass)->bottom_klass();
  2526         sel_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
  2527       if (Klass::cast(sel_klass)->oop_is_instance()) {
  2527       if (Klass::cast(sel_klass)->oop_is_instance()) {
  2528         KlassHandle sel_kh(THREAD, sel_klass);
  2528         KlassHandle sel_kh(THREAD, sel_klass);
  2529         LinkResolver::check_klass_accessability(accessing_klass, sel_kh, CHECK_(empty));
  2529         LinkResolver::check_klass_accessability(accessing_klass, sel_kh, CHECK_(empty));
  2530       }
  2530       }
  2531     }
  2531     }