1315 // Construct name without extension
1316 TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
1317 // Use loader to load and initialize class
1318 klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
1319 instanceKlassHandle k (THREAD, ik);
1320 if (k.not_null() && !HAS_PENDING_EXCEPTION) {
1321 k->initialize(THREAD);
1322 }
1323 bool exception_occurred = HAS_PENDING_EXCEPTION;
1324 clear_pending_exception_if_not_oom(CHECK);
1325 if (CompileTheWorldPreloadClasses && k.not_null()) {
1326 constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
1327 if (HAS_PENDING_EXCEPTION) {
1328 // If something went wrong in preloading we just ignore it
1329 clear_pending_exception_if_not_oom(CHECK);
1330 tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
1331 }
1332 }
1333
1334 if (_compile_the_world_counter >= CompileTheWorldStartAt) {
1335 if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) {
1336 // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
1337 tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
1338 } else {
1339 tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
1340 // Preload all classes to get around uncommon traps
1341 // Iterate over all methods in class
1342 for (int n = 0; n < k->methods()->length(); n++) {
1343 methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
1344 if (CompilationPolicy::can_be_compiled(m)) {
1345
1346 if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
1347 // Give sweeper a chance to keep up with CTW
1348 VM_ForceSafepoint op;
1349 VMThread::execute(&op);
1350 _codecache_sweep_counter = 0;
1351 }
1352 // Force compilation
1353 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile,
1354 methodHandle(), 0, "CTW", THREAD);
1355 if (HAS_PENDING_EXCEPTION) {
|
1315 // Construct name without extension
1316 TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
1317 // Use loader to load and initialize class
1318 klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD);
1319 instanceKlassHandle k (THREAD, ik);
1320 if (k.not_null() && !HAS_PENDING_EXCEPTION) {
1321 k->initialize(THREAD);
1322 }
1323 bool exception_occurred = HAS_PENDING_EXCEPTION;
1324 clear_pending_exception_if_not_oom(CHECK);
1325 if (CompileTheWorldPreloadClasses && k.not_null()) {
1326 constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
1327 if (HAS_PENDING_EXCEPTION) {
1328 // If something went wrong in preloading we just ignore it
1329 clear_pending_exception_if_not_oom(CHECK);
1330 tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
1331 }
1332 }
1333
1334 if (_compile_the_world_counter >= CompileTheWorldStartAt) {
1335 if (k.is_null() || exception_occurred) {
1336 // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
1337 tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
1338 } else {
1339 tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
1340 // Preload all classes to get around uncommon traps
1341 // Iterate over all methods in class
1342 for (int n = 0; n < k->methods()->length(); n++) {
1343 methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
1344 if (CompilationPolicy::can_be_compiled(m)) {
1345
1346 if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
1347 // Give sweeper a chance to keep up with CTW
1348 VM_ForceSafepoint op;
1349 VMThread::execute(&op);
1350 _codecache_sweep_counter = 0;
1351 }
1352 // Force compilation
1353 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile,
1354 methodHandle(), 0, "CTW", THREAD);
1355 if (HAS_PENDING_EXCEPTION) {
|