src/share/vm/code/compiledIC.cpp
Print this page
*** 158,186 ****
//-----------------------------------------------------------------------------
// High-level access to an inline cache. Guaranteed to be MT-safe.
! void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
methodHandle method = call_info->selected_method();
bool is_invoke_interface = (bytecode == Bytecodes::_invokeinterface && !call_info->has_vtable_index());
assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
address entry;
if (is_invoke_interface) {
int index = klassItable::compute_itable_index(call_info->resolved_method()());
entry = VtableStubs::create_stub(false, index, method());
! assert(entry != NULL, "entry not computed");
InstanceKlass* k = call_info->resolved_method()->method_holder();
assert(k->is_interface(), "sanity check");
InlineCacheBuffer::create_transition_stub(this, k, entry);
} else {
// Can be different than method->vtable_index(), due to package-private etc.
int vtable_index = call_info->vtable_index();
entry = VtableStubs::create_stub(true, vtable_index, method());
InlineCacheBuffer::create_transition_stub(this, method(), entry);
}
if (TraceICs) {
ResourceMark rm;
--- 158,191 ----
//-----------------------------------------------------------------------------
// High-level access to an inline cache. Guaranteed to be MT-safe.
! bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
methodHandle method = call_info->selected_method();
bool is_invoke_interface = (bytecode == Bytecodes::_invokeinterface && !call_info->has_vtable_index());
assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
address entry;
if (is_invoke_interface) {
int index = klassItable::compute_itable_index(call_info->resolved_method()());
entry = VtableStubs::create_stub(false, index, method());
! if (entry == NULL) {
! return false;
! }
InstanceKlass* k = call_info->resolved_method()->method_holder();
assert(k->is_interface(), "sanity check");
InlineCacheBuffer::create_transition_stub(this, k, entry);
} else {
// Can be different than method->vtable_index(), due to package-private etc.
int vtable_index = call_info->vtable_index();
entry = VtableStubs::create_stub(true, vtable_index, method());
+ if (entry == NULL) {
+ return false;
+ }
InlineCacheBuffer::create_transition_stub(this, method(), entry);
}
if (TraceICs) {
ResourceMark rm;
*** 193,202 ****
--- 198,208 ----
// we ran out of space in the inline cache buffer trying to do the
// set_next and we safepointed to free up space. This is a benign
// race because the IC entry was complete when we safepointed so
// cleaning it immediately is harmless.
// assert(is_megamorphic(), "sanity check");
+ return true;
}
// true if destination is megamorphic stub
bool CompiledIC::is_megamorphic() const {