--- old/src/os/aix/vm/os_aix.cpp 2017-08-18 12:12:41.000000000 -0500 +++ new/src/os/aix/vm/os_aix.cpp 2017-08-18 12:12:41.000000000 -0500 @@ -2657,11 +2657,10 @@ //////////////////////////////////////////////////////////////////////////////// // suspend/resume support -// the low-level signal-based suspend/resume support is a remnant from the +// The low-level signal-based suspend/resume support is a remnant from the // old VM-suspension that used to be for java-suspension, safepoints etc, -// within hotspot. Now there is a single use-case for this: -// - calling get_thread_pc() on the VMThread by the flat-profiler task -// that runs in the watcher thread. +// within hotspot. Currently used by JFR's OSThreadSampler +// // The remaining code is greatly simplified from the more general suspension // code that used to be used. // @@ -2677,7 +2676,13 @@ // // Note that the SR_lock plays no role in this suspend/resume protocol, // but is checked for NULL in SR_handler as a thread termination indicator. +// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs. // +// Note that resume_clear_context() and suspend_save_context() are needed +// by SR_handler(), so that fetch_frame_from_ucontext() works, +// which in part is used by: +// - Forte Analyzer: AsyncGetCallTrace() +// - StackBanging: get_frame_at_stack_banging_point() static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); @@ -3684,44 +3689,6 @@ } } -class PcFetcher : public os::SuspendedThreadTask { -public: - PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} - ExtendedPC result(); -protected: - void do_task(const os::SuspendedThreadTaskContext& context); -private: - ExtendedPC _epc; -}; - -ExtendedPC PcFetcher::result() { - guarantee(is_done(), "task is not done yet."); - return _epc; -} - -void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) { - Thread* thread = context.thread(); - OSThread* osthread = thread->osthread(); - if (osthread->ucontext() != NULL) { - _epc = os::Aix::ucontext_get_pc((const ucontext_t *) context.ucontext()); - } else { - // NULL context is unexpected, double-check this is the VMThread. - guarantee(thread->is_VM_thread(), "can only be called for VMThread"); - } -} - -// Suspends the target using the signal mechanism and then grabs the PC before -// resuming the target. Used by the flat-profiler only -ExtendedPC os::get_thread_pc(Thread* thread) { - // Make sure that it is called by the watcher for the VMThread. - assert(Thread::current()->is_Watcher_thread(), "Must be watcher"); - assert(thread->is_VM_thread(), "Can only be called for VMThread"); - - PcFetcher fetcher(thread); - fetcher.run(); - return fetcher.result(); -} - //////////////////////////////////////////////////////////////////////////////// // debug support