28 #include "runtime/thread.inline.hpp"
29
30 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
31 // currently interrupted by SIGPROF
32 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
33 void* ucontext, bool isInJava) {
34 assert(Thread::current() == this, "caller must be current thread");
35 return pd_get_top_frame(fr_addr, ucontext, isInJava);
36 }
37
38 bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
39 return pd_get_top_frame(fr_addr, ucontext, isInJava);
40 }
41
42 bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
43 assert(this->is_Java_thread(), "must be JavaThread");
44 JavaThread* jt = (JavaThread *)this;
45
46 // If we have a last_Java_frame, then we should use it even if
47 // isInJava == true. It should be more reliable than ucontext info.
48 if (jt->has_last_Java_frame()) {
49 *fr_addr = jt->pd_last_frame();
50 return true;
51 }
52
53 // At this point, we don't have a last_Java_frame, so
54 // we try to glean some information out of the ucontext
55 // if we were running Java code when SIGPROF came in.
56 if (isInJava) {
57 ucontext_t* uc = (ucontext_t*) ucontext;
58
59 intptr_t* ret_fp;
60 intptr_t* ret_sp;
61 ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc,
62 &ret_sp, &ret_fp);
63 if (addr.pc() == NULL || ret_sp == NULL ) {
64 // ucontext wasn't useful
65 return false;
66 }
67
68 #if INCLUDE_CDS
|
28 #include "runtime/thread.inline.hpp"
29
30 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
31 // currently interrupted by SIGPROF
32 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
33 void* ucontext, bool isInJava) {
34 assert(Thread::current() == this, "caller must be current thread");
35 return pd_get_top_frame(fr_addr, ucontext, isInJava);
36 }
37
38 bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
39 return pd_get_top_frame(fr_addr, ucontext, isInJava);
40 }
41
42 bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
43 assert(this->is_Java_thread(), "must be JavaThread");
44 JavaThread* jt = (JavaThread *)this;
45
46 // If we have a last_Java_frame, then we should use it even if
47 // isInJava == true. It should be more reliable than ucontext info.
48 if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) {
49 *fr_addr = jt->pd_last_frame();
50 return true;
51 }
52
53 // At this point, we don't have a last_Java_frame, so
54 // we try to glean some information out of the ucontext
55 // if we were running Java code when SIGPROF came in.
56 if (isInJava) {
57 ucontext_t* uc = (ucontext_t*) ucontext;
58
59 intptr_t* ret_fp;
60 intptr_t* ret_sp;
61 ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc,
62 &ret_sp, &ret_fp);
63 if (addr.pc() == NULL || ret_sp == NULL ) {
64 // ucontext wasn't useful
65 return false;
66 }
67
68 #if INCLUDE_CDS
|