1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,97 @@ 1.4 +/* 1.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#include "precompiled.hpp" 1.29 +#include "runtime/frame.inline.hpp" 1.30 +#include "runtime/thread.inline.hpp" 1.31 + 1.32 +// For Forte Analyzer AsyncGetCallTrace profiling support - thread is 1.33 +// currently interrupted by SIGPROF 1.34 +bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr, 1.35 + void* ucontext, bool isInJava) { 1.36 + assert(Thread::current() == this, "caller must be current thread"); 1.37 + return pd_get_top_frame(fr_addr, ucontext, isInJava); 1.38 +} 1.39 + 1.40 +bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, 1.41 + void* ucontext, bool isInJava) { 1.42 + return pd_get_top_frame(fr_addr, ucontext, isInJava); 1.43 +} 1.44 + 1.45 +bool JavaThread::pd_get_top_frame(frame* fr_addr, 1.46 + void* ucontext, bool isInJava) { 1.47 + assert(this->is_Java_thread(), "must be JavaThread"); 1.48 + JavaThread* jt = (JavaThread *)this; 1.49 + 1.50 + // last_Java_frame is always walkable and safe use it if we have it 1.51 + 1.52 + if (jt->has_last_Java_frame()) { 1.53 + *fr_addr = jt->pd_last_frame(); 1.54 + return true; 1.55 + } 1.56 + 1.57 + ucontext_t* uc = (ucontext_t*) ucontext; 1.58 + 1.59 + // We always want to use the initial frame we create from the ucontext as 1.60 + // it certainly signals where we currently are. However that frame may not 1.61 + // be safe for calling sender. In that case if we have a last_Java_frame 1.62 + // then the forte walker will switch to that frame as the virtual sender 1.63 + // for the frame we create here which is not sender safe. 1.64 + 1.65 + intptr_t* ret_fp; 1.66 + intptr_t* ret_sp; 1.67 + ExtendedPC addr = os::Solaris::fetch_frame_from_ucontext(this, uc, &ret_sp, &ret_fp); 1.68 + 1.69 + // Something would really have to be screwed up to get a NULL pc 1.70 + 1.71 + if (addr.pc() == NULL ) { 1.72 + assert(false, "NULL pc from signal handler!"); 1.73 + return false; 1.74 + 1.75 + } 1.76 + 1.77 + // If sp and fp are nonsense just leave them out 1.78 + 1.79 + if ((address)ret_sp >= jt->stack_base() || 1.80 + (address)ret_sp < jt->stack_base() - jt->stack_size() ) { 1.81 + 1.82 + ret_sp = NULL; 1.83 + ret_fp = NULL; 1.84 + } else { 1.85 + 1.86 + // sp is reasonable is fp reasonable? 1.87 + if ( (address)ret_fp >= jt->stack_base() || ret_fp < ret_sp) { 1.88 + ret_fp = NULL; 1.89 + } 1.90 + } 1.91 + 1.92 + frame ret_frame(ret_sp, ret_fp, addr.pc()); 1.93 + 1.94 + *fr_addr = ret_frame; 1.95 + return true; 1.96 + 1.97 +} 1.98 + 1.99 +void JavaThread::cache_global_variables() { } 1.100 +