1.1 --- a/src/share/vm/code/compiledIC.cpp Tue Sep 17 23:12:27 2013 +0200 1.2 +++ b/src/share/vm/code/compiledIC.cpp Fri Sep 13 22:38:02 2013 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -161,31 +161,36 @@ 1.11 1.12 1.13 void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { 1.14 - methodHandle method = call_info->selected_method(); 1.15 - bool is_invoke_interface = (bytecode == Bytecodes::_invokeinterface && !call_info->has_vtable_index()); 1.16 assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); 1.17 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic"); 1.18 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?"); 1.19 1.20 address entry; 1.21 - if (is_invoke_interface) { 1.22 - int index = klassItable::compute_itable_index(call_info->resolved_method()()); 1.23 - entry = VtableStubs::create_stub(false, index, method()); 1.24 + if (call_info->call_kind() == CallInfo::itable_call) { 1.25 + assert(bytecode == Bytecodes::_invokeinterface, ""); 1.26 + int itable_index = call_info->itable_index(); 1.27 + entry = VtableStubs::find_itable_stub(itable_index); 1.28 +#ifdef ASSERT 1.29 assert(entry != NULL, "entry not computed"); 1.30 + int index = call_info->resolved_method()->itable_index(); 1.31 + assert(index == itable_index, "CallInfo pre-computes this"); 1.32 +#endif //ASSERT 1.33 InstanceKlass* k = call_info->resolved_method()->method_holder(); 1.34 - assert(k->is_interface(), "sanity check"); 1.35 + assert(k->verify_itable_index(itable_index), "sanity check"); 1.36 InlineCacheBuffer::create_transition_stub(this, k, entry); 1.37 } else { 1.38 - // Can be different than method->vtable_index(), due to package-private etc. 1.39 + assert(call_info->call_kind() == CallInfo::vtable_call, "either itable or vtable"); 1.40 + // Can be different than selected_method->vtable_index(), due to package-private etc. 1.41 int vtable_index = call_info->vtable_index(); 1.42 - entry = VtableStubs::create_stub(true, vtable_index, method()); 1.43 - InlineCacheBuffer::create_transition_stub(this, method(), entry); 1.44 + assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check"); 1.45 + entry = VtableStubs::find_vtable_stub(vtable_index); 1.46 + InlineCacheBuffer::create_transition_stub(this, NULL, entry); 1.47 } 1.48 1.49 if (TraceICs) { 1.50 ResourceMark rm; 1.51 tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT, 1.52 - instruction_address(), method->print_value_string(), entry); 1.53 + instruction_address(), call_info->selected_method()->print_value_string(), entry); 1.54 } 1.55 1.56 // We can't check this anymore. With lazy deopt we could have already