Path: blob/master/src/hotspot/share/runtime/javaFrameAnchor.hpp
40951 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;3637class JavaFrameAnchor {38// Too many friends...39friend class CallNativeDirectNode;40friend class OptoRuntime;41friend class Runtime1;42friend class StubAssembler;43friend class CallRuntimeDirectNode;44friend class MacroAssembler;45friend class LIR_Assembler;46friend class GraphKit;47friend class StubGenerator;48friend class JavaThread;49friend class frame;50friend class VMStructs;51friend class JVMCIVMStructs;52friend class BytecodeInterpreter;53friend class JavaCallWrapper;5455private:56//57// Whenever _last_Java_sp != NULL other anchor fields MUST be valid!58// The stack may not be walkable [check with walkable() ] but the values must be valid.59// The profiler apparently depends on this.60//61intptr_t* volatile _last_Java_sp;6263// Whenever we call from Java to native we can not be assured that the return64// address that composes the last_Java_frame will be in an accessible location65// so calls from Java to native store that pc (or one good enough to locate66// the oopmap) in the frame anchor. Since the frames that call from Java to67// native are never deoptimized we never need to patch the pc and so this68// is acceptable.69volatile address _last_Java_pc;7071// tells whether the last Java frame is set72// It is important that when last_Java_sp != NULL that the rest of the frame73// anchor (including platform specific) all be valid.7475bool has_last_Java_frame() const { return _last_Java_sp != NULL; }76// This is very dangerous unless sp == NULL77// Invalidate the anchor so that has_last_frame is false78// and no one should look at the other fields.79void zap(void) { _last_Java_sp = NULL; }8081#include CPU_HEADER(javaFrameAnchor)8283public:84JavaFrameAnchor() { clear(); }85JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); }8687// Assembly stub generation helpers8889static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); }90static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); }9192};9394#endif // SHARE_RUNTIME_JAVAFRAMEANCHOR_HPP959697