comparison src/share/vm/classfile/classLoader.cpp @ 2273:2ab52cda08e5

Merge with OpenJDK.
author Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
date Thu, 03 Mar 2011 19:25:53 +0100
parents d25d4ca69222 34457f6ac818
children 0654ee04b214
comparison
equal deleted inserted replaced
2219:0a14ff0a8cc4 2273:2ab52cda08e5
1288 } 1288 }
1289 1289
1290 int ClassLoader::_compile_the_world_counter = 0; 1290 int ClassLoader::_compile_the_world_counter = 0;
1291 static int _codecache_sweep_counter = 0; 1291 static int _codecache_sweep_counter = 0;
1292 1292
1293 // Filter out all exceptions except OOMs
1294 static void clear_pending_exception_if_not_oom(TRAPS) {
1295 if (HAS_PENDING_EXCEPTION &&
1296 !PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
1297 CLEAR_PENDING_EXCEPTION;
1298 }
1299 // The CHECK at the caller will propagate the exception out
1300 }
1301
1293 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { 1302 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
1294 int len = (int)strlen(name); 1303 int len = (int)strlen(name);
1295 if (len > 6 && strcmp(".class", name + len - 6) == 0) { 1304 if (len > 6 && strcmp(".class", name + len - 6) == 0) {
1296 // We have a .class file 1305 // We have a .class file
1297 char buffer[2048]; 1306 char buffer[2048];
1310 instanceKlassHandle k (THREAD, ik); 1319 instanceKlassHandle k (THREAD, ik);
1311 if (k.not_null() && !HAS_PENDING_EXCEPTION) { 1320 if (k.not_null() && !HAS_PENDING_EXCEPTION) {
1312 k->initialize(THREAD); 1321 k->initialize(THREAD);
1313 } 1322 }
1314 bool exception_occurred = HAS_PENDING_EXCEPTION; 1323 bool exception_occurred = HAS_PENDING_EXCEPTION;
1315 CLEAR_PENDING_EXCEPTION; 1324 clear_pending_exception_if_not_oom(CHECK);
1316 if (CompileTheWorldPreloadClasses && k.not_null()) { 1325 if (CompileTheWorldPreloadClasses && k.not_null()) {
1317 constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD); 1326 constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
1318 if (HAS_PENDING_EXCEPTION) { 1327 if (HAS_PENDING_EXCEPTION) {
1319 // If something went wrong in preloading we just ignore it 1328 // If something went wrong in preloading we just ignore it
1320 CLEAR_PENDING_EXCEPTION; 1329 clear_pending_exception_if_not_oom(CHECK);
1321 tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer); 1330 tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
1322 } 1331 }
1323 } 1332 }
1324 1333
1325 if (_compile_the_world_counter >= CompileTheWorldStartAt) { 1334 if (_compile_the_world_counter >= CompileTheWorldStartAt) {
1342 } 1351 }
1343 // Force compilation 1352 // Force compilation
1344 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile, 1353 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile,
1345 methodHandle(), 0, "CTW", THREAD); 1354 methodHandle(), 0, "CTW", THREAD);
1346 if (HAS_PENDING_EXCEPTION) { 1355 if (HAS_PENDING_EXCEPTION) {
1347 CLEAR_PENDING_EXCEPTION; 1356 clear_pending_exception_if_not_oom(CHECK);
1348 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); 1357 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
1349 } 1358 }
1350 if (TieredCompilation) { 1359 if (TieredCompilation) {
1351 // Clobber the first compile and force second tier compilation 1360 // Clobber the first compile and force second tier compilation
1352 nmethod* nm = m->code(); 1361 nmethod* nm = m->code();
1356 m->clear_code(); 1365 m->clear_code();
1357 } 1366 }
1358 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization, 1367 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
1359 methodHandle(), 0, "CTW", THREAD); 1368 methodHandle(), 0, "CTW", THREAD);
1360 if (HAS_PENDING_EXCEPTION) { 1369 if (HAS_PENDING_EXCEPTION) {
1361 CLEAR_PENDING_EXCEPTION; 1370 clear_pending_exception_if_not_oom(CHECK);
1362 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); 1371 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
1363 } 1372 }
1364 } 1373 }
1365 } 1374 }
1366 1375