8180654: Apply UL to PrintCodeCacheOnCompilation

Reviewed-by: kvn
This commit is contained in:
Chihiro Ito 2017-05-22 09:07:16 -07:00 committed by Vladimir Kozlov
parent 8bda8fc602
commit 7d85a92ef0

View File

@ -1726,6 +1726,31 @@ static void codecache_print(bool detailed)
tty->print("%s", s.as_string());
}
// wrapper for CodeCache::print_summary() using outputStream
static void codecache_print(outputStream* out, bool detailed) {
ResourceMark rm;
stringStream s;
// Dump code cache into a buffer
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CodeCache::print_summary(&s, detailed);
}
char* remaining_log = s.as_string();
while (*remaining_log != '\0') {
char* eol = strchr(remaining_log, '\n');
if (eol == NULL) {
out->print_cr("%s", remaining_log);
remaining_log = remaining_log + strlen(remaining_log);
} else {
*eol = '\0';
out->print_cr("%s", remaining_log);
remaining_log = eol + 1;
}
}
}
void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env) {
if (success) {
@ -1939,9 +1964,13 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes());
}
if (PrintCodeCacheOnCompilation)
Log(compilation, codecache) log;
if (log.is_debug()) {
codecache_print(log.debug_stream(), /* detailed= */ false);
}
if (PrintCodeCacheOnCompilation) {
codecache_print(/* detailed= */ false);
}
// Disable compilation, if required.
switch (compilable) {
case ciEnv::MethodCompilable_never: