@@ -821,24 +821,17 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte
821821 CallInfo info;
822822 constantPoolHandle pool (thread, last_frame.method ()->constants ());
823823
824+ methodHandle resolved_method;
825+
824826 {
825827 JvmtiHideSingleStepping jhss (thread);
826828 LinkResolver::resolve_invoke (info, receiver, pool,
827829 last_frame.get_index_u2_cpcache (bytecode), bytecode,
828830 CHECK);
829- if (JvmtiExport::can_hotswap_or_post_breakpoint ()) {
830- int retry_count = 0 ;
831- while (info.resolved_method ()->is_old ()) {
832- // It is very unlikely that method is redefined more than 100 times
833- // in the middle of resolve. If it is looping here more than 100 times
834- // means then there could be a bug here.
835- guarantee ((retry_count++ < 100 ),
836- " Could not resolve to latest version of redefined method" );
837- // method is redefined in the middle of resolve so re-try.
838- LinkResolver::resolve_invoke (info, receiver, pool,
839- last_frame.get_index_u2_cpcache (bytecode), bytecode,
840- CHECK);
841- }
831+ if (JvmtiExport::can_hotswap_or_post_breakpoint () && info.resolved_method ()->is_old ()) {
832+ resolved_method = methodHandle (THREAD, info.resolved_method ()->get_new_method ());
833+ } else {
834+ resolved_method = methodHandle (THREAD, info.resolved_method ());
842835 }
843836 } // end JvmtiHideSingleStepping
844837
@@ -848,22 +841,20 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte
848841
849842#ifdef ASSERT
850843 if (bytecode == Bytecodes::_invokeinterface) {
851- if (info.resolved_method ()->method_holder () ==
852- SystemDictionary::Object_klass ()) {
844+ if (resolved_method->method_holder () == SystemDictionary::Object_klass ()) {
853845 // NOTE: THIS IS A FIX FOR A CORNER CASE in the JVM spec
854846 // (see also CallInfo::set_interface for details)
855847 assert (info.call_kind () == CallInfo::vtable_call ||
856848 info.call_kind () == CallInfo::direct_call, " " );
857- Method* rm = info.resolved_method ();
858- assert (rm->is_final () || info.has_vtable_index (),
849+ assert (resolved_method->is_final () || info.has_vtable_index (),
859850 " should have been set already" );
860- } else if (!info. resolved_method () ->has_itable_index ()) {
851+ } else if (!resolved_method->has_itable_index ()) {
861852 // Resolved something like CharSequence.toString. Use vtable not itable.
862853 assert (info.call_kind () != CallInfo::itable_call, " " );
863854 } else {
864855 // Setup itable entry
865856 assert (info.call_kind () == CallInfo::itable_call, " " );
866- int index = info. resolved_method () ->itable_index ();
857+ int index = resolved_method->itable_index ();
867858 assert (info.itable_index () == index, " " );
868859 }
869860 } else if (bytecode == Bytecodes::_invokespecial) {
@@ -878,7 +869,6 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte
878869 // methods must be checked for every call.
879870 InstanceKlass* sender = pool->pool_holder ();
880871 sender = sender->is_unsafe_anonymous () ? sender->unsafe_anonymous_host () : sender;
881- methodHandle resolved_method (THREAD, info.resolved_method ());
882872
883873 switch (info.call_kind ()) {
884874 case CallInfo::direct_call:
0 commit comments