提交 133e6c1f 编写于 作者: J jrose

Merge

...@@ -204,7 +204,8 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { ...@@ -204,7 +204,8 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
virtual void print_value_on(outputStream* st) const PRODUCT_RETURN; virtual void print_value_on(outputStream* st) const PRODUCT_RETURN;
// Print the comment associated with offset on stream, if there is one // Print the comment associated with offset on stream, if there is one
void print_block_comment(outputStream* stream, intptr_t offset) { virtual void print_block_comment(outputStream* stream, address block_begin) {
intptr_t offset = (intptr_t)(block_begin - instructions_begin());
_comments.print_block_comment(stream, offset); _comments.print_block_comment(stream, offset);
} }
......
...@@ -56,13 +56,13 @@ HS_DTRACE_PROBE_DECL6(hotspot, compiled__method__unload, ...@@ -56,13 +56,13 @@ HS_DTRACE_PROBE_DECL6(hotspot, compiled__method__unload,
#endif #endif
bool nmethod::is_compiled_by_c1() const { bool nmethod::is_compiled_by_c1() const {
if (compiler() == NULL || method() == NULL) return false; // can happen during debug printing
if (is_native_method()) return false; if (is_native_method()) return false;
assert(compiler() != NULL, "must be");
return compiler()->is_c1(); return compiler()->is_c1();
} }
bool nmethod::is_compiled_by_c2() const { bool nmethod::is_compiled_by_c2() const {
if (compiler() == NULL || method() == NULL) return false; // can happen during debug printing
if (is_native_method()) return false; if (is_native_method()) return false;
assert(compiler() != NULL, "must be");
return compiler()->is_c2(); return compiler()->is_c2();
} }
...@@ -2399,6 +2399,107 @@ ScopeDesc* nmethod::scope_desc_in(address begin, address end) { ...@@ -2399,6 +2399,107 @@ ScopeDesc* nmethod::scope_desc_in(address begin, address end) {
return NULL; return NULL;
} }
void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) {
if (block_begin == entry_point()) stream->print_cr("[Entry Point]");
if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]");
if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
if (block_begin == consts_begin()) stream->print_cr("[Constants]");
if (block_begin == entry_point()) {
methodHandle m = method();
if (m.not_null()) {
stream->print(" # ");
m->print_value_on(stream);
stream->cr();
}
if (m.not_null() && !is_osr_method()) {
ResourceMark rm;
int sizeargs = m->size_of_parameters();
BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, sizeargs);
VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, sizeargs);
{
int sig_index = 0;
if (!m->is_static())
sig_bt[sig_index++] = T_OBJECT; // 'this'
for (SignatureStream ss(m->signature()); !ss.at_return_type(); ss.next()) {
BasicType t = ss.type();
sig_bt[sig_index++] = t;
if (type2size[t] == 2) {
sig_bt[sig_index++] = T_VOID;
} else {
assert(type2size[t] == 1, "size is 1 or 2");
}
}
assert(sig_index == sizeargs, "");
}
const char* spname = "sp"; // make arch-specific?
intptr_t out_preserve = SharedRuntime::java_calling_convention(sig_bt, regs, sizeargs, false);
int stack_slot_offset = this->frame_size() * wordSize;
int tab1 = 14, tab2 = 24;
int sig_index = 0;
int arg_index = (m->is_static() ? 0 : -1);
bool did_old_sp = false;
for (SignatureStream ss(m->signature()); !ss.at_return_type(); ) {
bool at_this = (arg_index == -1);
bool at_old_sp = false;
BasicType t = (at_this ? T_OBJECT : ss.type());
assert(t == sig_bt[sig_index], "sigs in sync");
if (at_this)
stream->print(" # this: ");
else
stream->print(" # parm%d: ", arg_index);
stream->move_to(tab1);
VMReg fst = regs[sig_index].first();
VMReg snd = regs[sig_index].second();
if (fst->is_reg()) {
stream->print("%s", fst->name());
if (snd->is_valid()) {
stream->print(":%s", snd->name());
}
} else if (fst->is_stack()) {
int offset = fst->reg2stack() * VMRegImpl::stack_slot_size + stack_slot_offset;
if (offset == stack_slot_offset) at_old_sp = true;
stream->print("[%s+0x%x]", spname, offset);
} else {
stream->print("reg%d:%d??", (int)(intptr_t)fst, (int)(intptr_t)snd);
}
stream->print(" ");
stream->move_to(tab2);
stream->print("= ");
if (at_this) {
m->method_holder()->print_value_on(stream);
} else {
bool did_name = false;
if (!at_this && ss.is_object()) {
symbolOop name = ss.as_symbol_or_null();
if (name != NULL) {
name->print_value_on(stream);
did_name = true;
}
}
if (!did_name)
stream->print("%s", type2name(t));
}
if (at_old_sp) {
stream->print(" (%s of caller)", spname);
did_old_sp = true;
}
stream->cr();
sig_index += type2size[t];
arg_index += 1;
if (!at_this) ss.next();
}
if (!did_old_sp) {
stream->print(" # ");
stream->move_to(tab1);
stream->print("[%s+0x%x]", spname, stack_slot_offset);
stream->print(" (%s of caller)", spname);
stream->cr();
}
}
}
}
void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin, u_char* end) { void nmethod::print_code_comment_on(outputStream* st, int column, u_char* begin, u_char* end) {
// First, find an oopmap in (begin, end]. // First, find an oopmap in (begin, end].
// We use the odd half-closed interval so that oop maps and scope descs // We use the odd half-closed interval so that oop maps and scope descs
......
...@@ -576,6 +576,13 @@ class nmethod : public CodeBlob { ...@@ -576,6 +576,13 @@ class nmethod : public CodeBlob {
void log_new_nmethod() const; void log_new_nmethod() const;
void log_state_change() const; void log_state_change() const;
// Prints block-level comments, including nmethod specific block labels:
virtual void print_block_comment(outputStream* stream, address block_begin) {
print_nmethod_labels(stream, block_begin);
CodeBlob::print_block_comment(stream, block_begin);
}
void print_nmethod_labels(outputStream* stream, address block_begin);
// Prints a comment for one native instruction (reloc info, pc desc) // Prints a comment for one native instruction (reloc info, pc desc)
void print_code_comment_on(outputStream* st, int column, address begin, address end); void print_code_comment_on(outputStream* st, int column, address begin, address end);
static void print_statistics() PRODUCT_RETURN; static void print_statistics() PRODUCT_RETURN;
......
...@@ -392,18 +392,18 @@ static const char* patterns[] = { ...@@ -392,18 +392,18 @@ static const char* patterns[] = {
}; };
static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) { static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
if (strcmp(name, "*") == 0) return MethodMatcher::Any;
int match = MethodMatcher::Exact; int match = MethodMatcher::Exact;
if (name[0] == '*') { while (name[0] == '*') {
match |= MethodMatcher::Suffix; match |= MethodMatcher::Suffix;
strcpy(name, name + 1); strcpy(name, name + 1);
} }
if (strcmp(name, "*") == 0) return MethodMatcher::Any;
size_t len = strlen(name); size_t len = strlen(name);
if (len > 0 && name[len - 1] == '*') { while (len > 0 && name[len - 1] == '*') {
match |= MethodMatcher::Prefix; match |= MethodMatcher::Prefix;
name[len - 1] = '\0'; name[--len] = '\0';
} }
if (strstr(name, "*") != NULL) { if (strstr(name, "*") != NULL) {
...@@ -610,6 +610,14 @@ void compilerOracle_init() { ...@@ -610,6 +610,14 @@ void compilerOracle_init() {
CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
CompilerOracle::parse_from_file(); CompilerOracle::parse_from_file();
if (lists[PrintCommand] != NULL) {
if (PrintAssembly) {
warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");
} else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
DebugNonSafepoints = true;
}
}
} }
......
...@@ -151,8 +151,10 @@ class decode_env { ...@@ -151,8 +151,10 @@ class decode_env {
outputStream* st = output(); outputStream* st = output();
if (_print_bytes && pc > pc0) if (_print_bytes && pc > pc0)
print_insn_bytes(pc0, pc); print_insn_bytes(pc0, pc);
if (_nm != NULL) if (_nm != NULL) {
_nm->print_code_comment_on(st, COMMENT_COLUMN, pc0, pc); _nm->print_code_comment_on(st, COMMENT_COLUMN, pc0, pc);
// this calls reloc_string_for which calls oop::print_value_on
}
// Output pc bucket ticks if we have any // Output pc bucket ticks if we have any
if (total_ticks() != 0) { if (total_ticks() != 0) {
...@@ -273,8 +275,15 @@ void decode_env::print_address(address adr) { ...@@ -273,8 +275,15 @@ void decode_env::print_address(address adr) {
oop obj; oop obj;
if (_nm != NULL if (_nm != NULL
&& (obj = _nm->embeddedOop_at(cur_insn())) != NULL && (obj = _nm->embeddedOop_at(cur_insn())) != NULL
&& (address) obj == adr) { && (address) obj == adr
&& Universe::heap()->is_in(obj)
&& Universe::heap()->is_in(obj->klass())) {
julong c = st->count();
obj->print_value_on(st); obj->print_value_on(st);
if (st->count() == c) {
// No output. (Can happen in product builds.)
st->print("(a %s)", Klass::cast(obj->klass())->external_name());
}
return; return;
} }
} }
...@@ -286,17 +295,9 @@ void decode_env::print_address(address adr) { ...@@ -286,17 +295,9 @@ void decode_env::print_address(address adr) {
void decode_env::print_insn_labels() { void decode_env::print_insn_labels() {
address p = cur_insn(); address p = cur_insn();
outputStream* st = output(); outputStream* st = output();
nmethod* nm = _nm;
if (nm != NULL) {
if (p == nm->entry_point()) st->print_cr("[Entry Point]");
if (p == nm->verified_entry_point()) st->print_cr("[Verified Entry Point]");
if (p == nm->exception_begin()) st->print_cr("[Exception Handler]");
if (p == nm->stub_begin()) st->print_cr("[Stub Code]");
if (p == nm->consts_begin()) st->print_cr("[Constants]");
}
CodeBlob* cb = _code; CodeBlob* cb = _code;
if (cb != NULL) { if (cb != NULL) {
cb->print_block_comment(st, (intptr_t)(p - cb->instructions_begin())); cb->print_block_comment(st, p);
} }
if (_print_pc) { if (_print_pc) {
st->print(" " INTPTR_FORMAT ": ", (intptr_t) p); st->print(" " INTPTR_FORMAT ": ", (intptr_t) p);
......
...@@ -1525,6 +1525,7 @@ disassembler.cpp disassembler.hpp ...@@ -1525,6 +1525,7 @@ disassembler.cpp disassembler.hpp
disassembler.cpp fprofiler.hpp disassembler.cpp fprofiler.hpp
disassembler.cpp handles.inline.hpp disassembler.cpp handles.inline.hpp
disassembler.cpp hpi.hpp disassembler.cpp hpi.hpp
disassembler.cpp javaClasses.hpp
disassembler.cpp stubCodeGenerator.hpp disassembler.cpp stubCodeGenerator.hpp
disassembler.cpp stubRoutines.hpp disassembler.cpp stubRoutines.hpp
......
...@@ -925,6 +925,8 @@ bool GenCollectedHeap::is_in(const void* p) const { ...@@ -925,6 +925,8 @@ bool GenCollectedHeap::is_in(const void* p) const {
guarantee(VerifyBeforeGC || guarantee(VerifyBeforeGC ||
VerifyDuringGC || VerifyDuringGC ||
VerifyBeforeExit || VerifyBeforeExit ||
PrintAssembly ||
tty->count() != 0 || // already printing
VerifyAfterGC, "too expensive"); VerifyAfterGC, "too expensive");
#endif #endif
// This might be sped up with a cache of the last generation that // This might be sped up with a cache of the last generation that
......
...@@ -159,7 +159,7 @@ void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -159,7 +159,7 @@ void arrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass"); assert(obj->is_klass(), "must be klass");
klassKlass::oop_print_on(obj, st); klassKlass::oop_print_on(obj, st);
} }
#endif //PRODUCT
void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass"); assert(obj->is_klass(), "must be klass");
...@@ -168,7 +168,6 @@ void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -168,7 +168,6 @@ void arrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("[]"); st->print("[]");
} }
} }
#endif
const char* arrayKlassKlass::internal_name() const { const char* arrayKlassKlass::internal_name() const {
......
...@@ -55,14 +55,13 @@ class arrayKlassKlass : public klassKlass { ...@@ -55,14 +55,13 @@ class arrayKlassKlass : public klassKlass {
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on(oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -166,12 +166,12 @@ void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -166,12 +166,12 @@ void compiledICHolderKlass::oop_print_on(oop obj, outputStream* st) {
st->print(" - klass: "); c->holder_klass()->print_value_on(st); st->cr(); st->print(" - klass: "); c->holder_klass()->print_value_on(st); st->cr();
} }
#endif //PRODUCT
void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) { void compiledICHolderKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_compiledICHolder(), "must be compiledICHolder"); assert(obj->is_compiledICHolder(), "must be compiledICHolder");
Klass::oop_print_value_on(obj, st); Klass::oop_print_value_on(obj, st);
} }
#endif
const char* compiledICHolderKlass::internal_name() const { const char* compiledICHolderKlass::internal_name() const {
return "{compiledICHolder}"; return "{compiledICHolder}";
......
...@@ -68,14 +68,13 @@ class compiledICHolderKlass : public Klass { ...@@ -68,14 +68,13 @@ class compiledICHolderKlass : public Klass {
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -216,6 +216,7 @@ void constMethodKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -216,6 +216,7 @@ void constMethodKlass::oop_print_on(oop obj, outputStream* st) {
} }
} }
#endif //PRODUCT
// Short version of printing constMethodOop - just print the name of the // Short version of printing constMethodOop - just print the name of the
// method it belongs to. // method it belongs to.
...@@ -226,8 +227,6 @@ void constMethodKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -226,8 +227,6 @@ void constMethodKlass::oop_print_value_on(oop obj, outputStream* st) {
m->method()->print_value_on(st); m->method()->print_value_on(st);
} }
#endif // PRODUCT
const char* constMethodKlass::internal_name() const { const char* constMethodKlass::internal_name() const {
return "{constMethod}"; return "{constMethod}";
} }
......
...@@ -77,15 +77,13 @@ public: ...@@ -77,15 +77,13 @@ public:
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
#endif
public:
// Verify operations // Verify operations
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -387,9 +387,19 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -387,9 +387,19 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) {
cp->set_cache(cache()); cp->set_cache(cache());
} }
#endif #endif
void constantPoolKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_constantPool(), "must be constantPool");
constantPoolOop cp = constantPoolOop(obj);
st->print("constant pool [%d]", cp->length());
if (cp->has_pseudo_string()) st->print("/pseudo_string");
if (cp->has_invokedynamic()) st->print("/invokedynamic");
cp->print_address_on(st);
st->print(" for ");
cp->pool_holder()->print_value_on(st);
}
const char* constantPoolKlass::internal_name() const { const char* constantPoolKlass::internal_name() const {
return "{constant pool}"; return "{constant pool}";
} }
......
...@@ -65,9 +65,10 @@ class constantPoolKlass : public Klass { ...@@ -65,9 +65,10 @@ class constantPoolKlass : public Klass {
juint alloc_size() const { return _alloc_size; } juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; } void set_alloc_size(juint n) { _alloc_size = n; }
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st); void oop_print_on(oop obj, outputStream* st);
#endif #endif
......
...@@ -261,6 +261,15 @@ void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -261,6 +261,15 @@ void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
#endif #endif
void constantPoolCacheKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
constantPoolCacheOop cache = (constantPoolCacheOop)obj;
st->print("cache [%d]", cache->length());
cache->print_address_on(st);
st->print(" for ");
cache->constant_pool()->print_value_on(st);
}
void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) { void constantPoolCacheKlass::oop_verify_on(oop obj, outputStream* st) {
guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache"); guarantee(obj->is_constantPoolCache(), "obj must be constant pool cache");
constantPoolCacheOop cache = (constantPoolCacheOop)obj; constantPoolCacheOop cache = (constantPoolCacheOop)obj;
......
...@@ -61,9 +61,10 @@ class constantPoolCacheKlass: public Klass { ...@@ -61,9 +61,10 @@ class constantPoolCacheKlass: public Klass {
juint alloc_size() const { return _alloc_size; } juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; } void set_alloc_size(juint n) { _alloc_size = n; }
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st); void oop_print_on(oop obj, outputStream* st);
#endif #endif
......
...@@ -2268,6 +2268,8 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -2268,6 +2268,8 @@ void instanceKlass::oop_print_on(oop obj, outputStream* st) {
} }
} }
#endif //PRODUCT
void instanceKlass::oop_print_value_on(oop obj, outputStream* st) { void instanceKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("a "); st->print("a ");
name()->print_value_on(st); name()->print_value_on(st);
...@@ -2299,8 +2301,6 @@ void instanceKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -2299,8 +2301,6 @@ void instanceKlass::oop_print_value_on(oop obj, outputStream* st) {
} }
} }
#endif // ndef PRODUCT
const char* instanceKlass::internal_name() const { const char* instanceKlass::internal_name() const {
return external_name(); return external_name();
} }
......
...@@ -839,17 +839,16 @@ public: ...@@ -839,17 +839,16 @@ public:
// JVMTI support // JVMTI support
jint jvmti_class_status() const; jint jvmti_class_status() const;
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
void print_dependent_nmethods(bool verbose = false); void print_dependent_nmethods(bool verbose = false);
bool is_dependent_nmethod(nmethod* nm); bool is_dependent_nmethod(nmethod* nm);
#endif #endif
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -638,6 +638,7 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -638,6 +638,7 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) {
st->cr(); st->cr();
} }
#endif //PRODUCT
void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) { void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass"); assert(obj->is_klass(), "must be klass");
...@@ -645,8 +646,6 @@ void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -645,8 +646,6 @@ void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
ik->name()->print_value_on(st); ik->name()->print_value_on(st);
} }
#endif // PRODUCT
const char* instanceKlassKlass::internal_name() const { const char* instanceKlassKlass::internal_name() const {
return "{instance class}"; return "{instance class}";
} }
......
...@@ -69,14 +69,13 @@ private: ...@@ -69,14 +69,13 @@ private:
// Apply closure to the InstanceKlass oops that are outside the java heap. // Apply closure to the InstanceKlass oops that are outside the java heap.
inline void iterate_c_heap_oops(instanceKlass* ik, OopClosure* closure); inline void iterate_c_heap_oops(instanceKlass* ik, OopClosure* closure);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on(oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif #endif
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -541,6 +541,7 @@ void Klass::oop_print_on(oop obj, outputStream* st) { ...@@ -541,6 +541,7 @@ void Klass::oop_print_on(oop obj, outputStream* st) {
st->cr(); st->cr();
} }
#endif //PRODUCT
void Klass::oop_print_value_on(oop obj, outputStream* st) { void Klass::oop_print_value_on(oop obj, outputStream* st) {
// print title // print title
...@@ -549,8 +550,6 @@ void Klass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -549,8 +550,6 @@ void Klass::oop_print_value_on(oop obj, outputStream* st) {
obj->print_address_on(st); obj->print_address_on(st);
} }
#endif
// Verification // Verification
void Klass::oop_verify_on(oop obj, outputStream* st) { void Klass::oop_verify_on(oop obj, outputStream* st) {
......
...@@ -776,14 +776,13 @@ class Klass : public Klass_vtbl { ...@@ -776,14 +776,13 @@ class Klass : public Klass_vtbl {
// JVMTI support // JVMTI support
virtual jint jvmti_class_status() const; virtual jint jvmti_class_status() const;
#ifndef PRODUCT
public: public:
// Printing // Printing
virtual void oop_print_on (oop obj, outputStream* st);
virtual void oop_print_value_on(oop obj, outputStream* st); virtual void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
virtual void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
virtual const char* internal_name() const = 0; virtual const char* internal_name() const = 0;
virtual void oop_verify_on(oop obj, outputStream* st); virtual void oop_verify_on(oop obj, outputStream* st);
......
...@@ -202,13 +202,12 @@ void klassKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -202,13 +202,12 @@ void klassKlass::oop_print_on(oop obj, outputStream* st) {
Klass::oop_print_on(obj, st); Klass::oop_print_on(obj, st);
} }
#endif //PRODUCT
void klassKlass::oop_print_value_on(oop obj, outputStream* st) { void klassKlass::oop_print_value_on(oop obj, outputStream* st) {
Klass::oop_print_value_on(obj, st); Klass::oop_print_value_on(obj, st);
} }
#endif
const char* klassKlass::internal_name() const { const char* klassKlass::internal_name() const {
return "{other class}"; return "{other class}";
} }
......
...@@ -67,14 +67,13 @@ class klassKlass: public Klass { ...@@ -67,14 +67,13 @@ class klassKlass: public Klass {
juint alloc_size() const { return _alloc_size; } juint alloc_size() const { return _alloc_size; }
void set_alloc_size(juint n) { _alloc_size = n; } void set_alloc_size(juint n) { _alloc_size = n; }
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -214,6 +214,8 @@ void methodDataKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -214,6 +214,8 @@ void methodDataKlass::oop_print_on(oop obj, outputStream* st) {
m->print_data_on(st); m->print_data_on(st);
} }
#endif //PRODUCT
void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) { void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_methodData(), "should be method data"); assert(obj->is_methodData(), "should be method data");
methodDataOop m = methodDataOop(obj); methodDataOop m = methodDataOop(obj);
...@@ -221,8 +223,6 @@ void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -221,8 +223,6 @@ void methodDataKlass::oop_print_value_on(oop obj, outputStream* st) {
m->method()->print_value_on(st); m->method()->print_value_on(st);
} }
#endif // !PRODUCT
const char* methodDataKlass::internal_name() const { const char* methodDataKlass::internal_name() const {
return "{method data}"; return "{method data}";
} }
......
...@@ -71,14 +71,13 @@ class methodDataKlass : public Klass { ...@@ -71,14 +71,13 @@ class methodDataKlass : public Klass {
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif // !PRODUCT #ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verify operations // Verify operations
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -308,6 +308,7 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -308,6 +308,7 @@ void methodKlass::oop_print_on(oop obj, outputStream* st) {
} }
} }
#endif //PRODUCT
void methodKlass::oop_print_value_on(oop obj, outputStream* st) { void methodKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_method(), "must be method"); assert(obj->is_method(), "must be method");
...@@ -323,8 +324,6 @@ void methodKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -323,8 +324,6 @@ void methodKlass::oop_print_value_on(oop obj, outputStream* st) {
if (WizardMode && m->code() != NULL) st->print(" ((nmethod*)%p)", m->code()); if (WizardMode && m->code() != NULL) st->print(" ((nmethod*)%p)", m->code());
} }
#endif // PRODUCT
const char* methodKlass::internal_name() const { const char* methodKlass::internal_name() const {
return "{method}"; return "{method}";
} }
......
...@@ -68,14 +68,13 @@ class methodKlass : public Klass { ...@@ -68,14 +68,13 @@ class methodKlass : public Klass {
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verify operations // Verify operations
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -499,6 +499,8 @@ void objArrayKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -499,6 +499,8 @@ void objArrayKlass::oop_print_on(oop obj, outputStream* st) {
} }
} }
#endif //PRODUCT
static int max_objArray_print_length = 4; static int max_objArray_print_length = 4;
void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) {
...@@ -508,7 +510,7 @@ void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -508,7 +510,7 @@ void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) {
int len = objArrayOop(obj)->length(); int len = objArrayOop(obj)->length();
st->print("[%d] ", len); st->print("[%d] ", len);
obj->print_address_on(st); obj->print_address_on(st);
if (PrintOopAddress || PrintMiscellaneous && (WizardMode || Verbose)) { if (NOT_PRODUCT(PrintOopAddress ||) PrintMiscellaneous && (WizardMode || Verbose)) {
st->print("{"); st->print("{");
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
if (i > max_objArray_print_length) { if (i > max_objArray_print_length) {
...@@ -520,8 +522,6 @@ void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -520,8 +522,6 @@ void objArrayKlass::oop_print_value_on(oop obj, outputStream* st) {
} }
} }
#endif // PRODUCT
const char* objArrayKlass::internal_name() const { const char* objArrayKlass::internal_name() const {
return external_name(); return external_name();
} }
......
...@@ -119,14 +119,13 @@ class objArrayKlass : public arrayKlass { ...@@ -119,14 +119,13 @@ class objArrayKlass : public arrayKlass {
private: private:
static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS); static klassOop array_klass_impl (objArrayKlassHandle this_oop, bool or_null, int n, TRAPS);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on (oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on (oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -278,6 +278,7 @@ void objArrayKlassKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -278,6 +278,7 @@ void objArrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
st->cr(); st->cr();
} }
#endif //PRODUCT
void objArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { void objArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass"); assert(obj->is_klass(), "must be klass");
...@@ -287,8 +288,6 @@ void objArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -287,8 +288,6 @@ void objArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("[]"); st->print("[]");
} }
#endif
const char* objArrayKlassKlass::internal_name() const { const char* objArrayKlassKlass::internal_name() const {
return "{object array class}"; return "{object array class}";
} }
......
...@@ -64,14 +64,13 @@ class objArrayKlassKlass : public arrayKlassKlass { ...@@ -64,14 +64,13 @@ class objArrayKlassKlass : public arrayKlassKlass {
// helpers // helpers
static klassOop allocate_objArray_klass_impl(objArrayKlassKlassHandle this_oop, int n, KlassHandle element_klass, TRAPS); static klassOop allocate_objArray_klass_impl(objArrayKlassKlassHandle this_oop, int n, KlassHandle element_klass, TRAPS);
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on(oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st);
#endif //PRODUCT
public:
// Verification // Verification
const char* internal_name() const; const char* internal_name() const;
void oop_verify_on(oop obj, outputStream* st); void oop_verify_on(oop obj, outputStream* st);
......
...@@ -31,14 +31,13 @@ BarrierSet* oopDesc::_bs = NULL; ...@@ -31,14 +31,13 @@ BarrierSet* oopDesc::_bs = NULL;
#ifdef PRODUCT #ifdef PRODUCT
void oopDesc::print_on(outputStream* st) const {} void oopDesc::print_on(outputStream* st) const {}
void oopDesc::print_value_on(outputStream* st) const {}
void oopDesc::print_address_on(outputStream* st) const {} void oopDesc::print_address_on(outputStream* st) const {}
char* oopDesc::print_value_string() { return NULL; }
char* oopDesc::print_string() { return NULL; } char* oopDesc::print_string() { return NULL; }
void oopDesc::print() {} void oopDesc::print() {}
void oopDesc::print_value() {}
void oopDesc::print_address() {} void oopDesc::print_address() {}
#else
#else //PRODUCT
void oopDesc::print_on(outputStream* st) const { void oopDesc::print_on(outputStream* st) const {
if (this == NULL) { if (this == NULL) {
st->print_cr("NULL"); st->print_cr("NULL");
...@@ -47,22 +46,6 @@ void oopDesc::print_on(outputStream* st) const { ...@@ -47,22 +46,6 @@ void oopDesc::print_on(outputStream* st) const {
} }
} }
void oopDesc::print_value_on(outputStream* st) const {
oop obj = oop(this);
if (this == NULL) {
st->print("NULL");
} else if (java_lang_String::is_instance(obj)) {
java_lang_String::print(obj, st);
if (PrintOopAddress) print_address_on(st);
#ifdef ASSERT
} else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
st->print("### BAD OOP %p ###", (address)obj);
#endif
} else {
blueprint()->oop_print_value_on(obj, st);
}
}
void oopDesc::print_address_on(outputStream* st) const { void oopDesc::print_address_on(outputStream* st) const {
if (PrintOopAddress) { if (PrintOopAddress) {
st->print("{"INTPTR_FORMAT"}", this); st->print("{"INTPTR_FORMAT"}", this);
...@@ -71,23 +54,47 @@ void oopDesc::print_address_on(outputStream* st) const { ...@@ -71,23 +54,47 @@ void oopDesc::print_address_on(outputStream* st) const {
void oopDesc::print() { print_on(tty); } void oopDesc::print() { print_on(tty); }
void oopDesc::print_value() { print_value_on(tty); }
void oopDesc::print_address() { print_address_on(tty); } void oopDesc::print_address() { print_address_on(tty); }
char* oopDesc::print_string() { char* oopDesc::print_string() {
stringStream* st = new stringStream(); stringStream st;
print_on(st); print_on(&st);
return st->as_string(); return st.as_string();
}
#endif // PRODUCT
// The print_value functions are present in all builds, to support the disassembler.
void oopDesc::print_value() {
print_value_on(tty);
} }
char* oopDesc::print_value_string() { char* oopDesc::print_value_string() {
stringStream* st = new stringStream(); char buf[100];
print_value_on(st); stringStream st(buf, sizeof(buf));
return st->as_string(); print_value_on(&st);
return st.as_string();
}
void oopDesc::print_value_on(outputStream* st) const {
oop obj = oop(this);
if (this == NULL) {
st->print("NULL");
} else if (java_lang_String::is_instance(obj)) {
java_lang_String::print(obj, st);
#ifndef PRODUCT
if (PrintOopAddress) print_address_on(st);
#endif //PRODUCT
#ifdef ASSERT
} else if (!Universe::heap()->is_in(obj) || !Universe::heap()->is_in(klass())) {
st->print("### BAD OOP %p ###", (address)obj);
#endif //ASSERT
} else {
blueprint()->oop_print_value_on(obj, st);
}
} }
#endif // PRODUCT
void oopDesc::verify_on(outputStream* st) { void oopDesc::verify_on(outputStream* st) {
if (this != NULL) { if (this != NULL) {
......
...@@ -213,6 +213,8 @@ void symbolKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -213,6 +213,8 @@ void symbolKlass::oop_print_on(oop obj, outputStream* st) {
st->print("'"); st->print("'");
} }
#endif //PRODUCT
void symbolKlass::oop_print_value_on(oop obj, outputStream* st) { void symbolKlass::oop_print_value_on(oop obj, outputStream* st) {
symbolOop sym = symbolOop(obj); symbolOop sym = symbolOop(obj);
st->print("'"); st->print("'");
...@@ -222,8 +224,6 @@ void symbolKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -222,8 +224,6 @@ void symbolKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("'"); st->print("'");
} }
#endif //PRODUCT
const char* symbolKlass::internal_name() const { const char* symbolKlass::internal_name() const {
return "{symbol}"; return "{symbol}";
} }
...@@ -65,10 +65,10 @@ class symbolKlass : public Klass { ...@@ -65,10 +65,10 @@ class symbolKlass : public Klass {
int oop_oop_iterate(oop obj, OopClosure* blk); int oop_oop_iterate(oop obj, OopClosure* blk);
int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr); int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr);
#ifndef PRODUCT
// Printing // Printing
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#ifndef PRODUCT
void oop_print_on(oop obj, outputStream* st); void oop_print_on(oop obj, outputStream* st);
#endif #endif //PRODUCT
const char* internal_name() const; const char* internal_name() const;
}; };
...@@ -45,6 +45,7 @@ void typeArrayKlassKlass::oop_print_on(oop obj, outputStream* st) { ...@@ -45,6 +45,7 @@ void typeArrayKlassKlass::oop_print_on(oop obj, outputStream* st) {
Klass:: oop_print_on(obj, st); Klass:: oop_print_on(obj, st);
} }
#endif //PRODUCT
void typeArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { void typeArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
assert(obj->is_klass(), "must be klass"); assert(obj->is_klass(), "must be klass");
...@@ -63,8 +64,6 @@ void typeArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) { ...@@ -63,8 +64,6 @@ void typeArrayKlassKlass::oop_print_value_on(oop obj, outputStream* st) {
st->print("}"); st->print("}");
} }
#endif
const char* typeArrayKlassKlass::internal_name() const { const char* typeArrayKlassKlass::internal_name() const {
return "{type array class}"; return "{type array class}";
} }
...@@ -47,12 +47,12 @@ class typeArrayKlassKlass : public arrayKlassKlass { ...@@ -47,12 +47,12 @@ class typeArrayKlassKlass : public arrayKlassKlass {
static int header_size() { return oopDesc::header_size() + sizeof(typeArrayKlassKlass)/HeapWordSize; } static int header_size() { return oopDesc::header_size() + sizeof(typeArrayKlassKlass)/HeapWordSize; }
int object_size() const { return align_object_size(header_size()); } int object_size() const { return align_object_size(header_size()); }
#ifndef PRODUCT
public: public:
// Printing // Printing
void oop_print_on(oop obj, outputStream* st);
void oop_print_value_on(oop obj, outputStream* st); void oop_print_value_on(oop obj, outputStream* st);
#endif #ifndef PRODUCT
public: void oop_print_on(oop obj, outputStream* st);
#endif //PRODUCT
const char* internal_name() const; const char* internal_name() const;
}; };
...@@ -27,11 +27,16 @@ ...@@ -27,11 +27,16 @@
//============================================================================= //=============================================================================
//------------------------------InlineTree------------------------------------- //------------------------------InlineTree-------------------------------------
InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* callee, JVMState* caller_jvms, int caller_bci, float site_invoke_ratio ) InlineTree::InlineTree( Compile* c,
const InlineTree *caller_tree, ciMethod* callee,
JVMState* caller_jvms, int caller_bci,
float site_invoke_ratio, int site_depth_adjust)
: C(c), _caller_jvms(caller_jvms), : C(c), _caller_jvms(caller_jvms),
_caller_tree((InlineTree*)caller_tree), _caller_tree((InlineTree*)caller_tree),
_method(callee), _site_invoke_ratio(site_invoke_ratio), _method(callee), _site_invoke_ratio(site_invoke_ratio),
_count_inline_bcs(method()->code_size()) { _site_depth_adjust(site_depth_adjust),
_count_inline_bcs(method()->code_size())
{
NOT_PRODUCT(_count_inlines = 0;) NOT_PRODUCT(_count_inlines = 0;)
if (_caller_jvms != NULL) { if (_caller_jvms != NULL) {
// Keep a private copy of the caller_jvms: // Keep a private copy of the caller_jvms:
...@@ -40,7 +45,7 @@ InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* cal ...@@ -40,7 +45,7 @@ InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* cal
assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining"); assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
} }
assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS"); assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
assert((caller_tree == NULL ? 0 : caller_tree->inline_depth() + 1) == inline_depth(), "correct (redundant) depth parameter"); assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter"); assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
if (UseOldInlining) { if (UseOldInlining) {
// Update hierarchical counts, count_inline_bcs() and count_inlines() // Update hierarchical counts, count_inline_bcs() and count_inlines()
...@@ -52,10 +57,13 @@ InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* cal ...@@ -52,10 +57,13 @@ InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* cal
} }
} }
InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, float site_invoke_ratio) InlineTree::InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms,
float site_invoke_ratio, int site_depth_adjust)
: C(c), _caller_jvms(caller_jvms), _caller_tree(NULL), : C(c), _caller_jvms(caller_jvms), _caller_tree(NULL),
_method(callee_method), _site_invoke_ratio(site_invoke_ratio), _method(callee_method), _site_invoke_ratio(site_invoke_ratio),
_count_inline_bcs(method()->code_size()) { _site_depth_adjust(site_depth_adjust),
_count_inline_bcs(method()->code_size())
{
NOT_PRODUCT(_count_inlines = 0;) NOT_PRODUCT(_count_inlines = 0;)
assert(!UseOldInlining, "do not use for old stuff"); assert(!UseOldInlining, "do not use for old stuff");
} }
...@@ -269,10 +277,13 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_ ...@@ -269,10 +277,13 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_
return msg; return msg;
} }
bool is_accessor = InlineAccessors && callee_method->is_accessor(); if (InlineAccessors && callee_method->is_accessor()) {
// accessor methods are not subject to any of the following limits.
return NULL;
}
// suppress a few checks for accessors and trivial methods // suppress a few checks for accessors and trivial methods
if (!is_accessor && callee_method->code_size() > MaxTrivialSize) { if (callee_method->code_size() > MaxTrivialSize) {
// don't inline into giant methods // don't inline into giant methods
if (C->unique() > (uint)NodeCountInliningCutoff) { if (C->unique() > (uint)NodeCountInliningCutoff) {
...@@ -291,7 +302,7 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_ ...@@ -291,7 +302,7 @@ const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_
} }
} }
if (!C->do_inlining() && InlineAccessors && !is_accessor) { if (!C->do_inlining() && InlineAccessors) {
return "not an accessor"; return "not an accessor";
} }
if( inline_depth() > MaxInlineLevel ) { if( inline_depth() > MaxInlineLevel ) {
...@@ -464,7 +475,30 @@ InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, J ...@@ -464,7 +475,30 @@ InlineTree *InlineTree::build_inline_tree_for_callee( ciMethod* callee_method, J
if (old_ilt != NULL) { if (old_ilt != NULL) {
return old_ilt; return old_ilt;
} }
InlineTree *ilt = new InlineTree( C, this, callee_method, caller_jvms, caller_bci, recur_frequency ); int new_depth_adjust = 0;
if (caller_jvms->method() != NULL) {
if ((caller_jvms->method()->name() == ciSymbol::invoke_name() &&
caller_jvms->method()->holder()->name() == ciSymbol::java_dyn_MethodHandle())
|| caller_jvms->method()->holder()->name() == ciSymbol::java_dyn_InvokeDynamic())
/* @@@ FIXME:
if (caller_jvms->method()->is_method_handle_adapter())
*/
new_depth_adjust -= 1; // don't count actions in MH or indy adapter frames
else if (callee_method->is_method_handle_invoke()) {
new_depth_adjust -= 1; // don't count method handle calls from java.dyn implem
}
if (new_depth_adjust != 0 && PrintInlining) {
stringStream nm1; caller_jvms->method()->print_name(&nm1);
stringStream nm2; callee_method->print_name(&nm2);
tty->print_cr("discounting inlining depth from %s to %s", nm1.base(), nm2.base());
}
if (new_depth_adjust != 0 && C->log()) {
int id1 = C->log()->identify(caller_jvms->method());
int id2 = C->log()->identify(callee_method);
C->log()->elem("inline_depth_discount caller='%d' callee='%d'", id1, id2);
}
}
InlineTree *ilt = new InlineTree(C, this, callee_method, caller_jvms, caller_bci, recur_frequency, _site_depth_adjust + new_depth_adjust);
_subtrees.append( ilt ); _subtrees.append( ilt );
NOT_PRODUCT( _count_inlines += 1; ) NOT_PRODUCT( _count_inlines += 1; )
...@@ -490,7 +524,7 @@ InlineTree *InlineTree::build_inline_tree_root() { ...@@ -490,7 +524,7 @@ InlineTree *InlineTree::build_inline_tree_root() {
Compile* C = Compile::current(); Compile* C = Compile::current();
// Root of inline tree // Root of inline tree
InlineTree *ilt = new InlineTree(C, NULL, C->method(), NULL, -1, 1.0F); InlineTree *ilt = new InlineTree(C, NULL, C->method(), NULL, -1, 1.0F, 0);
return ilt; return ilt;
} }
......
...@@ -43,7 +43,9 @@ void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_met ...@@ -43,7 +43,9 @@ void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_met
} }
#endif #endif
CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float prof_factor) { CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual,
JVMState* jvms, bool allow_inline,
float prof_factor) {
CallGenerator* cg; CallGenerator* cg;
// Dtrace currently doesn't work unless all calls are vanilla // Dtrace currently doesn't work unless all calls are vanilla
...@@ -116,7 +118,7 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, ...@@ -116,7 +118,7 @@ CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index,
// TO DO: When UseOldInlining is removed, copy the ILT code elsewhere. // TO DO: When UseOldInlining is removed, copy the ILT code elsewhere.
float site_invoke_ratio = prof_factor; float site_invoke_ratio = prof_factor;
// Note: ilt is for the root of this parse, not the present call site. // Note: ilt is for the root of this parse, not the present call site.
ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio); ilt = new InlineTree(this, jvms->method(), jvms->caller(), site_invoke_ratio, 0);
} }
WarmCallInfo scratch_ci; WarmCallInfo scratch_ci;
if (!UseOldInlining) if (!UseOldInlining)
......
...@@ -39,6 +39,7 @@ class InlineTree : public ResourceObj { ...@@ -39,6 +39,7 @@ class InlineTree : public ResourceObj {
// Always between 0.0 and 1.0. Represents the percentage of the method's // Always between 0.0 and 1.0. Represents the percentage of the method's
// total execution time used at this call site. // total execution time used at this call site.
const float _site_invoke_ratio; const float _site_invoke_ratio;
const int _site_depth_adjust;
float compute_callee_frequency( int caller_bci ) const; float compute_callee_frequency( int caller_bci ) const;
GrowableArray<InlineTree*> _subtrees; GrowableArray<InlineTree*> _subtrees;
...@@ -50,7 +51,8 @@ protected: ...@@ -50,7 +51,8 @@ protected:
ciMethod* callee_method, ciMethod* callee_method,
JVMState* caller_jvms, JVMState* caller_jvms,
int caller_bci, int caller_bci,
float site_invoke_ratio); float site_invoke_ratio,
int site_depth_adjust);
InlineTree *build_inline_tree_for_callee(ciMethod* callee_method, InlineTree *build_inline_tree_for_callee(ciMethod* callee_method,
JVMState* caller_jvms, JVMState* caller_jvms,
int caller_bci); int caller_bci);
...@@ -61,14 +63,15 @@ protected: ...@@ -61,14 +63,15 @@ protected:
InlineTree *caller_tree() const { return _caller_tree; } InlineTree *caller_tree() const { return _caller_tree; }
InlineTree* callee_at(int bci, ciMethod* m) const; InlineTree* callee_at(int bci, ciMethod* m) const;
int inline_depth() const { return _caller_jvms ? _caller_jvms->depth() : 0; } int inline_depth() const { return stack_depth() + _site_depth_adjust; }
int stack_depth() const { return _caller_jvms ? _caller_jvms->depth() : 0; }
public: public:
static InlineTree* build_inline_tree_root(); static InlineTree* build_inline_tree_root();
static InlineTree* find_subtree_from_root(InlineTree* root, JVMState* jvms, ciMethod* callee, bool create_if_not_found = false); static InlineTree* find_subtree_from_root(InlineTree* root, JVMState* jvms, ciMethod* callee, bool create_if_not_found = false);
// For temporary (stack-allocated, stateless) ilts: // For temporary (stack-allocated, stateless) ilts:
InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, float site_invoke_ratio); InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, float site_invoke_ratio, int site_depth_adjust);
// InlineTree enum // InlineTree enum
enum InlineStyle { enum InlineStyle {
......
...@@ -2795,6 +2795,11 @@ jint Arguments::parse(const JavaVMInitArgs* args) { ...@@ -2795,6 +2795,11 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
} }
#endif #endif
if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output");
DebugNonSafepoints = true;
}
if (PrintCommandLineFlags) { if (PrintCommandLineFlags) {
CommandLineFlags::printSetFlags(); CommandLineFlags::printSetFlags();
} }
......
...@@ -2675,10 +2675,10 @@ class CommandLineFlags { ...@@ -2675,10 +2675,10 @@ class CommandLineFlags {
notproduct(intx, MaxSubklassPrintSize, 4, \ notproduct(intx, MaxSubklassPrintSize, 4, \
"maximum number of subklasses to print when printing klass") \ "maximum number of subklasses to print when printing klass") \
\ \
develop(intx, MaxInlineLevel, 9, \ product(intx, MaxInlineLevel, 9, \
"maximum number of nested calls that are inlined") \ "maximum number of nested calls that are inlined") \
\ \
develop(intx, MaxRecursiveInlineLevel, 1, \ product(intx, MaxRecursiveInlineLevel, 1, \
"maximum number of nested recursive calls that are inlined") \ "maximum number of nested recursive calls that are inlined") \
\ \
product_pd(intx, InlineSmallCode, \ product_pd(intx, InlineSmallCode, \
...@@ -2691,10 +2691,10 @@ class CommandLineFlags { ...@@ -2691,10 +2691,10 @@ class CommandLineFlags {
product_pd(intx, FreqInlineSize, \ product_pd(intx, FreqInlineSize, \
"maximum bytecode size of a frequent method to be inlined") \ "maximum bytecode size of a frequent method to be inlined") \
\ \
develop(intx, MaxTrivialSize, 6, \ product(intx, MaxTrivialSize, 6, \
"maximum bytecode size of a trivial method to be inlined") \ "maximum bytecode size of a trivial method to be inlined") \
\ \
develop(intx, MinInliningThreshold, 250, \ product(intx, MinInliningThreshold, 250, \
"min. invocation count a method needs to have to be inlined") \ "min. invocation count a method needs to have to be inlined") \
\ \
develop(intx, AlignEntryCode, 4, \ develop(intx, AlignEntryCode, 4, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册