1197 true /* shared class */); |
1197 true /* shared class */); |
1198 } |
1198 } |
1199 return ik; |
1199 return ik; |
1200 } |
1200 } |
1201 |
1201 |
1202 #ifdef KERNEL |
|
1203 // Some classes on the bootstrap class path haven't been installed on the |
|
1204 // system yet. Call the DownloadManager method to make them appear in the |
|
1205 // bootstrap class path and try again to load the named class. |
|
1206 // Note that with delegation class loaders all classes in another loader will |
|
1207 // first try to call this so it'd better be fast!! |
|
1208 static instanceKlassHandle download_and_retry_class_load( |
|
1209 Symbol* class_name, |
|
1210 TRAPS) { |
|
1211 |
|
1212 Klass* dlm = SystemDictionary::DownloadManager_klass(); |
|
1213 instanceKlassHandle nk; |
|
1214 |
|
1215 // If download manager class isn't loaded just return. |
|
1216 if (dlm == NULL) return nk; |
|
1217 |
|
1218 { HandleMark hm(THREAD); |
|
1219 ResourceMark rm(THREAD); |
|
1220 Handle s = java_lang_String::create_from_symbol(class_name, CHECK_(nk)); |
|
1221 Handle class_string = java_lang_String::externalize_classname(s, CHECK_(nk)); |
|
1222 |
|
1223 // return value |
|
1224 JavaValue result(T_OBJECT); |
|
1225 |
|
1226 // Call the DownloadManager. We assume that it has a lock because |
|
1227 // multiple classes could be not found and downloaded at the same time. |
|
1228 // class sun.misc.DownloadManager; |
|
1229 // public static String getBootClassPathEntryForClass(String className); |
|
1230 JavaCalls::call_static(&result, |
|
1231 KlassHandle(THREAD, dlm), |
|
1232 vmSymbols::getBootClassPathEntryForClass_name(), |
|
1233 vmSymbols::string_string_signature(), |
|
1234 class_string, |
|
1235 CHECK_(nk)); |
|
1236 |
|
1237 // Get result.string and add to bootclasspath |
|
1238 assert(result.get_type() == T_OBJECT, "just checking"); |
|
1239 oop obj = (oop) result.get_jobject(); |
|
1240 if (obj == NULL) { return nk; } |
|
1241 |
|
1242 Handle h_obj(THREAD, obj); |
|
1243 char* new_class_name = java_lang_String::as_platform_dependent_str(h_obj, |
|
1244 CHECK_(nk)); |
|
1245 |
|
1246 // lock the loader |
|
1247 // we use this lock because JVMTI does. |
|
1248 Handle loader_lock(THREAD, SystemDictionary::system_loader_lock()); |
|
1249 |
|
1250 ObjectLocker ol(loader_lock, THREAD); |
|
1251 // add the file to the bootclasspath |
|
1252 ClassLoader::update_class_path_entry_list(new_class_name, true); |
|
1253 } // end HandleMark |
|
1254 |
|
1255 if (TraceClassLoading) { |
|
1256 ClassLoader::print_bootclasspath(); |
|
1257 } |
|
1258 return ClassLoader::load_classfile(class_name, CHECK_(nk)); |
|
1259 } |
|
1260 #endif // KERNEL |
|
1261 |
|
1262 |
1202 |
1263 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) { |
1203 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) { |
1264 instanceKlassHandle nh = instanceKlassHandle(); // null Handle |
1204 instanceKlassHandle nh = instanceKlassHandle(); // null Handle |
1265 if (class_loader.is_null()) { |
1205 if (class_loader.is_null()) { |
1266 |
1206 |
1275 if (k.is_null()) { |
1215 if (k.is_null()) { |
1276 // Use VM class loader |
1216 // Use VM class loader |
1277 PerfTraceTime vmtimer(ClassLoader::perf_sys_classload_time()); |
1217 PerfTraceTime vmtimer(ClassLoader::perf_sys_classload_time()); |
1278 k = ClassLoader::load_classfile(class_name, CHECK_(nh)); |
1218 k = ClassLoader::load_classfile(class_name, CHECK_(nh)); |
1279 } |
1219 } |
1280 |
|
1281 #ifdef KERNEL |
|
1282 // If the VM class loader has failed to load the class, call the |
|
1283 // DownloadManager class to make it magically appear on the classpath |
|
1284 // and try again. This is only configured with the Kernel VM. |
|
1285 if (k.is_null()) { |
|
1286 k = download_and_retry_class_load(class_name, CHECK_(nh)); |
|
1287 } |
|
1288 #endif // KERNEL |
|
1289 |
1220 |
1290 // find_or_define_instance_class may return a different InstanceKlass |
1221 // find_or_define_instance_class may return a different InstanceKlass |
1291 if (!k.is_null()) { |
1222 if (!k.is_null()) { |
1292 k = find_or_define_instance_class(class_name, class_loader, k, CHECK_(nh)); |
1223 k = find_or_define_instance_class(class_name, class_loader, k, CHECK_(nh)); |
1293 } |
1224 } |
1820 int info = wk_init_info[id - FIRST_WKID]; |
1751 int info = wk_init_info[id - FIRST_WKID]; |
1821 int sid = (info >> CEIL_LG_OPTION_LIMIT); |
1752 int sid = (info >> CEIL_LG_OPTION_LIMIT); |
1822 Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); |
1753 Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); |
1823 Klass** klassp = &_well_known_klasses[id]; |
1754 Klass** klassp = &_well_known_klasses[id]; |
1824 bool must_load = (init_opt < SystemDictionary::Opt); |
1755 bool must_load = (init_opt < SystemDictionary::Opt); |
1825 bool try_load = true; |
1756 if ((*klassp) == NULL) { |
1826 if (init_opt == SystemDictionary::Opt_Kernel) { |
|
1827 #ifndef KERNEL |
|
1828 try_load = false; |
|
1829 #endif //KERNEL |
|
1830 } |
|
1831 if ((*klassp) == NULL && try_load) { |
|
1832 if (must_load) { |
1757 if (must_load) { |
1833 (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class |
1758 (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class |
1834 } else { |
1759 } else { |
1835 (*klassp) = resolve_or_null(symbol, CHECK_0); // load optional klass |
1760 (*klassp) = resolve_or_null(symbol, CHECK_0); // load optional klass |
1836 } |
1761 } |
1915 _box_klasses[T_SHORT] = WK_KLASS(Short_klass); |
1840 _box_klasses[T_SHORT] = WK_KLASS(Short_klass); |
1916 _box_klasses[T_INT] = WK_KLASS(Integer_klass); |
1841 _box_klasses[T_INT] = WK_KLASS(Integer_klass); |
1917 _box_klasses[T_LONG] = WK_KLASS(Long_klass); |
1842 _box_klasses[T_LONG] = WK_KLASS(Long_klass); |
1918 //_box_klasses[T_OBJECT] = WK_KLASS(object_klass); |
1843 //_box_klasses[T_OBJECT] = WK_KLASS(object_klass); |
1919 //_box_klasses[T_ARRAY] = WK_KLASS(object_klass); |
1844 //_box_klasses[T_ARRAY] = WK_KLASS(object_klass); |
1920 |
|
1921 #ifdef KERNEL |
|
1922 if (DownloadManager_klass() == NULL) { |
|
1923 warning("Cannot find sun/jkernel/DownloadManager"); |
|
1924 } |
|
1925 #endif // KERNEL |
|
1926 |
1845 |
1927 { // Compute whether we should use loadClass or loadClassInternal when loading classes. |
1846 { // Compute whether we should use loadClass or loadClassInternal when loading classes. |
1928 Method* method = InstanceKlass::cast(ClassLoader_klass())->find_method(vmSymbols::loadClassInternal_name(), vmSymbols::string_class_signature()); |
1847 Method* method = InstanceKlass::cast(ClassLoader_klass())->find_method(vmSymbols::loadClassInternal_name(), vmSymbols::string_class_signature()); |
1929 _has_loadClassInternal = (method != NULL); |
1848 _has_loadClassInternal = (method != NULL); |
1930 } |
1849 } |