aoqi@0: /* aoqi@0: * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@1: /* aoqi@1: * This file has been modified by Loongson Technology in 2015. These aoqi@1: * modifications are Copyright (c) 2015 Loongson Technology, and are made aoqi@1: * available on the same license terms set forth above. aoqi@1: */ aoqi@1: aoqi@0: #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP aoqi@0: #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP aoqi@0: aoqi@0: #include "utilities/globalDefinitions.hpp" aoqi@0: #ifdef TARGET_OS_ARCH_linux_x86 aoqi@0: # include "orderAccess_linux_x86.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_linux_sparc aoqi@0: # include "orderAccess_linux_sparc.inline.hpp" aoqi@0: #endif aoqi@1: #ifdef TARGET_OS_ARCH_linux_mips aoqi@1: # include "orderAccess_linux_mips.inline.hpp" aoqi@1: #endif aoqi@0: #ifdef TARGET_OS_ARCH_linux_zero aoqi@0: # include "orderAccess_linux_zero.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_solaris_x86 aoqi@0: # include "orderAccess_solaris_x86.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_solaris_sparc aoqi@0: # include "orderAccess_solaris_sparc.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_windows_x86 aoqi@0: # include "orderAccess_windows_x86.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_linux_arm aoqi@0: # include "orderAccess_linux_arm.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_linux_ppc aoqi@0: # include "orderAccess_linux_ppc.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_aix_ppc aoqi@0: # include "orderAccess_aix_ppc.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_bsd_x86 aoqi@0: # include "orderAccess_bsd_x86.inline.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_OS_ARCH_bsd_zero aoqi@0: # include "orderAccess_bsd_zero.inline.hpp" aoqi@0: #endif aoqi@0: aoqi@0: // aoqi@0: // An object for encapsulating the machine/os dependent part of a JavaThread frame state aoqi@0: // aoqi@0: class JavaThread; aoqi@0: aoqi@0: class JavaFrameAnchor VALUE_OBJ_CLASS_SPEC { aoqi@0: // Too many friends... aoqi@0: friend class CallNativeDirectNode; aoqi@0: friend class OptoRuntime; aoqi@0: friend class Runtime1; aoqi@0: friend class StubAssembler; aoqi@0: friend class CallRuntimeDirectNode; aoqi@0: friend class MacroAssembler; aoqi@0: friend class InterpreterGenerator; aoqi@0: friend class LIR_Assembler; aoqi@0: friend class GraphKit; aoqi@0: friend class StubGenerator; aoqi@0: friend class JavaThread; aoqi@0: friend class frame; aoqi@0: friend class VMStructs; aoqi@0: friend class BytecodeInterpreter; aoqi@0: friend class JavaCallWrapper; aoqi@0: aoqi@0: private: aoqi@0: // aoqi@0: // Whenever _last_Java_sp != NULL other anchor fields MUST be valid! aoqi@0: // The stack may not be walkable [check with walkable() ] but the values must be valid. aoqi@0: // The profiler apparently depends on this. aoqi@0: // aoqi@0: intptr_t* volatile _last_Java_sp; aoqi@0: aoqi@0: // Whenever we call from Java to native we can not be assured that the return aoqi@0: // address that composes the last_Java_frame will be in an accessible location aoqi@0: // so calls from Java to native store that pc (or one good enough to locate aoqi@0: // the oopmap) in the frame anchor. Since the frames that call from Java to aoqi@0: // native are never deoptimized we never need to patch the pc and so this aoqi@0: // is acceptable. aoqi@0: volatile address _last_Java_pc; aoqi@0: aoqi@0: // tells whether the last Java frame is set aoqi@0: // It is important that when last_Java_sp != NULL that the rest of the frame aoqi@0: // anchor (including platform specific) all be valid. aoqi@0: aoqi@0: bool has_last_Java_frame() const { return _last_Java_sp != NULL; } aoqi@0: // This is very dangerous unless sp == NULL aoqi@0: // Invalidate the anchor so that has_last_frame is false aoqi@0: // and no one should look at the other fields. aoqi@0: void zap(void) { _last_Java_sp = NULL; } aoqi@0: aoqi@0: #ifdef TARGET_ARCH_x86 aoqi@0: # include "javaFrameAnchor_x86.hpp" aoqi@0: #endif aoqi@1: #ifdef TARGET_ARCH_mips aoqi@1: # include "javaFrameAnchor_mips.hpp" aoqi@1: #endif aoqi@0: #ifdef TARGET_ARCH_sparc aoqi@0: # include "javaFrameAnchor_sparc.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_ARCH_zero aoqi@0: # include "javaFrameAnchor_zero.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_ARCH_arm aoqi@0: # include "javaFrameAnchor_arm.hpp" aoqi@0: #endif aoqi@0: #ifdef TARGET_ARCH_ppc aoqi@0: # include "javaFrameAnchor_ppc.hpp" aoqi@0: #endif aoqi@0: aoqi@0: aoqi@0: public: aoqi@0: JavaFrameAnchor() { clear(); } aoqi@0: JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); } aoqi@0: aoqi@0: void set_last_Java_pc(address pc) { _last_Java_pc = pc; } aoqi@0: aoqi@0: // Assembly stub generation helpers aoqi@0: aoqi@0: static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); } aoqi@0: static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); } aoqi@0: aoqi@0: }; aoqi@0: aoqi@0: #endif // SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP