Path: blob/master/src/hotspot/share/runtime/javaFrameAnchor.hpp
64440 views
/*1* Copyright (c) 2002, 2020, Oracle and/or its affiliates. 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#ifndef SHARE_RUNTIME_JAVAFRAMEANCHOR_HPP25#define SHARE_RUNTIME_JAVAFRAMEANCHOR_HPP2627#include "runtime/orderAccess.hpp"28#include "utilities/globalDefinitions.hpp"29#include "utilities/macros.hpp"3031//32// An object for encapsulating the machine/os dependent part of a JavaThread frame state33//34class JavaThread;35class MacroAssembler;36class ProgrammableUpcallHandler;37class ZeroFrame;3839class JavaFrameAnchor {40// Too many friends...41friend class CallNativeDirectNode;42friend class OptoRuntime;43friend class Runtime1;44friend class StubAssembler;45friend class CallRuntimeDirectNode;46friend class MacroAssembler;47friend class LIR_Assembler;48friend class GraphKit;49friend class StubGenerator;50friend class JavaThread;51friend class frame;52friend class VMStructs;53friend class JVMCIVMStructs;54friend class BytecodeInterpreter;55friend class JavaCallWrapper;56friend class ProgrammableUpcallHandler;5758private:59//60// Whenever _last_Java_sp != NULL other anchor fields MUST be valid!61// The stack may not be walkable [check with walkable() ] but the values must be valid.62// The profiler apparently depends on this.63//64intptr_t* volatile _last_Java_sp;6566// Whenever we call from Java to native we can not be assured that the return67// address that composes the last_Java_frame will be in an accessible location68// so calls from Java to native store that pc (or one good enough to locate69// the oopmap) in the frame anchor. Since the frames that call from Java to70// native are never deoptimized we never need to patch the pc and so this71// is acceptable.72volatile address _last_Java_pc;7374// tells whether the last Java frame is set75// It is important that when last_Java_sp != NULL that the rest of the frame76// anchor (including platform specific) all be valid.7778bool has_last_Java_frame() const { return _last_Java_sp != NULL; }79// This is very dangerous unless sp == NULL80// Invalidate the anchor so that has_last_frame is false81// and no one should look at the other fields.82void zap(void) { _last_Java_sp = NULL; }8384#include CPU_HEADER(javaFrameAnchor)8586public:87JavaFrameAnchor() { clear(); }88JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); }8990// Assembly stub generation helpers9192static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); }93static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); }9495};9697#endif // SHARE_RUNTIME_JAVAFRAMEANCHOR_HPP9899100