1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/runtime/javaFrameAnchor.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,142 @@ 1.4 +/* 1.5 + * Copyright (c) 2002, 2011, 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 +#ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP 1.29 +#define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP 1.30 + 1.31 +#include "utilities/globalDefinitions.hpp" 1.32 +#ifdef TARGET_OS_ARCH_linux_x86 1.33 +# include "orderAccess_linux_x86.inline.hpp" 1.34 +#endif 1.35 +#ifdef TARGET_OS_ARCH_linux_sparc 1.36 +# include "orderAccess_linux_sparc.inline.hpp" 1.37 +#endif 1.38 +#ifdef TARGET_OS_ARCH_linux_zero 1.39 +# include "orderAccess_linux_zero.inline.hpp" 1.40 +#endif 1.41 +#ifdef TARGET_OS_ARCH_solaris_x86 1.42 +# include "orderAccess_solaris_x86.inline.hpp" 1.43 +#endif 1.44 +#ifdef TARGET_OS_ARCH_solaris_sparc 1.45 +# include "orderAccess_solaris_sparc.inline.hpp" 1.46 +#endif 1.47 +#ifdef TARGET_OS_ARCH_windows_x86 1.48 +# include "orderAccess_windows_x86.inline.hpp" 1.49 +#endif 1.50 +#ifdef TARGET_OS_ARCH_linux_arm 1.51 +# include "orderAccess_linux_arm.inline.hpp" 1.52 +#endif 1.53 +#ifdef TARGET_OS_ARCH_linux_ppc 1.54 +# include "orderAccess_linux_ppc.inline.hpp" 1.55 +#endif 1.56 +#ifdef TARGET_OS_ARCH_aix_ppc 1.57 +# include "orderAccess_aix_ppc.inline.hpp" 1.58 +#endif 1.59 +#ifdef TARGET_OS_ARCH_bsd_x86 1.60 +# include "orderAccess_bsd_x86.inline.hpp" 1.61 +#endif 1.62 +#ifdef TARGET_OS_ARCH_bsd_zero 1.63 +# include "orderAccess_bsd_zero.inline.hpp" 1.64 +#endif 1.65 + 1.66 +// 1.67 +// An object for encapsulating the machine/os dependent part of a JavaThread frame state 1.68 +// 1.69 +class JavaThread; 1.70 + 1.71 +class JavaFrameAnchor VALUE_OBJ_CLASS_SPEC { 1.72 +// Too many friends... 1.73 +friend class CallNativeDirectNode; 1.74 +friend class OptoRuntime; 1.75 +friend class Runtime1; 1.76 +friend class StubAssembler; 1.77 +friend class CallRuntimeDirectNode; 1.78 +friend class MacroAssembler; 1.79 +friend class InterpreterGenerator; 1.80 +friend class LIR_Assembler; 1.81 +friend class GraphKit; 1.82 +friend class StubGenerator; 1.83 +friend class JavaThread; 1.84 +friend class frame; 1.85 +friend class VMStructs; 1.86 +friend class BytecodeInterpreter; 1.87 +friend class JavaCallWrapper; 1.88 + 1.89 + private: 1.90 + // 1.91 + // Whenever _last_Java_sp != NULL other anchor fields MUST be valid! 1.92 + // The stack may not be walkable [check with walkable() ] but the values must be valid. 1.93 + // The profiler apparently depends on this. 1.94 + // 1.95 + intptr_t* volatile _last_Java_sp; 1.96 + 1.97 + // Whenever we call from Java to native we can not be assured that the return 1.98 + // address that composes the last_Java_frame will be in an accessible location 1.99 + // so calls from Java to native store that pc (or one good enough to locate 1.100 + // the oopmap) in the frame anchor. Since the frames that call from Java to 1.101 + // native are never deoptimized we never need to patch the pc and so this 1.102 + // is acceptable. 1.103 + volatile address _last_Java_pc; 1.104 + 1.105 + // tells whether the last Java frame is set 1.106 + // It is important that when last_Java_sp != NULL that the rest of the frame 1.107 + // anchor (including platform specific) all be valid. 1.108 + 1.109 + bool has_last_Java_frame() const { return _last_Java_sp != NULL; } 1.110 + // This is very dangerous unless sp == NULL 1.111 + // Invalidate the anchor so that has_last_frame is false 1.112 + // and no one should look at the other fields. 1.113 + void zap(void) { _last_Java_sp = NULL; } 1.114 + 1.115 +#ifdef TARGET_ARCH_x86 1.116 +# include "javaFrameAnchor_x86.hpp" 1.117 +#endif 1.118 +#ifdef TARGET_ARCH_sparc 1.119 +# include "javaFrameAnchor_sparc.hpp" 1.120 +#endif 1.121 +#ifdef TARGET_ARCH_zero 1.122 +# include "javaFrameAnchor_zero.hpp" 1.123 +#endif 1.124 +#ifdef TARGET_ARCH_arm 1.125 +# include "javaFrameAnchor_arm.hpp" 1.126 +#endif 1.127 +#ifdef TARGET_ARCH_ppc 1.128 +# include "javaFrameAnchor_ppc.hpp" 1.129 +#endif 1.130 + 1.131 + 1.132 +public: 1.133 + JavaFrameAnchor() { clear(); } 1.134 + JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); } 1.135 + 1.136 + void set_last_Java_pc(address pc) { _last_Java_pc = pc; } 1.137 + 1.138 + // Assembly stub generation helpers 1.139 + 1.140 + static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); } 1.141 + static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); } 1.142 + 1.143 +}; 1.144 + 1.145 +#endif // SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP