src/share/vm/classfile/classLoader.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/classfile

src/share/vm/classfile/classLoader.cpp

Print this page
rev 10291 : 8150646: Add support for blocking compiles though whitebox API
Summary: Better testing
Reviewed-by:


1452       if (_compile_the_world_class_counter >= CompileTheWorldStartAt) {
1453         if (k.is_null() || exception_occurred) {
1454           // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
1455           tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_class_counter, buffer);
1456         } else {
1457           tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_class_counter, buffer);
1458           // Preload all classes to get around uncommon traps
1459           // Iterate over all methods in class
1460           int comp_level = CompilationPolicy::policy()->initial_compile_level();
1461           for (int n = 0; n < k->methods()->length(); n++) {
1462             methodHandle m (THREAD, k->methods()->at(n));
1463             if (can_be_compiled(m, comp_level)) {
1464               if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
1465                 // Give sweeper a chance to keep up with CTW
1466                 VM_ForceSafepoint op;
1467                 VMThread::execute(&op);
1468                 _codecache_sweep_counter = 0;
1469               }
1470               // Force compilation
1471               CompileBroker::compile_method(m, InvocationEntryBci, comp_level,
1472                                             methodHandle(), 0, "CTW", THREAD);
1473               if (HAS_PENDING_EXCEPTION) {
1474                 clear_pending_exception_if_not_oom(CHECK);
1475                 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1476               } else {
1477                 _compile_the_world_method_counter++;
1478               }
1479               if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) {
1480                 // Clobber the first compile and force second tier compilation
1481                 nmethod* nm = m->code();
1482                 if (nm != NULL && !m->is_method_handle_intrinsic()) {
1483                   // Throw out the code so that the code cache doesn't fill up
1484                   nm->make_not_entrant();
1485                   m->clear_code();
1486                 }
1487                 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
1488                                               methodHandle(), 0, "CTW", THREAD);
1489                 if (HAS_PENDING_EXCEPTION) {
1490                   clear_pending_exception_if_not_oom(CHECK);
1491                   tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1492                 } else {
1493                   _compile_the_world_method_counter++;
1494                 }
1495               }
1496             } else {
1497               tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1498             }
1499 
1500             nmethod* nm = m->code();
1501             if (nm != NULL && !m->is_method_handle_intrinsic()) {
1502               // Throw out the code so that the code cache doesn't fill up
1503               nm->make_not_entrant();
1504               m->clear_code();
1505             }
1506           }
1507         }
1508       }




1452       if (_compile_the_world_class_counter >= CompileTheWorldStartAt) {
1453         if (k.is_null() || exception_occurred) {
1454           // If something went wrong (e.g. ExceptionInInitializerError) we skip this class
1455           tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_class_counter, buffer);
1456         } else {
1457           tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_class_counter, buffer);
1458           // Preload all classes to get around uncommon traps
1459           // Iterate over all methods in class
1460           int comp_level = CompilationPolicy::policy()->initial_compile_level();
1461           for (int n = 0; n < k->methods()->length(); n++) {
1462             methodHandle m (THREAD, k->methods()->at(n));
1463             if (can_be_compiled(m, comp_level)) {
1464               if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
1465                 // Give sweeper a chance to keep up with CTW
1466                 VM_ForceSafepoint op;
1467                 VMThread::execute(&op);
1468                 _codecache_sweep_counter = 0;
1469               }
1470               // Force compilation
1471               CompileBroker::compile_method(m, InvocationEntryBci, comp_level,
1472                                             methodHandle(), 0, "CTW", false, THREAD);
1473               if (HAS_PENDING_EXCEPTION) {
1474                 clear_pending_exception_if_not_oom(CHECK);
1475                 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1476               } else {
1477                 _compile_the_world_method_counter++;
1478               }
1479               if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) {
1480                 // Clobber the first compile and force second tier compilation
1481                 nmethod* nm = m->code();
1482                 if (nm != NULL && !m->is_method_handle_intrinsic()) {
1483                   // Throw out the code so that the code cache doesn't fill up
1484                   nm->make_not_entrant();
1485                   m->clear_code();
1486                 }
1487                 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
1488                                               methodHandle(), 0, "CTW", false, THREAD);
1489                 if (HAS_PENDING_EXCEPTION) {
1490                   clear_pending_exception_if_not_oom(CHECK);
1491                   tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1492                 } else {
1493                   _compile_the_world_method_counter++;
1494                 }
1495               }
1496             } else {
1497               tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string());
1498             }
1499 
1500             nmethod* nm = m->code();
1501             if (nm != NULL && !m->is_method_handle_intrinsic()) {
1502               // Throw out the code so that the code cache doesn't fill up
1503               nm->make_not_entrant();
1504               m->clear_code();
1505             }
1506           }
1507         }
1508       }


src/share/vm/classfile/classLoader.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File