author | coleenp |
Wed, 21 Mar 2018 19:45:24 -0400 | |
changeset 49480 | d7df2dd501ce |
parent 47216 | 71c04702a3d5 |
child 51397 | c9150700bbd0 |
permissions | -rw-r--r-- |
42065 | 1 |
/* |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
42065 | 3 |
* Copyright (c) 2016 SAP SE. All rights reserved. |
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
26 |
#ifndef CPU_S390_VM_FRAME_S390_INLINE_HPP |
|
27 |
#define CPU_S390_VM_FRAME_S390_INLINE_HPP |
|
28 |
||
29 |
#include "code/codeCache.hpp" |
|
30 |
#include "code/vmreg.inline.hpp" |
|
46625 | 31 |
#include "utilities/align.hpp" |
42065 | 32 |
|
33 |
// Inline functions for z/Architecture frames: |
|
34 |
||
35 |
inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) { |
|
36 |
assert(pc != NULL, "precondition: must have PC"); |
|
37 |
||
38 |
_cb = CodeCache::find_blob(pc); |
|
39 |
_pc = pc; // Must be set for get_deopt_original_pc(). |
|
40 |
||
41 |
_fp = (intptr_t *) own_abi()->callers_sp; |
|
42 |
||
42556
c03d98321ad1
8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents:
42065
diff
changeset
|
43 |
address original_pc = CompiledMethod::get_deopt_original_pc(this); |
42065 | 44 |
if (original_pc != NULL) { |
45 |
_pc = original_pc; |
|
46 |
_deopt_state = is_deoptimized; |
|
47 |
} else { |
|
48 |
_deopt_state = not_deoptimized; |
|
49 |
} |
|
50 |
||
51 |
assert(((uint64_t)_sp & 0x7) == 0, "SP must be 8-byte aligned"); |
|
52 |
} |
|
53 |
||
54 |
// Constructors |
|
55 |
||
56 |
// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state. |
|
57 |
inline frame::frame() : _sp(NULL), _unextended_sp(NULL), _fp(NULL), _cb(NULL), _pc(NULL), _deopt_state(unknown) {} |
|
58 |
||
59 |
inline frame::frame(intptr_t* sp) : _sp(sp), _unextended_sp(sp) { |
|
60 |
find_codeblob_and_set_pc_and_deopt_state((address)own_abi()->return_pc); |
|
61 |
} |
|
62 |
||
63 |
inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _unextended_sp(sp) { |
|
64 |
find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp. |
|
65 |
} |
|
66 |
||
67 |
inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp), _unextended_sp(unextended_sp) { |
|
68 |
find_codeblob_and_set_pc_and_deopt_state(pc); // Also sets _fp and adjusts _unextended_sp. |
|
69 |
} |
|
70 |
||
71 |
// Generic constructor. Used by pns() in debug.cpp only |
|
72 |
#ifndef PRODUCT |
|
73 |
inline frame::frame(void* sp, void* pc, void* unextended_sp) : |
|
74 |
_sp((intptr_t*)sp), _unextended_sp((intptr_t*)unextended_sp), _cb(NULL), _pc(NULL) { |
|
75 |
find_codeblob_and_set_pc_and_deopt_state((address)pc); // Also sets _fp and adjusts _unextended_sp. |
|
76 |
} |
|
77 |
#endif |
|
78 |
||
79 |
// template interpreter state |
|
80 |
inline frame::z_ijava_state* frame::ijava_state() const { |
|
81 |
z_ijava_state* state = (z_ijava_state*) ((uintptr_t)fp() - z_ijava_state_size); |
|
82 |
assert(state->magic == (intptr_t) frame::z_istate_magic_number, |
|
83 |
"wrong z_ijava_state in interpreter frame (no magic found)"); |
|
84 |
return state; |
|
85 |
} |
|
86 |
||
87 |
inline BasicObjectLock** frame::interpreter_frame_monitors_addr() const { |
|
88 |
return (BasicObjectLock**) &(ijava_state()->monitors); |
|
89 |
} |
|
90 |
||
91 |
// The next two funcions read and write z_ijava_state.monitors. |
|
92 |
inline BasicObjectLock* frame::interpreter_frame_monitors() const { |
|
93 |
return *interpreter_frame_monitors_addr(); |
|
94 |
} |
|
95 |
inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) { |
|
96 |
*interpreter_frame_monitors_addr() = monitors; |
|
97 |
} |
|
98 |
||
99 |
// Accessors |
|
100 |
||
101 |
// Return unique id for this frame. The id must have a value where we |
|
102 |
// can distinguish identity and younger/older relationship. NULL |
|
103 |
// represents an invalid (incomparable) frame. |
|
104 |
inline intptr_t* frame::id(void) const { |
|
105 |
// Use _fp. _sp or _unextended_sp wouldn't be correct due to resizing. |
|
106 |
return _fp; |
|
107 |
} |
|
108 |
||
109 |
// Return true if this frame is younger (more recent activation) than |
|
110 |
// the frame represented by id. |
|
111 |
inline bool frame::is_younger(intptr_t* id) const { |
|
112 |
assert(this->id() != NULL && id != NULL, "NULL frame id"); |
|
113 |
// Stack grows towards smaller addresses on z/Architecture. |
|
114 |
return this->id() < id; |
|
115 |
} |
|
116 |
||
117 |
// Return true if this frame is older (less recent activation) than |
|
118 |
// the frame represented by id. |
|
119 |
inline bool frame::is_older(intptr_t* id) const { |
|
120 |
assert(this->id() != NULL && id != NULL, "NULL frame id"); |
|
121 |
// Stack grows towards smaller addresses on z/Architecture. |
|
122 |
return this->id() > id; |
|
123 |
} |
|
124 |
||
125 |
inline int frame::frame_size(RegisterMap* map) const { |
|
126 |
// Stack grows towards smaller addresses on z/Linux: sender is at a higher address. |
|
127 |
return sender_sp() - sp(); |
|
128 |
} |
|
129 |
||
130 |
// Ignore c2i adapter frames. |
|
131 |
inline intptr_t* frame::unextended_sp() const { |
|
132 |
return _unextended_sp; |
|
133 |
} |
|
134 |
||
135 |
inline address frame::sender_pc() const { |
|
136 |
return (address) callers_abi()->return_pc; |
|
137 |
} |
|
138 |
||
139 |
// Get caller pc, if caller is native from stack slot of gpr14. |
|
140 |
inline address frame::native_sender_pc() const { |
|
141 |
return (address) callers_abi()->gpr14; |
|
142 |
} |
|
143 |
||
144 |
// Get caller pc from stack slot of gpr10. |
|
145 |
inline address frame::callstub_sender_pc() const { |
|
146 |
return (address) callers_abi()->gpr10; |
|
147 |
} |
|
148 |
||
149 |
inline address* frame::sender_pc_addr() const { |
|
150 |
return (address*) &(callers_abi()->return_pc); |
|
151 |
} |
|
152 |
||
153 |
inline intptr_t* frame::sender_sp() const { |
|
154 |
return (intptr_t*) callers_abi(); |
|
155 |
} |
|
156 |
||
157 |
inline intptr_t* frame::link() const { |
|
158 |
return (intptr_t*) callers_abi()->callers_sp; |
|
159 |
} |
|
160 |
||
161 |
inline intptr_t** frame::interpreter_frame_locals_addr() const { |
|
162 |
return (intptr_t**) &(ijava_state()->locals); |
|
163 |
} |
|
164 |
||
165 |
inline intptr_t* frame::interpreter_frame_bcp_addr() const { |
|
166 |
return (intptr_t*) &(ijava_state()->bcp); |
|
167 |
} |
|
168 |
||
169 |
inline intptr_t* frame::interpreter_frame_mdp_addr() const { |
|
170 |
return (intptr_t*) &(ijava_state()->mdx); |
|
171 |
} |
|
172 |
||
173 |
// Bottom(base) of the expression stack (highest address). |
|
174 |
inline intptr_t* frame::interpreter_frame_expression_stack() const { |
|
175 |
return (intptr_t*)interpreter_frame_monitor_end() - 1; |
|
176 |
} |
|
177 |
||
178 |
inline intptr_t* frame::interpreter_frame_tos_at(jint offset) const { |
|
179 |
return &interpreter_frame_tos_address()[offset]; |
|
180 |
} |
|
181 |
||
182 |
||
183 |
// monitor elements |
|
184 |
||
185 |
// End is lower in memory than begin, and beginning element is oldest element. |
|
186 |
// Also begin is one past last monitor. |
|
187 |
||
188 |
inline intptr_t* frame::interpreter_frame_top_frame_sp() { |
|
189 |
return (intptr_t*)ijava_state()->top_frame_sp; |
|
190 |
} |
|
191 |
||
192 |
inline void frame::interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp) { |
|
193 |
ijava_state()->top_frame_sp = (intptr_t) top_frame_sp; |
|
194 |
} |
|
195 |
||
196 |
inline void frame::interpreter_frame_set_sender_sp(intptr_t* sender_sp) { |
|
197 |
ijava_state()->sender_sp = (intptr_t) sender_sp; |
|
198 |
} |
|
199 |
||
200 |
#ifdef ASSERT |
|
201 |
inline void frame::interpreter_frame_set_magic() { |
|
202 |
ijava_state()->magic = (intptr_t) frame::z_istate_magic_number; |
|
203 |
} |
|
204 |
#endif |
|
205 |
||
206 |
// Where z_ijava_state.esp is saved. |
|
207 |
inline intptr_t** frame::interpreter_frame_esp_addr() const { |
|
208 |
return (intptr_t**) &(ijava_state()->esp); |
|
209 |
} |
|
210 |
||
211 |
// top of expression stack (lowest address) |
|
212 |
inline intptr_t* frame::interpreter_frame_tos_address() const { |
|
213 |
return *interpreter_frame_esp_addr() + 1; |
|
214 |
} |
|
215 |
||
216 |
inline void frame::interpreter_frame_set_tos_address(intptr_t* x) { |
|
217 |
*interpreter_frame_esp_addr() = x - 1; |
|
218 |
} |
|
219 |
||
220 |
// Stack slot needed for native calls and GC. |
|
221 |
inline oop * frame::interpreter_frame_temp_oop_addr() const { |
|
222 |
return (oop *) ((address) _fp + _z_ijava_state_neg(oop_tmp)); |
|
223 |
} |
|
224 |
||
225 |
// In keeping with Intel side: end is lower in memory than begin. |
|
226 |
// Beginning element is oldest element. Also begin is one past last monitor. |
|
227 |
inline BasicObjectLock * frame::interpreter_frame_monitor_begin() const { |
|
228 |
return (BasicObjectLock*)ijava_state(); |
|
229 |
} |
|
230 |
||
231 |
inline BasicObjectLock * frame::interpreter_frame_monitor_end() const { |
|
232 |
return interpreter_frame_monitors(); |
|
233 |
} |
|
234 |
||
235 |
inline void frame::interpreter_frame_set_monitor_end(BasicObjectLock* monitors) { |
|
236 |
interpreter_frame_set_monitors((BasicObjectLock *)monitors); |
|
237 |
} |
|
238 |
||
239 |
inline int frame::interpreter_frame_monitor_size() { |
|
240 |
// Number of stack slots for a monitor |
|
46620
750c6edff33b
8178500: Replace usages of round_to and round_down with align_up and align_down
stefank
parents:
42556
diff
changeset
|
241 |
return align_up(BasicObjectLock::size() /* number of stack slots */, |
42065 | 242 |
WordsPerLong /* Number of stack slots for a Java long. */); |
243 |
} |
|
244 |
||
245 |
inline int frame::interpreter_frame_monitor_size_in_bytes() { |
|
246 |
// Number of bytes for a monitor. |
|
247 |
return frame::interpreter_frame_monitor_size() * wordSize; |
|
248 |
} |
|
249 |
||
250 |
inline int frame::interpreter_frame_interpreterstate_size_in_bytes() { |
|
251 |
return z_ijava_state_size; |
|
252 |
} |
|
253 |
||
254 |
inline Method** frame::interpreter_frame_method_addr() const { |
|
255 |
return (Method**)&(ijava_state()->method); |
|
256 |
} |
|
257 |
||
258 |
inline oop* frame::interpreter_frame_mirror_addr() const { |
|
259 |
return (oop*)&(ijava_state()->mirror); |
|
260 |
} |
|
261 |
||
262 |
// Constant pool cache |
|
263 |
||
264 |
inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const { |
|
265 |
return (ConstantPoolCache**)&(ijava_state()->cpoolCache); |
|
266 |
} |
|
267 |
||
268 |
// entry frames |
|
269 |
||
270 |
inline intptr_t* frame::entry_frame_argument_at(int offset) const { |
|
271 |
// Since an entry frame always calls the interpreter first, |
|
272 |
// the parameters are on the stack and relative to known register in the |
|
273 |
// entry frame. |
|
274 |
intptr_t* tos = (intptr_t*) entry_frame_locals()->arguments_tos_address; |
|
275 |
return &tos[offset + 1]; // prepushed tos |
|
276 |
} |
|
277 |
||
278 |
inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const { |
|
279 |
return (JavaCallWrapper**) &entry_frame_locals()->call_wrapper_address; |
|
280 |
} |
|
281 |
||
282 |
inline oop frame::saved_oop_result(RegisterMap* map) const { |
|
283 |
return *((oop*) map->location(Z_R2->as_VMReg())); // R2 is return register. |
|
284 |
} |
|
285 |
||
286 |
inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) { |
|
287 |
*((oop*) map->location(Z_R2->as_VMReg())) = obj; // R2 is return register. |
|
288 |
} |
|
289 |
||
290 |
inline intptr_t* frame::real_fp() const { |
|
291 |
return fp(); |
|
292 |
} |
|
293 |
||
294 |
#endif // CPU_S390_VM_FRAME_S390_INLINE_HPP |