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