src/os/linux/vm/os_linux.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
webrev Cdiff src/os/linux/vm/os_linux.cpp
src/os/linux/vm/os_linux.cpp
Print this page
*** 4039,4053 ****
void os::hint_no_preempt() {}
////////////////////////////////////////////////////////////////////////////////
// suspend/resume support
! // 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.
// The remaining code is greatly simplified from the more general suspension
// code that used to be used.
//
// The protocol is quite simple:
// - suspend:
--- 4039,4054 ----
void os::hint_no_preempt() {}
////////////////////////////////////////////////////////////////////////////////
// suspend/resume support
! // 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. Needed for fetch_frame_from_ucontext(), which is used by:
! // - Forte Analyzer: AsyncGetCallTrace()
! // - StackBanging: get_frame_at_stack_banging_point()
! //
// The remaining code is greatly simplified from the more general suspension
// code that used to be used.
//
// The protocol is quite simple:
// - suspend:
*** 5099,5146 ****
do_task(context);
do_resume(_thread->osthread());
}
}
- 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::Linux::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
bool os::find(address addr, outputStream* st) {
Dl_info dlinfo;
--- 5100,5109 ----
src/os/linux/vm/os_linux.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File