18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/javaClasses.inline.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/codeCacheExtensions.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "compiler/disassembler.hpp"
33 #include "gc/shared/collectedHeap.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/interpreterRuntime.hpp"
36 #include "interpreter/linkResolver.hpp"
37 #include "interpreter/templateTable.hpp"
38 #include "memory/oopFactory.hpp"
39 #include "memory/universe.inline.hpp"
40 #include "oops/constantPool.hpp"
41 #include "oops/instanceKlass.hpp"
42 #include "oops/methodData.hpp"
43 #include "oops/objArrayKlass.hpp"
44 #include "oops/objArrayOop.inline.hpp"
45 #include "oops/oop.inline.hpp"
46 #include "oops/symbol.hpp"
47 #include "prims/jvmtiExport.hpp"
48 #include "prims/nativeLookup.hpp"
49 #include "runtime/atomic.inline.hpp"
50 #include "runtime/biasedLocking.hpp"
51 #include "runtime/compilationPolicy.hpp"
52 #include "runtime/deoptimization.hpp"
53 #include "runtime/fieldDescriptor.hpp"
54 #include "runtime/handles.inline.hpp"
55 #include "runtime/icache.hpp"
56 #include "runtime/interfaceSupport.hpp"
57 #include "runtime/java.hpp"
732 int retry_count = 0;
733 while (info.resolved_method()->is_old()) {
734 // It is very unlikely that method is redefined more than 100 times
735 // in the middle of resolve. If it is looping here more than 100 times
736 // means then there could be a bug here.
737 guarantee((retry_count++ < 100),
738 "Could not resolve to latest version of redefined method");
739 // method is redefined in the middle of resolve so re-try.
740 LinkResolver::resolve_invoke(info, receiver, pool,
741 get_index_u2_cpcache(thread, bytecode), bytecode,
742 CHECK);
743 }
744 }
745 } // end JvmtiHideSingleStepping
746
747 // check if link resolution caused cpCache to be updated
748 ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
749 if (cp_cache_entry->is_resolved(bytecode)) return;
750
751 if (bytecode == Bytecodes::_invokeinterface) {
752 if (TraceItables && Verbose) {
753 ResourceMark rm(thread);
754 tty->print_cr("Resolving: klass: %s to method: %s", info.resolved_klass()->name()->as_C_string(), info.resolved_method()->name()->as_C_string());
755 }
756 }
757 #ifdef ASSERT
758 if (bytecode == Bytecodes::_invokeinterface) {
759 if (info.resolved_method()->method_holder() ==
760 SystemDictionary::Object_klass()) {
761 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
762 // (see also CallInfo::set_interface for details)
763 assert(info.call_kind() == CallInfo::vtable_call ||
764 info.call_kind() == CallInfo::direct_call, "");
765 methodHandle rm = info.resolved_method();
766 assert(rm->is_final() || info.has_vtable_index(),
767 "should have been set already");
768 } else if (!info.resolved_method()->has_itable_index()) {
769 // Resolved something like CharSequence.toString. Use vtable not itable.
770 assert(info.call_kind() != CallInfo::itable_call, "");
771 } else {
772 // Setup itable entry
773 assert(info.call_kind() == CallInfo::itable_call, "");
774 int index = info.resolved_method()->itable_index();
775 assert(info.itable_index() == index, "");
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/javaClasses.inline.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/codeCacheExtensions.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "compiler/disassembler.hpp"
33 #include "gc/shared/collectedHeap.hpp"
34 #include "interpreter/interpreter.hpp"
35 #include "interpreter/interpreterRuntime.hpp"
36 #include "interpreter/linkResolver.hpp"
37 #include "interpreter/templateTable.hpp"
38 #include "logging/log.hpp"
39 #include "memory/oopFactory.hpp"
40 #include "memory/universe.inline.hpp"
41 #include "oops/constantPool.hpp"
42 #include "oops/instanceKlass.hpp"
43 #include "oops/methodData.hpp"
44 #include "oops/objArrayKlass.hpp"
45 #include "oops/objArrayOop.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "oops/symbol.hpp"
48 #include "prims/jvmtiExport.hpp"
49 #include "prims/nativeLookup.hpp"
50 #include "runtime/atomic.inline.hpp"
51 #include "runtime/biasedLocking.hpp"
52 #include "runtime/compilationPolicy.hpp"
53 #include "runtime/deoptimization.hpp"
54 #include "runtime/fieldDescriptor.hpp"
55 #include "runtime/handles.inline.hpp"
56 #include "runtime/icache.hpp"
57 #include "runtime/interfaceSupport.hpp"
58 #include "runtime/java.hpp"
733 int retry_count = 0;
734 while (info.resolved_method()->is_old()) {
735 // It is very unlikely that method is redefined more than 100 times
736 // in the middle of resolve. If it is looping here more than 100 times
737 // means then there could be a bug here.
738 guarantee((retry_count++ < 100),
739 "Could not resolve to latest version of redefined method");
740 // method is redefined in the middle of resolve so re-try.
741 LinkResolver::resolve_invoke(info, receiver, pool,
742 get_index_u2_cpcache(thread, bytecode), bytecode,
743 CHECK);
744 }
745 }
746 } // end JvmtiHideSingleStepping
747
748 // check if link resolution caused cpCache to be updated
749 ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
750 if (cp_cache_entry->is_resolved(bytecode)) return;
751
752 if (bytecode == Bytecodes::_invokeinterface) {
753 ResourceMark rm(thread);
754 log_develop_trace(itables)("Resolving: klass: %s to method: %s",
755 info.resolved_klass()->name()->as_C_string(),
756 info.resolved_method()->name()->as_C_string());
757 }
758 #ifdef ASSERT
759 if (bytecode == Bytecodes::_invokeinterface) {
760 if (info.resolved_method()->method_holder() ==
761 SystemDictionary::Object_klass()) {
762 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
763 // (see also CallInfo::set_interface for details)
764 assert(info.call_kind() == CallInfo::vtable_call ||
765 info.call_kind() == CallInfo::direct_call, "");
766 methodHandle rm = info.resolved_method();
767 assert(rm->is_final() || info.has_vtable_index(),
768 "should have been set already");
769 } else if (!info.resolved_method()->has_itable_index()) {
770 // Resolved something like CharSequence.toString. Use vtable not itable.
771 assert(info.call_kind() != CallInfo::itable_call, "");
772 } else {
773 // Setup itable entry
774 assert(info.call_kind() == CallInfo::itable_call, "");
775 int index = info.resolved_method()->itable_index();
776 assert(info.itable_index() == index, "");
|