Path: blob/master/src/hotspot/os_cpu/windows_aarch64/thread_windows_aarch64.cpp
40930 views
/*1* Copyright (c) 2020, Microsoft Corporation. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "runtime/frame.inline.hpp"26#include "runtime/thread.inline.hpp"2728frame JavaThread::pd_last_frame() {29assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");30vmassert(_anchor.last_Java_pc() != NULL, "not walkable");31return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());32}3334// For Forte Analyzer AsyncGetCallTrace profiling support - thread is35// currently interrupted by SIGPROF36bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,37void* ucontext, bool isInJava) {3839assert(Thread::current() == this, "caller must be current thread");40return pd_get_top_frame(fr_addr, ucontext, isInJava);41}4243bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {44return pd_get_top_frame(fr_addr, ucontext, isInJava);45}4647bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {4849assert(this->is_Java_thread(), "must be JavaThread");5051JavaThread* jt = (JavaThread *)this;5253// If we have a last_Java_frame, then we should use it even if54// isInJava == true. It should be more reliable than CONTEXT info.55if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) {56*fr_addr = jt->pd_last_frame();57return true;58}5960// At this point, we don't have a last_Java_frame, so61// we try to glean some information out of the CONTEXT62// if we were running Java code when SIGPROF came in.63if (isInJava) {64frame ret_frame = os::fetch_frame_from_context(ucontext);65if (ret_frame.pc() == NULL || ret_frame.sp() == NULL ) {66// CONTEXT wasn't useful67return false;68}6970if (!ret_frame.safe_for_sender(jt)) {71#if COMPILER2_OR_JVMCI72// C2 and JVMCI use ebp as a general register see if NULL fp helps73frame ret_frame2(ret_frame.sp(), NULL, ret_frame.pc());74if (!ret_frame2.safe_for_sender(jt)) {75// nothing else to try if the frame isn't good76return false;77}78ret_frame = ret_frame2;79#else80// nothing else to try if the frame isn't good81return false;82#endif // COMPILER2_OR_JVMCI83}84*fr_addr = ret_frame;85return true;86}8788// nothing else to try89return false;90}9192void JavaThread::cache_global_variables() { }939495