@@ -1174,7 +1174,7 @@ void InterpreterMacroAssembler::notify_method_exit(
11741174 // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
11751175 // track stack depth. If it is possible to enter interp_only_mode we add
11761176 // the code to check if the event should be sent.
1177- if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events ()) {
1177+ if (mode == NotifyJVMTI && ( JvmtiExport::can_post_interpreter_events () || JvmtiExport::can_post_frame_pop () )) {
11781178 Label L;
11791179 // Note: frame::interpreter_frame_result has a dependency on how the
11801180 // method result is saved across the call to post_method_exit. If this
@@ -1183,8 +1183,15 @@ void InterpreterMacroAssembler::notify_method_exit(
11831183
11841184 // template interpreter will leave the result on the top of the stack.
11851185 push (state);
1186- ldrw (r3, Address (rthread, JavaThread::interp_only_mode_offset ()));
1187- cbz (r3, L);
1186+
1187+ ldr (rscratch1, Address (rthread, JavaThread::jvmti_thread_state_offset ()));
1188+ cbz (rscratch1, L); // if (thread->jvmti_thread_state() == nullptr) exit;
1189+
1190+ ldrw (rscratch1, Address (rscratch1, JvmtiThreadState::frame_pop_cnt_offset ()));
1191+ ldrw (rscratch2, Address (rthread, JavaThread::interp_only_mode_offset ()));
1192+ orrw (rscratch1, rscratch1, rscratch2);
1193+ cbzw (rscratch1, L);
1194+
11881195 call_VM (noreg,
11891196 CAST_FROM_FN_PTR (address, InterpreterRuntime::post_method_exit));
11901197 bind (L);
0 commit comments