1351 if ((obj != NULL) && !(java_lang_Class::is_primitive(obj))) {
1352 instanceKlassHandle k =
1353 instanceKlassHandle(THREAD, java_lang_Class::as_Klass(obj));
1354 // For user defined Java class loaders, check that the name returned is
1355 // the same as that requested. This check is done for the bootstrap
1356 // loader when parsing the class file.
1357 if (class_name == k->name()) {
1358 return k;
1359 }
1360 }
1361 // Class is not found or has the wrong name, return NULL
1362 return nh;
1363 }
1364 }
1365
1366 void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) {
1367
1368 ClassLoaderData* loader_data = k->class_loader_data();
1369 Handle class_loader_h(THREAD, loader_data->class_loader());
1370
1371 for (uintx it = 0; it < GCExpandToAllocateDelayMillis; it++){}
1372
1373 // for bootstrap and other parallel classloaders don't acquire lock,
1374 // use placeholder token
1375 // If a parallelCapable class loader calls define_instance_class instead of
1376 // find_or_define_instance_class to get here, we have a timing
1377 // hole with systemDictionary updates and check_constraints
1378 if (!class_loader_h.is_null() && !is_parallelCapable(class_loader_h)) {
1379 assert(ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD,
1380 compute_loader_lock_object(class_loader_h, THREAD)),
1381 "define called without lock");
1382 }
1383
1384 // Check class-loading constraints. Throw exception if violation is detected.
1385 // Grabs and releases SystemDictionary_lock
1386 // The check_constraints/find_class call and update_dictionary sequence
1387 // must be "atomic" for a specific class/classloader pair so we never
1388 // define two different instanceKlasses for that class/classloader pair.
1389 // Existing classloaders will call define_instance_class with the
1390 // classloader lock held
1391 // Parallel classloaders will call find_or_define_instance_class
1392 // which will require a token to perform the define class
|
1351 if ((obj != NULL) && !(java_lang_Class::is_primitive(obj))) {
1352 instanceKlassHandle k =
1353 instanceKlassHandle(THREAD, java_lang_Class::as_Klass(obj));
1354 // For user defined Java class loaders, check that the name returned is
1355 // the same as that requested. This check is done for the bootstrap
1356 // loader when parsing the class file.
1357 if (class_name == k->name()) {
1358 return k;
1359 }
1360 }
1361 // Class is not found or has the wrong name, return NULL
1362 return nh;
1363 }
1364 }
1365
1366 void SystemDictionary::define_instance_class(instanceKlassHandle k, TRAPS) {
1367
1368 ClassLoaderData* loader_data = k->class_loader_data();
1369 Handle class_loader_h(THREAD, loader_data->class_loader());
1370
1371 // for bootstrap and other parallel classloaders don't acquire lock,
1372 // use placeholder token
1373 // If a parallelCapable class loader calls define_instance_class instead of
1374 // find_or_define_instance_class to get here, we have a timing
1375 // hole with systemDictionary updates and check_constraints
1376 if (!class_loader_h.is_null() && !is_parallelCapable(class_loader_h)) {
1377 assert(ObjectSynchronizer::current_thread_holds_lock((JavaThread*)THREAD,
1378 compute_loader_lock_object(class_loader_h, THREAD)),
1379 "define called without lock");
1380 }
1381
1382 // Check class-loading constraints. Throw exception if violation is detected.
1383 // Grabs and releases SystemDictionary_lock
1384 // The check_constraints/find_class call and update_dictionary sequence
1385 // must be "atomic" for a specific class/classloader pair so we never
1386 // define two different instanceKlasses for that class/classloader pair.
1387 // Existing classloaders will call define_instance_class with the
1388 // classloader lock held
1389 // Parallel classloaders will call find_or_define_instance_class
1390 // which will require a token to perform the define class
|