提交 4098146a 编写于 作者: T twisti

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

Reviewed-by: jrose, kvn
上级 e24568e9
......@@ -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++;
}
}
}
......
......@@ -340,11 +340,12 @@ class ClassLoader: AllStatic {
// Force compilation of all methods in all classes in bootstrap class path (stress test)
#ifndef PRODUCT
private:
static int _compile_the_world_counter;
static int _compile_the_world_class_counter;
static int _compile_the_world_method_counter;
public:
static void compile_the_world();
static void compile_the_world_in(char* name, Handle loader, TRAPS);
static int compile_the_world_counter() { return _compile_the_world_counter; }
static int compile_the_world_counter() { return _compile_the_world_class_counter; }
#endif //PRODUCT
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册