129 130 #endif 131 132 // ---------------------------------------------------------------------------- 133 // Parallel class loading check 134 135 bool SystemDictionary::is_parallelCapable(Handle class_loader) { 136 if (UnsyncloadClass || class_loader.is_null()) return true; 137 if (AlwaysLockClassLoader) return false; 138 return java_lang_ClassLoader::parallelCapable(class_loader()); 139 } 140 // ---------------------------------------------------------------------------- 141 // ParallelDefineClass flag does not apply to bootclass loader 142 bool SystemDictionary::is_parallelDefine(Handle class_loader) { 143 if (class_loader.is_null()) return false; 144 if (AllowParallelDefineClass && java_lang_ClassLoader::parallelCapable(class_loader())) { 145 return true; 146 } 147 return false; 148 } 149 // ---------------------------------------------------------------------------- 150 // Resolving of classes 151 152 // Forwards to resolve_or_null 153 154 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) { 155 Klass* klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD); 156 if (HAS_PENDING_EXCEPTION || klass == NULL) { 157 KlassHandle k_h(THREAD, klass); 158 // can return a null klass 159 klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD); 160 } 161 return klass; 162 } 163 164 Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) { 165 if (HAS_PENDING_EXCEPTION) { 166 // If we have a pending exception we forward it to the caller, unless throw_error is true, 167 // in which case we have to check whether the pending exception is a ClassNotFoundException, 168 // and if so convert it to a NoClassDefFoundError | 129 130 #endif 131 132 // ---------------------------------------------------------------------------- 133 // Parallel class loading check 134 135 bool SystemDictionary::is_parallelCapable(Handle class_loader) { 136 if (UnsyncloadClass || class_loader.is_null()) return true; 137 if (AlwaysLockClassLoader) return false; 138 return java_lang_ClassLoader::parallelCapable(class_loader()); 139 } 140 // ---------------------------------------------------------------------------- 141 // ParallelDefineClass flag does not apply to bootclass loader 142 bool SystemDictionary::is_parallelDefine(Handle class_loader) { 143 if (class_loader.is_null()) return false; 144 if (AllowParallelDefineClass && java_lang_ClassLoader::parallelCapable(class_loader())) { 145 return true; 146 } 147 return false; 148 } 149 150 /** 151 * Returns true if the passed class loader is the extension class loader. 152 */ 153 bool SystemDictionary::is_ext_class_loader(Handle class_loader) { 154 if (class_loader.is_null()) { 155 return false; 156 } 157 return (class_loader->klass()->name() == vmSymbols::sun_misc_Launcher_ExtClassLoader()); 158 } 159 160 // ---------------------------------------------------------------------------- 161 // Resolving of classes 162 163 // Forwards to resolve_or_null 164 165 Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS) { 166 Klass* klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD); 167 if (HAS_PENDING_EXCEPTION || klass == NULL) { 168 KlassHandle k_h(THREAD, klass); 169 // can return a null klass 170 klass = handle_resolution_exception(class_name, class_loader, protection_domain, throw_error, k_h, THREAD); 171 } 172 return klass; 173 } 174 175 Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS) { 176 if (HAS_PENDING_EXCEPTION) { 177 // If we have a pending exception we forward it to the caller, unless throw_error is true, 178 // in which case we have to check whether the pending exception is a ClassNotFoundException, 179 // and if so convert it to a NoClassDefFoundError |