8011933: add number of classes, methods and time spent to CompileTheWorld

Reviewed-by: jrose, kvn
This commit is contained in:
Christian Thalinger 2013-04-12 12:22:59 -07:00
parent 6aa1ba2f50
commit 01e43be718
2 changed files with 21 additions and 12 deletions

View file

@ -1274,13 +1274,16 @@ void ClassLoader::compile_the_world() {
Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
// Iterate over all bootstrap class path entries
ClassPathEntry* e = _first_entry;
jlong start = os::javaTimeMillis();
while (e != NULL) {
// We stop at rt.jar, unless it is the first bootstrap path entry
if (e->is_rt_jar() && e != _first_entry) break;
e->compile_the_world(system_class_loader, CATCH);
e = e->next();
}
tty->print_cr("CompileTheWorld : Done");
jlong end = os::javaTimeMillis();
tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)",
_compile_the_world_class_counter, _compile_the_world_method_counter, (end - start));
{
// Print statistics as if before normal exit:
extern void print_statistics();
@ -1289,7 +1292,8 @@ void ClassLoader::compile_the_world() {
vm_exit(0);
}
int ClassLoader::_compile_the_world_counter = 0;
int ClassLoader::_compile_the_world_class_counter = 0;
int ClassLoader::_compile_the_world_method_counter = 0;
static int _codecache_sweep_counter = 0;
// Filter out all exceptions except OOMs
@ -1311,8 +1315,8 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
// If the file has a period after removing .class, it's not really a
// valid class file. The class loader will check everything else.
if (strchr(buffer, '.') == NULL) {
_compile_the_world_counter++;
if (_compile_the_world_counter > CompileTheWorldStopAt) return;
_compile_the_world_class_counter++;
if (_compile_the_world_class_counter > CompileTheWorldStopAt) return;
// Construct name without extension
TempNewSymbol sym = SymbolTable::new_symbol(buffer, CHECK);
@ -1329,16 +1333,16 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
// If something went wrong in preloading we just ignore it
clear_pending_exception_if_not_oom(CHECK);
tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_class_counter, buffer);
}
}
if (_compile_the_world_counter >= CompileTheWorldStartAt) {
if (_compile_the_world_class_counter >= CompileTheWorldStartAt) {
if (k.is_null() || exception_occurred) {
// If something went wrong (e.g. ExceptionInInitializerError) we skip this class
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_class_counter, buffer);
} else {
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_class_counter, buffer);
// Preload all classes to get around uncommon traps
// Iterate over all methods in class
for (int n = 0; n < k->methods()->length(); n++) {
@ -1356,7 +1360,9 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
methodHandle(), 0, "CTW", THREAD);
if (HAS_PENDING_EXCEPTION) {
clear_pending_exception_if_not_oom(CHECK);
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name()->as_C_string());
} else {
_compile_the_world_method_counter++;
}
if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) {
// Clobber the first compile and force second tier compilation
@ -1370,7 +1376,9 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
methodHandle(), 0, "CTW", THREAD);
if (HAS_PENDING_EXCEPTION) {
clear_pending_exception_if_not_oom(CHECK);
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name()->as_C_string());
} else {
_compile_the_world_method_counter++;
}
}
}