提交 3f2511a9 编写于 作者: S stefank

8047362: Add a version of CompiledIC_at that doesn't create a new RelocIterator

Reviewed-by: iveresov, mgerdin
上级 f9a4e271
...@@ -494,7 +494,7 @@ void CodeCache::gc_epilogue() { ...@@ -494,7 +494,7 @@ void CodeCache::gc_epilogue() {
while(iter.next()) { while(iter.next()) {
if (iter.type() == relocInfo::virtual_call_type) { if (iter.type() == relocInfo::virtual_call_type) {
if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) { if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) {
CompiledIC *ic = CompiledIC_at(iter.reloc()); CompiledIC *ic = CompiledIC_at(&iter);
if (TraceCompiledIC) { if (TraceCompiledIC) {
tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder())); tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
ic->print(); ic->print();
......
...@@ -159,10 +159,24 @@ address CompiledIC::stub_address() const { ...@@ -159,10 +159,24 @@ address CompiledIC::stub_address() const {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// High-level access to an inline cache. Guaranteed to be MT-safe. // High-level access to an inline cache. Guaranteed to be MT-safe.
void CompiledIC::initialize_from_iter(RelocIterator* iter) {
assert(iter->addr() == _ic_call->instruction_address(), "must find ic_call");
if (iter->type() == relocInfo::virtual_call_type) {
virtual_call_Relocation* r = iter->virtual_call_reloc();
_is_optimized = false;
_value = nativeMovConstReg_at(r->cached_value());
} else {
assert(iter->type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
_is_optimized = true;
_value = NULL;
}
}
CompiledIC::CompiledIC(nmethod* nm, NativeCall* call) CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
: _ic_call(call) : _ic_call(call)
{ {
address ic_call = call->instruction_address(); address ic_call = _ic_call->instruction_address();
assert(ic_call != NULL, "ic_call address must be set"); assert(ic_call != NULL, "ic_call address must be set");
assert(nm != NULL, "must pass nmethod"); assert(nm != NULL, "must pass nmethod");
...@@ -173,15 +187,21 @@ CompiledIC::CompiledIC(nmethod* nm, NativeCall* call) ...@@ -173,15 +187,21 @@ CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
bool ret = iter.next(); bool ret = iter.next();
assert(ret == true, "relocInfo must exist at this address"); assert(ret == true, "relocInfo must exist at this address");
assert(iter.addr() == ic_call, "must find ic_call"); assert(iter.addr() == ic_call, "must find ic_call");
if (iter.type() == relocInfo::virtual_call_type) {
virtual_call_Relocation* r = iter.virtual_call_reloc(); initialize_from_iter(&iter);
_is_optimized = false; }
_value = nativeMovConstReg_at(r->cached_value());
} else { CompiledIC::CompiledIC(RelocIterator* iter)
assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call"); : _ic_call(nativeCall_at(iter->addr()))
_is_optimized = true; {
_value = NULL; address ic_call = _ic_call->instruction_address();
}
nmethod* nm = iter->code();
assert(ic_call != NULL, "ic_call address must be set");
assert(nm != NULL, "must pass nmethod");
assert(nm->contains(ic_call), "must be in nmethod");
initialize_from_iter(iter);
} }
bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
......
...@@ -150,6 +150,9 @@ class CompiledIC: public ResourceObj { ...@@ -150,6 +150,9 @@ class CompiledIC: public ResourceObj {
bool _is_optimized; // an optimized virtual call (i.e., no compiled IC) bool _is_optimized; // an optimized virtual call (i.e., no compiled IC)
CompiledIC(nmethod* nm, NativeCall* ic_call); CompiledIC(nmethod* nm, NativeCall* ic_call);
CompiledIC(RelocIterator* iter);
void initialize_from_iter(RelocIterator* iter);
static bool is_icholder_entry(address entry); static bool is_icholder_entry(address entry);
...@@ -183,6 +186,7 @@ class CompiledIC: public ResourceObj { ...@@ -183,6 +186,7 @@ class CompiledIC: public ResourceObj {
friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr); friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr);
friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site); friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site);
friend CompiledIC* CompiledIC_at(Relocation* call_site); friend CompiledIC* CompiledIC_at(Relocation* call_site);
friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter);
// This is used to release CompiledICHolder*s from nmethods that // This is used to release CompiledICHolder*s from nmethods that
// are about to be freed. The callsite might contain other stale // are about to be freed. The callsite might contain other stale
...@@ -263,6 +267,13 @@ inline CompiledIC* CompiledIC_at(Relocation* call_site) { ...@@ -263,6 +267,13 @@ inline CompiledIC* CompiledIC_at(Relocation* call_site) {
return c_ic; return c_ic;
} }
inline CompiledIC* CompiledIC_at(RelocIterator* reloc_iter) {
assert(reloc_iter->type() == relocInfo::virtual_call_type ||
reloc_iter->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info");
CompiledIC* c_ic = new CompiledIC(reloc_iter);
c_ic->verify();
return c_ic;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// The CompiledStaticCall represents a call to a static method in the compiled // The CompiledStaticCall represents a call to a static method in the compiled
......
...@@ -1166,7 +1166,7 @@ void nmethod::cleanup_inline_caches() { ...@@ -1166,7 +1166,7 @@ void nmethod::cleanup_inline_caches() {
switch(iter.type()) { switch(iter.type()) {
case relocInfo::virtual_call_type: case relocInfo::virtual_call_type:
case relocInfo::opt_virtual_call_type: { case relocInfo::opt_virtual_call_type: {
CompiledIC *ic = CompiledIC_at(iter.reloc()); CompiledIC *ic = CompiledIC_at(&iter);
// Ok, to lookup references to zombies here // Ok, to lookup references to zombies here
CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
if( cb != NULL && cb->is_nmethod() ) { if( cb != NULL && cb->is_nmethod() ) {
...@@ -1663,7 +1663,7 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) ...@@ -1663,7 +1663,7 @@ void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred)
RelocIterator iter(this, low_boundary); RelocIterator iter(this, low_boundary);
while(iter.next()) { while(iter.next()) {
if (iter.type() == relocInfo::virtual_call_type) { if (iter.type() == relocInfo::virtual_call_type) {
CompiledIC *ic = CompiledIC_at(iter.reloc()); CompiledIC *ic = CompiledIC_at(&iter);
if (ic->is_icholder_call()) { if (ic->is_icholder_call()) {
// The only exception is compiledICHolder oops which may // The only exception is compiledICHolder oops which may
// yet be marked below. (We check this further below). // yet be marked below. (We check this further below).
...@@ -1772,7 +1772,7 @@ void nmethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* i ...@@ -1772,7 +1772,7 @@ void nmethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* i
// compiled code is maintaining a link to dead metadata. // compiled code is maintaining a link to dead metadata.
address static_call_addr = NULL; address static_call_addr = NULL;
if (iter.type() == relocInfo::opt_virtual_call_type) { if (iter.type() == relocInfo::opt_virtual_call_type) {
CompiledIC* cic = CompiledIC_at(iter.reloc()); CompiledIC* cic = CompiledIC_at(&iter);
if (!cic->is_call_to_interpreted()) { if (!cic->is_call_to_interpreted()) {
static_call_addr = iter.addr(); static_call_addr = iter.addr();
} }
...@@ -1824,7 +1824,7 @@ void nmethod::metadata_do(void f(Metadata*)) { ...@@ -1824,7 +1824,7 @@ void nmethod::metadata_do(void f(Metadata*)) {
} }
} else if (iter.type() == relocInfo::virtual_call_type) { } else if (iter.type() == relocInfo::virtual_call_type) {
// Check compiledIC holders associated with this nmethod // Check compiledIC holders associated with this nmethod
CompiledIC *ic = CompiledIC_at(iter.reloc()); CompiledIC *ic = CompiledIC_at(&iter);
if (ic->is_icholder_call()) { if (ic->is_icholder_call()) {
CompiledICHolder* cichk = ic->cached_icholder(); CompiledICHolder* cichk = ic->cached_icholder();
f(cichk->holder_method()); f(cichk->holder_method());
...@@ -2927,7 +2927,7 @@ void nmethod::print_calls(outputStream* st) { ...@@ -2927,7 +2927,7 @@ void nmethod::print_calls(outputStream* st) {
case relocInfo::virtual_call_type: case relocInfo::virtual_call_type:
case relocInfo::opt_virtual_call_type: { case relocInfo::opt_virtual_call_type: {
VerifyMutexLocker mc(CompiledIC_lock); VerifyMutexLocker mc(CompiledIC_lock);
CompiledIC_at(iter.reloc())->print(); CompiledIC_at(&iter)->print();
break; break;
} }
case relocInfo::static_call_type: case relocInfo::static_call_type:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册