提交 48071d84 编写于 作者: N never

6741757: minor ctw improvements

Reviewed-by: kvn
上级 4437eeb8
...@@ -1217,7 +1217,8 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1217,7 +1217,8 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
// valid class file. The class loader will check everything else. // valid class file. The class loader will check everything else.
if (strchr(buffer, '.') == NULL) { if (strchr(buffer, '.') == NULL) {
_compile_the_world_counter++; _compile_the_world_counter++;
if (_compile_the_world_counter >= CompileTheWorldStartAt && _compile_the_world_counter <= CompileTheWorldStopAt) { if (_compile_the_world_counter > CompileTheWorldStopAt) return;
// Construct name without extension // Construct name without extension
symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK); symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK);
// Use loader to load and initialize class // Use loader to load and initialize class
...@@ -1228,13 +1229,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1228,13 +1229,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
} }
bool exception_occurred = HAS_PENDING_EXCEPTION; bool exception_occurred = HAS_PENDING_EXCEPTION;
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) { if (CompileTheWorldPreloadClasses && k.not_null()) {
// If something went wrong (e.g. ExceptionInInitializerError) we skip this class
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
} else {
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
// Preload all classes to get around uncommon traps
if (CompileTheWorldPreloadClasses) {
constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD); constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
// If something went wrong in preloading we just ignore it // If something went wrong in preloading we just ignore it
...@@ -1242,6 +1237,14 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1242,6 +1237,14 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer); tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
} }
} }
if (_compile_the_world_counter >= CompileTheWorldStartAt) {
if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) {
// If something went wrong (e.g. ExceptionInInitializerError) we skip this class
tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer);
} else {
tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer);
// Preload all classes to get around uncommon traps
// Iterate over all methods in class // Iterate over all methods in class
for (int n = 0; n < k->methods()->length(); n++) { for (int n = 0; n < k->methods()->length(); n++) {
methodHandle m (THREAD, methodOop(k->methods()->obj_at(n))); methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
...@@ -1255,7 +1258,12 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1255,7 +1258,12 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
} }
if (TieredCompilation) { if (TieredCompilation) {
// Clobber the first compile and force second tier compilation // Clobber the first compile and force second tier compilation
nmethod* nm = m->code();
if (nm != NULL) {
// Throw out the code so that the code cache doesn't fill up
nm->make_not_entrant();
m->clear_code(); m->clear_code();
}
CompileBroker::compile_method(m, InvocationEntryBci, CompileBroker::compile_method(m, InvocationEntryBci,
methodHandle(), 0, "CTW", THREAD); methodHandle(), 0, "CTW", THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
...@@ -1264,6 +1272,13 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { ...@@ -1264,6 +1272,13 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
} }
} }
} }
nmethod* nm = m->code();
if (nm != NULL) {
// Throw out the code so that the code cache doesn't fill up
nm->make_not_entrant();
m->clear_code();
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册