Thu, 12 Oct 2017 21:27:07 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@1 | 25 | /* |
aoqi@1 | 26 | * This file has been modified by Loongson Technology in 2015. These |
aoqi@1 | 27 | * modifications are Copyright (c) 2015 Loongson Technology, and are made |
aoqi@1 | 28 | * available on the same license terms set forth above. |
aoqi@1 | 29 | */ |
aoqi@1 | 30 | |
aoqi@0 | 31 | #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |
aoqi@0 | 32 | #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |
aoqi@0 | 33 | |
aoqi@0 | 34 | #include "utilities/globalDefinitions.hpp" |
goetz@6911 | 35 | #include "runtime/orderAccess.inline.hpp" |
aoqi@0 | 36 | |
aoqi@0 | 37 | // |
aoqi@0 | 38 | // An object for encapsulating the machine/os dependent part of a JavaThread frame state |
aoqi@0 | 39 | // |
aoqi@0 | 40 | class JavaThread; |
aoqi@0 | 41 | |
aoqi@0 | 42 | class JavaFrameAnchor VALUE_OBJ_CLASS_SPEC { |
aoqi@0 | 43 | // Too many friends... |
aoqi@0 | 44 | friend class CallNativeDirectNode; |
aoqi@0 | 45 | friend class OptoRuntime; |
aoqi@0 | 46 | friend class Runtime1; |
aoqi@0 | 47 | friend class StubAssembler; |
aoqi@0 | 48 | friend class CallRuntimeDirectNode; |
aoqi@0 | 49 | friend class MacroAssembler; |
aoqi@0 | 50 | friend class InterpreterGenerator; |
aoqi@0 | 51 | friend class LIR_Assembler; |
aoqi@0 | 52 | friend class GraphKit; |
aoqi@0 | 53 | friend class StubGenerator; |
aoqi@0 | 54 | friend class JavaThread; |
aoqi@0 | 55 | friend class frame; |
aoqi@0 | 56 | friend class VMStructs; |
aoqi@0 | 57 | friend class BytecodeInterpreter; |
aoqi@0 | 58 | friend class JavaCallWrapper; |
aoqi@0 | 59 | |
aoqi@0 | 60 | private: |
aoqi@0 | 61 | // |
aoqi@0 | 62 | // Whenever _last_Java_sp != NULL other anchor fields MUST be valid! |
aoqi@0 | 63 | // The stack may not be walkable [check with walkable() ] but the values must be valid. |
aoqi@0 | 64 | // The profiler apparently depends on this. |
aoqi@0 | 65 | // |
aoqi@0 | 66 | intptr_t* volatile _last_Java_sp; |
aoqi@0 | 67 | |
aoqi@0 | 68 | // Whenever we call from Java to native we can not be assured that the return |
aoqi@0 | 69 | // address that composes the last_Java_frame will be in an accessible location |
aoqi@0 | 70 | // so calls from Java to native store that pc (or one good enough to locate |
aoqi@0 | 71 | // the oopmap) in the frame anchor. Since the frames that call from Java to |
aoqi@0 | 72 | // native are never deoptimized we never need to patch the pc and so this |
aoqi@0 | 73 | // is acceptable. |
aoqi@0 | 74 | volatile address _last_Java_pc; |
aoqi@0 | 75 | |
aoqi@0 | 76 | // tells whether the last Java frame is set |
aoqi@0 | 77 | // It is important that when last_Java_sp != NULL that the rest of the frame |
aoqi@0 | 78 | // anchor (including platform specific) all be valid. |
aoqi@0 | 79 | |
aoqi@0 | 80 | bool has_last_Java_frame() const { return _last_Java_sp != NULL; } |
aoqi@0 | 81 | // This is very dangerous unless sp == NULL |
aoqi@0 | 82 | // Invalidate the anchor so that has_last_frame is false |
aoqi@0 | 83 | // and no one should look at the other fields. |
aoqi@0 | 84 | void zap(void) { _last_Java_sp = NULL; } |
aoqi@0 | 85 | |
aoqi@0 | 86 | #ifdef TARGET_ARCH_x86 |
aoqi@0 | 87 | # include "javaFrameAnchor_x86.hpp" |
aoqi@0 | 88 | #endif |
aoqi@1 | 89 | #ifdef TARGET_ARCH_mips |
aoqi@1 | 90 | # include "javaFrameAnchor_mips.hpp" |
aoqi@1 | 91 | #endif |
aoqi@0 | 92 | #ifdef TARGET_ARCH_sparc |
aoqi@0 | 93 | # include "javaFrameAnchor_sparc.hpp" |
aoqi@0 | 94 | #endif |
aoqi@0 | 95 | #ifdef TARGET_ARCH_zero |
aoqi@0 | 96 | # include "javaFrameAnchor_zero.hpp" |
aoqi@0 | 97 | #endif |
aoqi@0 | 98 | #ifdef TARGET_ARCH_arm |
aoqi@0 | 99 | # include "javaFrameAnchor_arm.hpp" |
aoqi@0 | 100 | #endif |
aoqi@0 | 101 | #ifdef TARGET_ARCH_ppc |
aoqi@0 | 102 | # include "javaFrameAnchor_ppc.hpp" |
aoqi@0 | 103 | #endif |
aoqi@0 | 104 | |
aoqi@0 | 105 | |
aoqi@0 | 106 | public: |
aoqi@0 | 107 | JavaFrameAnchor() { clear(); } |
aoqi@0 | 108 | JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); } |
aoqi@0 | 109 | |
aoqi@0 | 110 | void set_last_Java_pc(address pc) { _last_Java_pc = pc; } |
aoqi@0 | 111 | |
aoqi@0 | 112 | // Assembly stub generation helpers |
aoqi@0 | 113 | |
aoqi@0 | 114 | static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); } |
aoqi@0 | 115 | static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); } |
aoqi@0 | 116 | |
aoqi@0 | 117 | }; |
aoqi@0 | 118 | |
aoqi@0 | 119 | #endif // SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |