< prev index next >

src/hotspot/share/prims/jvmtiEnv.cpp

Print this page




1697     }
1698 
1699     // If any of the top 2 frames is a compiled one, need to deoptimize it
1700     for (int i = 0; i < 2; i++) {
1701       if (!is_interpreted[i]) {
1702         Deoptimization::deoptimize_frame(java_thread, frame_sp[i]);
1703       }
1704     }
1705 
1706     // Update the thread state to reflect that the top frame is popped
1707     // so that cur_stack_depth is maintained properly and all frameIDs
1708     // are invalidated.
1709     // The current frame will be popped later when the suspended thread
1710     // is resumed and right before returning from VM to Java.
1711     // (see call_VM_base() in assembler_<cpu>.cpp).
1712 
1713     // It's fine to update the thread state here because no JVMTI events
1714     // shall be posted for this PopFrame.
1715 
1716     // It is only safe to perform the direct operation on the current
1717     // thread. All other usage needs to use a vm-safepoint-op for safety.
1718     if (java_thread == JavaThread::current()) {
1719       state->update_for_pop_top_frame();
1720     } else {
1721       VM_UpdateForPopTopFrame op(state);
1722       VMThread::execute(&op);
1723       jvmtiError err = op.result();
1724       if (err != JVMTI_ERROR_NONE) {
1725         return err;
1726       }
1727     }
1728 
1729     java_thread->set_popframe_condition(JavaThread::popframe_pending_bit);
1730     // Set pending step flag for this popframe and it is cleared when next
1731     // step event is posted.
1732     state->set_pending_step_for_popframe();
1733   }
1734 
1735   return JVMTI_ERROR_NONE;
1736 } /* end PopFrame */
1737 
1738 
1739 // Threads_lock NOT held, java_thread not protected by lock
1740 // java_thread - pre-checked
1741 // java_thread - unchecked
1742 // depth - pre-checked as non-negative
1743 // method_ptr - pre-checked for NULL


1783     JvmtiSuspendControl::print();
1784   }
1785 
1786   vframe *vf = vframeFor(java_thread, depth);
1787   if (vf == NULL) {
1788     return JVMTI_ERROR_NO_MORE_FRAMES;
1789   }
1790 
1791   if (!vf->is_java_frame() || ((javaVFrame*) vf)->method()->is_native()) {
1792     return JVMTI_ERROR_OPAQUE_FRAME;
1793   }
1794 
1795   assert(vf->frame_pointer() != NULL, "frame pointer mustn't be NULL");
1796 
1797   // It is only safe to perform the direct operation on the current
1798   // thread. All other usage needs to use a vm-safepoint-op for safety.
1799   if (java_thread == JavaThread::current()) {
1800     int frame_number = state->count_frames() - depth;
1801     state->env_thread_state(this)->set_frame_pop(frame_number);
1802   } else {
1803     VM_SetFramePop op(this, state, depth);
1804     VMThread::execute(&op);
1805     err = op.result();
1806   }
1807   return err;
1808 } /* end NotifyFramePop */
1809 
1810 
1811   //
1812   // Force Early Return functions
1813   //
1814 
1815 // Threads_lock NOT held, java_thread not protected by lock
1816 // java_thread - pre-checked
1817 jvmtiError
1818 JvmtiEnv::ForceEarlyReturnObject(JavaThread* java_thread, jobject value) {
1819   jvalue val;
1820   val.l = value;
1821   return force_early_return(java_thread, val, atos);
1822 } /* end ForceEarlyReturnObject */
1823 
1824 
1825 // Threads_lock NOT held, java_thread not protected by lock




1697     }
1698 
1699     // If any of the top 2 frames is a compiled one, need to deoptimize it
1700     for (int i = 0; i < 2; i++) {
1701       if (!is_interpreted[i]) {
1702         Deoptimization::deoptimize_frame(java_thread, frame_sp[i]);
1703       }
1704     }
1705 
1706     // Update the thread state to reflect that the top frame is popped
1707     // so that cur_stack_depth is maintained properly and all frameIDs
1708     // are invalidated.
1709     // The current frame will be popped later when the suspended thread
1710     // is resumed and right before returning from VM to Java.
1711     // (see call_VM_base() in assembler_<cpu>.cpp).
1712 
1713     // It's fine to update the thread state here because no JVMTI events
1714     // shall be posted for this PopFrame.
1715 
1716     // It is only safe to perform the direct operation on the current
1717     // thread. All other usage needs to use a handshake for safety.
1718     if (java_thread == JavaThread::current()) {
1719       state->update_for_pop_top_frame();
1720     } else {
1721       UpdateForPopTopFrameClosure op(state);
1722       bool executed = Handshake::execute_direct(&op, java_thread);
1723       jvmtiError err = executed ? op.result() : JVMTI_ERROR_THREAD_NOT_ALIVE;
1724       if (err != JVMTI_ERROR_NONE) {
1725         return err;
1726       }
1727     }
1728 
1729     java_thread->set_popframe_condition(JavaThread::popframe_pending_bit);
1730     // Set pending step flag for this popframe and it is cleared when next
1731     // step event is posted.
1732     state->set_pending_step_for_popframe();
1733   }
1734 
1735   return JVMTI_ERROR_NONE;
1736 } /* end PopFrame */
1737 
1738 
1739 // Threads_lock NOT held, java_thread not protected by lock
1740 // java_thread - pre-checked
1741 // java_thread - unchecked
1742 // depth - pre-checked as non-negative
1743 // method_ptr - pre-checked for NULL


1783     JvmtiSuspendControl::print();
1784   }
1785 
1786   vframe *vf = vframeFor(java_thread, depth);
1787   if (vf == NULL) {
1788     return JVMTI_ERROR_NO_MORE_FRAMES;
1789   }
1790 
1791   if (!vf->is_java_frame() || ((javaVFrame*) vf)->method()->is_native()) {
1792     return JVMTI_ERROR_OPAQUE_FRAME;
1793   }
1794 
1795   assert(vf->frame_pointer() != NULL, "frame pointer mustn't be NULL");
1796 
1797   // It is only safe to perform the direct operation on the current
1798   // thread. All other usage needs to use a vm-safepoint-op for safety.
1799   if (java_thread == JavaThread::current()) {
1800     int frame_number = state->count_frames() - depth;
1801     state->env_thread_state(this)->set_frame_pop(frame_number);
1802   } else {
1803     SetFramePopClosure op(this, state, depth);
1804     bool executed = Handshake::execute_direct(&op, java_thread);
1805     err = executed ? op.result() : JVMTI_ERROR_THREAD_NOT_ALIVE;
1806   }
1807   return err;
1808 } /* end NotifyFramePop */
1809 
1810 
1811   //
1812   // Force Early Return functions
1813   //
1814 
1815 // Threads_lock NOT held, java_thread not protected by lock
1816 // java_thread - pre-checked
1817 jvmtiError
1818 JvmtiEnv::ForceEarlyReturnObject(JavaThread* java_thread, jobject value) {
1819   jvalue val;
1820   val.l = value;
1821   return force_early_return(java_thread, val, atos);
1822 } /* end ForceEarlyReturnObject */
1823 
1824 
1825 // Threads_lock NOT held, java_thread not protected by lock


< prev index next >