This commit is contained in:
Vladimir Kozlov 2012-09-28 10:16:29 -07:00
commit fbd1f6e3be
138 changed files with 5462 additions and 4473 deletions

View file

@ -197,9 +197,9 @@ class CompilationLog : public StringEventLog {
void log_compile(JavaThread* thread, CompileTask* task) {
StringLogMessage lm;
stringStream msg = lm.stream();
stringStream sstr = lm.stream();
// msg.time_stamp().update_to(tty->time_stamp().ticks());
task->print_compilation(&msg, true);
task->print_compilation(&sstr, NULL, true);
log(thread, "%s", (const char*)lm);
}
@ -491,9 +491,9 @@ void CompileTask::print_inline_indent(int inline_level, outputStream* st) {
// ------------------------------------------------------------------
// CompileTask::print_compilation
void CompileTask::print_compilation(outputStream* st, bool short_form) {
void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form) {
bool is_osr_method = osr_bci() != InvocationEntryBci;
print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), NULL, short_form);
print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form);
}
// ------------------------------------------------------------------
@ -1249,7 +1249,7 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
// We accept a higher level osr method
nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false);
if (nm != NULL) return nm;
if (method->is_not_osr_compilable()) return NULL;
if (method->is_not_osr_compilable(comp_level)) return NULL;
}
assert(!HAS_PENDING_EXCEPTION, "No exception should be present");
@ -1330,7 +1330,7 @@ bool CompileBroker::compilation_is_complete(methodHandle method,
int comp_level) {
bool is_osr = (osr_bci != standard_entry_bci);
if (is_osr) {
if (method->is_not_osr_compilable()) {
if (method->is_not_osr_compilable(comp_level)) {
return true;
} else {
nmethod* result = method->lookup_osr_nmethod_for(osr_bci, comp_level, true);
@ -1381,7 +1381,7 @@ bool CompileBroker::compilation_is_prohibited(methodHandle method, int osr_bci,
// Some compilers may not support on stack replacement.
if (is_osr &&
(!CICompileOSR || !compiler(comp_level)->supports_osr())) {
method->set_not_osr_compilable();
method->set_not_osr_compilable(comp_level);
return true;
}
@ -1807,11 +1807,10 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
_compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
}
if (PrintCompilation) {
tty->print("%4d COMPILE SKIPPED: %s", compile_id, ci_env.failure_reason());
if (retry_message != NULL) {
tty->print(" (%s)", retry_message);
}
tty->cr();
FormatBufferResource msg = retry_message != NULL ?
err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) :
err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason());
task->print_compilation(tty, msg);
}
} else {
task->mark_success();
@ -1840,14 +1839,20 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes());
}
if (compilable == ciEnv::MethodCompilable_never) {
if (is_osr) {
method->set_not_osr_compilable();
} else {
// Disable compilation, if required.
switch (compilable) {
case ciEnv::MethodCompilable_never:
if (is_osr)
method->set_not_osr_compilable_quietly();
else
method->set_not_compilable_quietly();
}
} else if (compilable == ciEnv::MethodCompilable_not_at_tier) {
method->set_not_compilable_quietly(task->comp_level());
break;
case ciEnv::MethodCompilable_not_at_tier:
if (is_osr)
method->set_not_osr_compilable_quietly(task->comp_level());
else
method->set_not_compilable_quietly(task->comp_level());
break;
}
// Note that the queued_for_compilation bits are cleared without

View file

@ -105,7 +105,7 @@ private:
const char* msg = NULL, bool short_form = false);
public:
void print_compilation(outputStream* st = tty, bool short_form = false);
void print_compilation(outputStream* st = tty, const char* msg = NULL, bool short_form = false);
static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false) {
print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,

View file

@ -125,46 +125,46 @@ int CompileLog::identify(ciBaseObject* obj) {
ciMetadata* mobj = obj->as_metadata();
if (mobj->is_klass()) {
ciKlass* klass = mobj->as_klass();
begin_elem("klass id='%d'", id);
name(klass->name());
if (!klass->is_loaded()) {
print(" unloaded='1'");
} else {
print(" flags='%d'", klass->modifier_flags());
}
end_elem();
begin_elem("klass id='%d'", id);
name(klass->name());
if (!klass->is_loaded()) {
print(" unloaded='1'");
} else {
print(" flags='%d'", klass->modifier_flags());
}
end_elem();
} else if (mobj->is_method()) {
ciMethod* method = mobj->as_method();
ciSignature* sig = method->signature();
// Pre-identify items that we will need!
identify(sig->return_type());
for (int i = 0; i < sig->count(); i++) {
identify(sig->type_at(i));
}
begin_elem("method id='%d' holder='%d'",
id, identify(method->holder()));
name(method->name());
print(" return='%d'", identify(sig->return_type()));
if (sig->count() > 0) {
print(" arguments='");
ciSignature* sig = method->signature();
// Pre-identify items that we will need!
identify(sig->return_type());
for (int i = 0; i < sig->count(); i++) {
print((i == 0) ? "%d" : " %d", identify(sig->type_at(i)));
identify(sig->type_at(i));
}
print("'");
}
if (!method->is_loaded()) {
print(" unloaded='1'");
} else {
print(" flags='%d'", (jchar) method->flags().as_int());
// output a few metrics
print(" bytes='%d'", method->code_size());
method->log_nmethod_identity(this);
//print(" count='%d'", method->invocation_count());
//int bec = method->backedge_count();
//if (bec != 0) print(" backedge_count='%d'", bec);
print(" iicount='%d'", method->interpreter_invocation_count());
}
end_elem();
begin_elem("method id='%d' holder='%d'",
id, identify(method->holder()));
name(method->name());
print(" return='%d'", identify(sig->return_type()));
if (sig->count() > 0) {
print(" arguments='");
for (int i = 0; i < sig->count(); i++) {
print((i == 0) ? "%d" : " %d", identify(sig->type_at(i)));
}
print("'");
}
if (!method->is_loaded()) {
print(" unloaded='1'");
} else {
print(" flags='%d'", (jchar) method->flags().as_int());
// output a few metrics
print(" bytes='%d'", method->code_size());
method->log_nmethod_identity(this);
//print(" count='%d'", method->invocation_count());
//int bec = method->backedge_count();
//if (bec != 0) print(" backedge_count='%d'", bec);
print(" iicount='%d'", method->interpreter_invocation_count());
}
end_elem();
} else if (mobj->is_type()) {
BasicType type = mobj->as_type()->basic_type();
elem("type id='%d' name='%s'", id, type2name(type));

View file

@ -148,6 +148,7 @@ class decode_env {
private:
nmethod* _nm;
CodeBlob* _code;
CodeComments _comments;
outputStream* _output;
address _start, _end;
@ -187,7 +188,7 @@ class decode_env {
void print_address(address value);
public:
decode_env(CodeBlob* code, outputStream* output);
decode_env(CodeBlob* code, outputStream* output, CodeComments c = CodeComments());
address decode_instructions(address start, address end);
@ -231,12 +232,13 @@ class decode_env {
const char* options() { return _option_buf; }
};
decode_env::decode_env(CodeBlob* code, outputStream* output) {
decode_env::decode_env(CodeBlob* code, outputStream* output, CodeComments c) {
memset(this, 0, sizeof(*this));
_output = output ? output : tty;
_code = code;
if (code != NULL && code->is_nmethod())
_nm = (nmethod*) code;
_comments.assign(c);
// by default, output pc but not bytes:
_print_pc = true;
@ -358,6 +360,7 @@ void decode_env::print_insn_labels() {
if (cb != NULL) {
cb->print_block_comment(st, p);
}
_comments.print_block_comment(st, (intptr_t)(p - _start));
if (_print_pc) {
st->print(" " PTR_FORMAT ": ", p);
}
@ -471,10 +474,9 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) {
env.decode_instructions(cb->code_begin(), cb->code_end());
}
void Disassembler::decode(address start, address end, outputStream* st) {
void Disassembler::decode(address start, address end, outputStream* st, CodeComments c) {
if (!load_library()) return;
decode_env env(CodeCache::find_blob_unsafe(start), st);
decode_env env(CodeCache::find_blob_unsafe(start), st, c);
env.decode_instructions(start, end);
}

View file

@ -25,6 +25,7 @@
#ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP
#define SHARE_VM_COMPILER_DISASSEMBLER_HPP
#include "asm/codeBuffer.hpp"
#include "runtime/globals.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "os_linux.inline.hpp"
@ -88,7 +89,7 @@ class Disassembler {
}
static void decode(CodeBlob *cb, outputStream* st = NULL);
static void decode(nmethod* nm, outputStream* st = NULL);
static void decode(address begin, address end, outputStream* st = NULL);
static void decode(address begin, address end, outputStream* st = NULL, CodeComments c = CodeComments());
};
#endif // SHARE_VM_COMPILER_DISASSEMBLER_HPP