author | jrose |
Wed, 08 Jun 2011 17:04:06 -0700 | |
changeset 9978 | 80c391c46474 |
parent 9630 | d6419e4395e3 |
child 13728 | 882756847a04 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4896
diff
changeset
|
2 |
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4896
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4896
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4896
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef CPU_X86_VM_FRAME_X86_INLINE_HPP |
26 |
#define CPU_X86_VM_FRAME_X86_INLINE_HPP |
|
27 |
||
1 | 28 |
// Inline functions for Intel frames: |
29 |
||
30 |
// Constructors: |
|
31 |
||
32 |
inline frame::frame() { |
|
33 |
_pc = NULL; |
|
34 |
_sp = NULL; |
|
35 |
_unextended_sp = NULL; |
|
36 |
_fp = NULL; |
|
37 |
_cb = NULL; |
|
38 |
_deopt_state = unknown; |
|
39 |
} |
|
40 |
||
4752 | 41 |
inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) { |
1 | 42 |
_sp = sp; |
43 |
_unextended_sp = sp; |
|
44 |
_fp = fp; |
|
45 |
_pc = pc; |
|
46 |
assert(pc != NULL, "no pc?"); |
|
47 |
_cb = CodeCache::find_blob(pc); |
|
9978
80c391c46474
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
9630
diff
changeset
|
48 |
adjust_unextended_sp(); |
4752 | 49 |
|
50 |
address original_pc = nmethod::get_deopt_original_pc(this); |
|
51 |
if (original_pc != NULL) { |
|
52 |
_pc = original_pc; |
|
1 | 53 |
_deopt_state = is_deoptimized; |
54 |
} else { |
|
55 |
_deopt_state = not_deoptimized; |
|
56 |
} |
|
57 |
} |
|
58 |
||
4752 | 59 |
inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) { |
1 | 60 |
_sp = sp; |
61 |
_unextended_sp = unextended_sp; |
|
62 |
_fp = fp; |
|
63 |
_pc = pc; |
|
64 |
assert(pc != NULL, "no pc?"); |
|
65 |
_cb = CodeCache::find_blob(pc); |
|
9630
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
66 |
adjust_unextended_sp(); |
4752 | 67 |
|
68 |
address original_pc = nmethod::get_deopt_original_pc(this); |
|
69 |
if (original_pc != NULL) { |
|
70 |
_pc = original_pc; |
|
6418 | 71 |
assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod"); |
1 | 72 |
_deopt_state = is_deoptimized; |
73 |
} else { |
|
74 |
_deopt_state = not_deoptimized; |
|
75 |
} |
|
76 |
} |
|
77 |
||
78 |
inline frame::frame(intptr_t* sp, intptr_t* fp) { |
|
79 |
_sp = sp; |
|
80 |
_unextended_sp = sp; |
|
81 |
_fp = fp; |
|
82 |
_pc = (address)(sp[-1]); |
|
354
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
83 |
|
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
84 |
// Here's a sticky one. This constructor can be called via AsyncGetCallTrace |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
85 |
// when last_Java_sp is non-null but the pc fetched is junk. If we are truly |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
86 |
// unlucky the junk value could be to a zombied method and we'll die on the |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
87 |
// find_blob call. This is also why we can have no asserts on the validity |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
88 |
// of the pc we find here. AsyncGetCallTrace -> pd_get_top_frame_for_signal_handler |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
89 |
// -> pd_last_frame should use a specialized version of pd_last_frame which could |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
90 |
// call a specilaized frame constructor instead of this one. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
91 |
// Then we could use the assert below. However this assert is of somewhat dubious |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
92 |
// value. |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
93 |
// assert(_pc != NULL, "no pc?"); |
3b42d6fdcb82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
1
diff
changeset
|
94 |
|
1 | 95 |
_cb = CodeCache::find_blob(_pc); |
9978
80c391c46474
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
9630
diff
changeset
|
96 |
adjust_unextended_sp(); |
1 | 97 |
|
4752 | 98 |
address original_pc = nmethod::get_deopt_original_pc(this); |
99 |
if (original_pc != NULL) { |
|
100 |
_pc = original_pc; |
|
1 | 101 |
_deopt_state = is_deoptimized; |
102 |
} else { |
|
103 |
_deopt_state = not_deoptimized; |
|
104 |
} |
|
105 |
} |
|
106 |
||
107 |
// Accessors |
|
108 |
||
109 |
inline bool frame::equal(frame other) const { |
|
110 |
bool ret = sp() == other.sp() |
|
111 |
&& unextended_sp() == other.unextended_sp() |
|
112 |
&& fp() == other.fp() |
|
113 |
&& pc() == other.pc(); |
|
114 |
assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction"); |
|
115 |
return ret; |
|
116 |
} |
|
117 |
||
118 |
// Return unique id for this frame. The id must have a value where we can distinguish |
|
119 |
// identity and younger/older relationship. NULL represents an invalid (incomparable) |
|
120 |
// frame. |
|
121 |
inline intptr_t* frame::id(void) const { return unextended_sp(); } |
|
122 |
||
123 |
// Relationals on frames based |
|
124 |
// Return true if the frame is younger (more recent activation) than the frame represented by id |
|
125 |
inline bool frame::is_younger(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); |
|
126 |
return this->id() < id ; } |
|
127 |
||
128 |
// Return true if the frame is older (less recent activation) than the frame represented by id |
|
129 |
inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); |
|
130 |
return this->id() > id ; } |
|
131 |
||
132 |
||
133 |
||
134 |
inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); } |
|
135 |
inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; } |
|
136 |
||
137 |
||
138 |
inline intptr_t* frame::unextended_sp() const { return _unextended_sp; } |
|
139 |
||
140 |
// Return address: |
|
141 |
||
142 |
inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); } |
|
143 |
inline address frame::sender_pc() const { return *sender_pc_addr(); } |
|
144 |
||
145 |
// return address of param, zero origin index. |
|
146 |
inline address* frame::native_param_addr(int idx) const { return (address*) addr_at( native_frame_initial_param_offset+idx); } |
|
147 |
||
148 |
#ifdef CC_INTERP |
|
149 |
||
150 |
inline interpreterState frame::get_interpreterState() const { |
|
1896
cce23a9ff495
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
1066
diff
changeset
|
151 |
return ((interpreterState)addr_at( -((int)sizeof(BytecodeInterpreter))/wordSize )); |
1 | 152 |
} |
153 |
||
154 |
inline intptr_t* frame::sender_sp() const { |
|
155 |
// Hmm this seems awfully expensive QQQ, is this really called with interpreted frames? |
|
156 |
if (is_interpreted_frame()) { |
|
157 |
assert(false, "should never happen"); |
|
158 |
return get_interpreterState()->sender_sp(); |
|
159 |
} else { |
|
160 |
return addr_at(sender_sp_offset); |
|
161 |
} |
|
162 |
} |
|
163 |
||
164 |
inline intptr_t** frame::interpreter_frame_locals_addr() const { |
|
165 |
assert(is_interpreted_frame(), "must be interpreted"); |
|
166 |
return &(get_interpreterState()->_locals); |
|
167 |
} |
|
168 |
||
169 |
inline intptr_t* frame::interpreter_frame_bcx_addr() const { |
|
170 |
assert(is_interpreted_frame(), "must be interpreted"); |
|
1066 | 171 |
return (intptr_t*) &(get_interpreterState()->_bcp); |
1 | 172 |
} |
173 |
||
174 |
||
175 |
// Constant pool cache |
|
176 |
||
177 |
inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const { |
|
178 |
assert(is_interpreted_frame(), "must be interpreted"); |
|
179 |
return &(get_interpreterState()->_constants); |
|
180 |
} |
|
181 |
||
182 |
// Method |
|
183 |
||
184 |
inline methodOop* frame::interpreter_frame_method_addr() const { |
|
185 |
assert(is_interpreted_frame(), "must be interpreted"); |
|
186 |
return &(get_interpreterState()->_method); |
|
187 |
} |
|
188 |
||
189 |
inline intptr_t* frame::interpreter_frame_mdx_addr() const { |
|
190 |
assert(is_interpreted_frame(), "must be interpreted"); |
|
1066 | 191 |
return (intptr_t*) &(get_interpreterState()->_mdx); |
1 | 192 |
} |
193 |
||
194 |
// top of expression stack |
|
195 |
inline intptr_t* frame::interpreter_frame_tos_address() const { |
|
196 |
assert(is_interpreted_frame(), "wrong frame type"); |
|
197 |
return get_interpreterState()->_stack + 1; |
|
198 |
} |
|
199 |
||
200 |
#else /* asm interpreter */ |
|
201 |
inline intptr_t* frame::sender_sp() const { return addr_at( sender_sp_offset); } |
|
202 |
||
203 |
inline intptr_t** frame::interpreter_frame_locals_addr() const { |
|
204 |
return (intptr_t**)addr_at(interpreter_frame_locals_offset); |
|
205 |
} |
|
206 |
||
207 |
inline intptr_t* frame::interpreter_frame_last_sp() const { |
|
208 |
return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset); |
|
209 |
} |
|
210 |
||
211 |
inline intptr_t* frame::interpreter_frame_bcx_addr() const { |
|
212 |
return (intptr_t*)addr_at(interpreter_frame_bcx_offset); |
|
213 |
} |
|
214 |
||
215 |
||
216 |
inline intptr_t* frame::interpreter_frame_mdx_addr() const { |
|
217 |
return (intptr_t*)addr_at(interpreter_frame_mdx_offset); |
|
218 |
} |
|
219 |
||
220 |
||
221 |
||
222 |
// Constant pool cache |
|
223 |
||
224 |
inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const { |
|
225 |
return (constantPoolCacheOop*)addr_at(interpreter_frame_cache_offset); |
|
226 |
} |
|
227 |
||
228 |
// Method |
|
229 |
||
230 |
inline methodOop* frame::interpreter_frame_method_addr() const { |
|
231 |
return (methodOop*)addr_at(interpreter_frame_method_offset); |
|
232 |
} |
|
233 |
||
234 |
// top of expression stack |
|
235 |
inline intptr_t* frame::interpreter_frame_tos_address() const { |
|
236 |
intptr_t* last_sp = interpreter_frame_last_sp(); |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
2105
diff
changeset
|
237 |
if (last_sp == NULL) { |
1 | 238 |
return sp(); |
239 |
} else { |
|
4566
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
2105
diff
changeset
|
240 |
// sp() may have been extended or shrunk by an adapter. At least |
b363f6ef4068
6829187: compiler optimizations required for JSR 292
twisti
parents:
2105
diff
changeset
|
241 |
// check that we don't fall behind the legal region. |
4896
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
242 |
// For top deoptimized frame last_sp == interpreter_frame_monitor_end. |
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
243 |
assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos"); |
1 | 244 |
return last_sp; |
245 |
} |
|
246 |
} |
|
247 |
||
248 |
#endif /* CC_INTERP */ |
|
249 |
||
250 |
inline int frame::pd_oop_map_offset_adjustment() const { |
|
251 |
return 0; |
|
252 |
} |
|
253 |
||
254 |
inline int frame::interpreter_frame_monitor_size() { |
|
255 |
return BasicObjectLock::size(); |
|
256 |
} |
|
257 |
||
258 |
||
259 |
// expression stack |
|
260 |
// (the max_stack arguments are used by the GC; see class FrameClosure) |
|
261 |
||
262 |
inline intptr_t* frame::interpreter_frame_expression_stack() const { |
|
263 |
intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end(); |
|
264 |
return monitor_end-1; |
|
265 |
} |
|
266 |
||
267 |
||
268 |
inline jint frame::interpreter_frame_expression_stack_direction() { return -1; } |
|
269 |
||
270 |
||
271 |
// Entry frames |
|
272 |
||
273 |
inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { |
|
274 |
return (JavaCallWrapper*)at(entry_frame_call_wrapper_offset); |
|
275 |
} |
|
276 |
||
277 |
||
278 |
// Compiled frames |
|
279 |
||
280 |
inline int frame::local_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) { |
|
281 |
return (nof_args - local_index + (local_index < nof_args ? 1: -1)); |
|
282 |
} |
|
283 |
||
284 |
inline int frame::monitor_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) { |
|
285 |
return local_offset_for_compiler(local_index, nof_args, max_nof_locals, max_nof_monitors); |
|
286 |
} |
|
287 |
||
288 |
inline int frame::min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors) { |
|
289 |
return (nof_args - (max_nof_locals + max_nof_monitors*2) - 1); |
|
290 |
} |
|
291 |
||
292 |
inline bool frame::volatile_across_calls(Register reg) { |
|
293 |
return true; |
|
294 |
} |
|
295 |
||
296 |
||
297 |
||
298 |
inline oop frame::saved_oop_result(RegisterMap* map) const { |
|
299 |
return *((oop*) map->location(rax->as_VMReg())); |
|
300 |
} |
|
301 |
||
302 |
inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) { |
|
303 |
*((oop*) map->location(rax->as_VMReg())) = obj; |
|
304 |
} |
|
7397 | 305 |
|
306 |
#endif // CPU_X86_VM_FRAME_X86_INLINE_HPP |