author | zgu |
Sat, 11 Dec 2010 13:20:56 -0500 | |
changeset 7447 | 32c42d627f41 |
parent 7397 | 5b173b4ca846 |
child 7448 | 11b630d174d5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5426
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:
5426
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5426
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:
5426
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "gc_interface/collectedHeap.inline.hpp" |
|
27 |
#include "interpreter/interpreter.hpp" |
|
28 |
#include "interpreter/oopMapCache.hpp" |
|
29 |
#include "memory/resourceArea.hpp" |
|
30 |
#include "memory/universe.inline.hpp" |
|
31 |
#include "oops/markOop.hpp" |
|
32 |
#include "oops/methodDataOop.hpp" |
|
33 |
#include "oops/methodOop.hpp" |
|
34 |
#include "oops/oop.inline.hpp" |
|
35 |
#include "oops/oop.inline2.hpp" |
|
36 |
#include "runtime/frame.inline.hpp" |
|
37 |
#include "runtime/handles.inline.hpp" |
|
38 |
#include "runtime/javaCalls.hpp" |
|
39 |
#include "runtime/monitorChunk.hpp" |
|
40 |
#include "runtime/sharedRuntime.hpp" |
|
41 |
#include "runtime/signature.hpp" |
|
42 |
#include "runtime/stubCodeGenerator.hpp" |
|
43 |
#include "runtime/stubRoutines.hpp" |
|
7447
32c42d627f41
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
7397
diff
changeset
|
44 |
#include "utilities/decoder.hpp" |
32c42d627f41
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
7397
diff
changeset
|
45 |
|
7397 | 46 |
#ifdef TARGET_ARCH_x86 |
47 |
# include "nativeInst_x86.hpp" |
|
48 |
#endif |
|
49 |
#ifdef TARGET_ARCH_sparc |
|
50 |
# include "nativeInst_sparc.hpp" |
|
51 |
#endif |
|
52 |
#ifdef TARGET_ARCH_zero |
|
53 |
# include "nativeInst_zero.hpp" |
|
54 |
#endif |
|
1 | 55 |
|
56 |
RegisterMap::RegisterMap(JavaThread *thread, bool update_map) { |
|
57 |
_thread = thread; |
|
58 |
_update_map = update_map; |
|
59 |
clear(); |
|
60 |
debug_only(_update_for_id = NULL;) |
|
61 |
#ifndef PRODUCT |
|
62 |
for (int i = 0; i < reg_count ; i++ ) _location[i] = NULL; |
|
63 |
#endif /* PRODUCT */ |
|
64 |
} |
|
65 |
||
66 |
RegisterMap::RegisterMap(const RegisterMap* map) { |
|
67 |
assert(map != this, "bad initialization parameter"); |
|
68 |
assert(map != NULL, "RegisterMap must be present"); |
|
69 |
_thread = map->thread(); |
|
70 |
_update_map = map->update_map(); |
|
71 |
_include_argument_oops = map->include_argument_oops(); |
|
72 |
debug_only(_update_for_id = map->_update_for_id;) |
|
73 |
pd_initialize_from(map); |
|
74 |
if (update_map()) { |
|
75 |
for(int i = 0; i < location_valid_size; i++) { |
|
76 |
LocationValidType bits = !update_map() ? 0 : map->_location_valid[i]; |
|
77 |
_location_valid[i] = bits; |
|
78 |
// for whichever bits are set, pull in the corresponding map->_location |
|
79 |
int j = i*location_valid_type_size; |
|
80 |
while (bits != 0) { |
|
81 |
if ((bits & 1) != 0) { |
|
82 |
assert(0 <= j && j < reg_count, "range check"); |
|
83 |
_location[j] = map->_location[j]; |
|
84 |
} |
|
85 |
bits >>= 1; |
|
86 |
j += 1; |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
} |
|
91 |
||
92 |
void RegisterMap::clear() { |
|
93 |
set_include_argument_oops(true); |
|
94 |
if (_update_map) { |
|
95 |
for(int i = 0; i < location_valid_size; i++) { |
|
96 |
_location_valid[i] = 0; |
|
97 |
} |
|
98 |
pd_clear(); |
|
99 |
} else { |
|
100 |
pd_initialize(); |
|
101 |
} |
|
102 |
} |
|
103 |
||
104 |
#ifndef PRODUCT |
|
105 |
||
106 |
void RegisterMap::print_on(outputStream* st) const { |
|
107 |
st->print_cr("Register map"); |
|
108 |
for(int i = 0; i < reg_count; i++) { |
|
109 |
||
110 |
VMReg r = VMRegImpl::as_VMReg(i); |
|
111 |
intptr_t* src = (intptr_t*) location(r); |
|
112 |
if (src != NULL) { |
|
113 |
||
1497 | 114 |
r->print_on(st); |
115 |
st->print(" [" INTPTR_FORMAT "] = ", src); |
|
1 | 116 |
if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { |
1497 | 117 |
st->print_cr("<misaligned>"); |
1 | 118 |
} else { |
1497 | 119 |
st->print_cr(INTPTR_FORMAT, *src); |
1 | 120 |
} |
121 |
} |
|
122 |
} |
|
123 |
} |
|
124 |
||
125 |
void RegisterMap::print() const { |
|
126 |
print_on(tty); |
|
127 |
} |
|
128 |
||
129 |
#endif |
|
130 |
// This returns the pc that if you were in the debugger you'd see. Not |
|
131 |
// the idealized value in the frame object. This undoes the magic conversion |
|
132 |
// that happens for deoptimized frames. In addition it makes the value the |
|
133 |
// hardware would want to see in the native frame. The only user (at this point) |
|
134 |
// is deoptimization. It likely no one else should ever use it. |
|
135 |
||
136 |
address frame::raw_pc() const { |
|
137 |
if (is_deoptimized_frame()) { |
|
4752 | 138 |
nmethod* nm = cb()->as_nmethod_or_null(); |
139 |
if (nm->is_method_handle_return(pc())) |
|
140 |
return nm->deopt_mh_handler_begin() - pc_return_offset; |
|
141 |
else |
|
142 |
return nm->deopt_handler_begin() - pc_return_offset; |
|
1 | 143 |
} else { |
144 |
return (pc() - pc_return_offset); |
|
145 |
} |
|
146 |
} |
|
147 |
||
148 |
// Change the pc in a frame object. This does not change the actual pc in |
|
149 |
// actual frame. To do that use patch_pc. |
|
150 |
// |
|
151 |
void frame::set_pc(address newpc ) { |
|
152 |
#ifdef ASSERT |
|
153 |
if (_cb != NULL && _cb->is_nmethod()) { |
|
154 |
assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant violation"); |
|
155 |
} |
|
156 |
#endif // ASSERT |
|
157 |
||
158 |
// Unsafe to use the is_deoptimzed tester after changing pc |
|
159 |
_deopt_state = unknown; |
|
160 |
_pc = newpc; |
|
161 |
_cb = CodeCache::find_blob_unsafe(_pc); |
|
162 |
||
163 |
} |
|
164 |
||
165 |
// type testers |
|
166 |
bool frame::is_deoptimized_frame() const { |
|
167 |
assert(_deopt_state != unknown, "not answerable"); |
|
168 |
return _deopt_state == is_deoptimized; |
|
169 |
} |
|
170 |
||
171 |
bool frame::is_native_frame() const { |
|
172 |
return (_cb != NULL && |
|
173 |
_cb->is_nmethod() && |
|
174 |
((nmethod*)_cb)->is_native_method()); |
|
175 |
} |
|
176 |
||
177 |
bool frame::is_java_frame() const { |
|
178 |
if (is_interpreted_frame()) return true; |
|
179 |
if (is_compiled_frame()) return true; |
|
180 |
return false; |
|
181 |
} |
|
182 |
||
183 |
||
184 |
bool frame::is_compiled_frame() const { |
|
185 |
if (_cb != NULL && |
|
186 |
_cb->is_nmethod() && |
|
187 |
((nmethod*)_cb)->is_java_method()) { |
|
188 |
return true; |
|
189 |
} |
|
190 |
return false; |
|
191 |
} |
|
192 |
||
193 |
||
194 |
bool frame::is_runtime_frame() const { |
|
195 |
return (_cb != NULL && _cb->is_runtime_stub()); |
|
196 |
} |
|
197 |
||
198 |
bool frame::is_safepoint_blob_frame() const { |
|
199 |
return (_cb != NULL && _cb->is_safepoint_stub()); |
|
200 |
} |
|
201 |
||
202 |
// testers |
|
203 |
||
204 |
bool frame::is_first_java_frame() const { |
|
205 |
RegisterMap map(JavaThread::current(), false); // No update |
|
206 |
frame s; |
|
207 |
for (s = sender(&map); !(s.is_java_frame() || s.is_first_frame()); s = s.sender(&map)); |
|
208 |
return s.is_first_frame(); |
|
209 |
} |
|
210 |
||
211 |
||
212 |
bool frame::entry_frame_is_first() const { |
|
213 |
return entry_frame_call_wrapper()->anchor()->last_Java_sp() == NULL; |
|
214 |
} |
|
215 |
||
216 |
||
217 |
bool frame::should_be_deoptimized() const { |
|
218 |
if (_deopt_state == is_deoptimized || |
|
219 |
!is_compiled_frame() ) return false; |
|
220 |
assert(_cb != NULL && _cb->is_nmethod(), "must be an nmethod"); |
|
221 |
nmethod* nm = (nmethod *)_cb; |
|
222 |
if (TraceDependencies) { |
|
223 |
tty->print("checking (%s) ", nm->is_marked_for_deoptimization() ? "true" : "false"); |
|
224 |
nm->print_value_on(tty); |
|
225 |
tty->cr(); |
|
226 |
} |
|
227 |
||
228 |
if( !nm->is_marked_for_deoptimization() ) |
|
229 |
return false; |
|
230 |
||
231 |
// If at the return point, then the frame has already been popped, and |
|
232 |
// only the return needs to be executed. Don't deoptimize here. |
|
233 |
return !nm->is_at_poll_return(pc()); |
|
234 |
} |
|
235 |
||
236 |
bool frame::can_be_deoptimized() const { |
|
237 |
if (!is_compiled_frame()) return false; |
|
238 |
nmethod* nm = (nmethod*)_cb; |
|
239 |
||
240 |
if( !nm->can_be_deoptimized() ) |
|
241 |
return false; |
|
242 |
||
243 |
return !nm->is_at_poll_return(pc()); |
|
244 |
} |
|
245 |
||
6269
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
246 |
void frame::deoptimize(JavaThread* thread) { |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
247 |
// Schedule deoptimization of an nmethod activation with this frame. |
1 | 248 |
assert(_cb != NULL && _cb->is_nmethod(), "must be"); |
249 |
nmethod* nm = (nmethod*)_cb; |
|
250 |
||
251 |
// This is a fix for register window patching race |
|
6269
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
252 |
if (NeedsDeoptSuspend && Thread::current() != thread) { |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
253 |
assert(SafepointSynchronize::is_at_safepoint(), |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
254 |
"patching other threads for deopt may only occur at a safepoint"); |
1 | 255 |
|
256 |
// It is possible especially with DeoptimizeALot/DeoptimizeRandom that |
|
257 |
// we could see the frame again and ask for it to be deoptimized since |
|
258 |
// it might move for a long time. That is harmless and we just ignore it. |
|
259 |
if (id() == thread->must_deopt_id()) { |
|
260 |
assert(thread->is_deopt_suspend(), "lost suspension"); |
|
261 |
return; |
|
262 |
} |
|
263 |
||
264 |
// We are at a safepoint so the target thread can only be |
|
265 |
// in 4 states: |
|
266 |
// blocked - no problem |
|
267 |
// blocked_trans - no problem (i.e. could have woken up from blocked |
|
268 |
// during a safepoint). |
|
269 |
// native - register window pc patching race |
|
270 |
// native_trans - momentary state |
|
271 |
// |
|
272 |
// We could just wait out a thread in native_trans to block. |
|
273 |
// Then we'd have all the issues that the safepoint code has as to |
|
274 |
// whether to spin or block. It isn't worth it. Just treat it like |
|
275 |
// native and be done with it. |
|
276 |
// |
|
6269
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
277 |
// Examine the state of the thread at the start of safepoint since |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
278 |
// threads that were in native at the start of the safepoint could |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
279 |
// come to a halt during the safepoint, changing the current value |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
280 |
// of the safepoint_state. |
10e06287c0b0
6975006: assert(check.is_deoptimized_frame()) failed: missed deopt
never
parents:
6187
diff
changeset
|
281 |
JavaThreadState state = thread->safepoint_state()->orig_thread_state(); |
1 | 282 |
if (state == _thread_in_native || state == _thread_in_native_trans) { |
283 |
// Since we are at a safepoint the target thread will stop itself |
|
284 |
// before it can return to java as long as we remain at the safepoint. |
|
285 |
// Therefore we can put an additional request for the thread to stop |
|
286 |
// no matter what no (like a suspend). This will cause the thread |
|
287 |
// to notice it needs to do the deopt on its own once it leaves native. |
|
288 |
// |
|
289 |
// The only reason we must do this is because on machine with register |
|
290 |
// windows we have a race with patching the return address and the |
|
291 |
// window coming live as the thread returns to the Java code (but still |
|
292 |
// in native mode) and then blocks. It is only this top most frame |
|
293 |
// that is at risk. So in truth we could add an additional check to |
|
294 |
// see if this frame is one that is at risk. |
|
295 |
RegisterMap map(thread, false); |
|
296 |
frame at_risk = thread->last_frame().sender(&map); |
|
297 |
if (id() == at_risk.id()) { |
|
298 |
thread->set_must_deopt_id(id()); |
|
299 |
thread->set_deopt_suspend(); |
|
300 |
return; |
|
301 |
} |
|
302 |
} |
|
303 |
} // NeedsDeoptSuspend |
|
304 |
||
305 |
||
4752 | 306 |
// If the call site is a MethodHandle call site use the MH deopt |
307 |
// handler. |
|
308 |
address deopt = nm->is_method_handle_return(pc()) ? |
|
309 |
nm->deopt_mh_handler_begin() : |
|
310 |
nm->deopt_handler_begin(); |
|
311 |
||
1 | 312 |
// Save the original pc before we patch in the new one |
313 |
nm->set_original_pc(this, pc()); |
|
314 |
patch_pc(thread, deopt); |
|
4752 | 315 |
|
1 | 316 |
#ifdef ASSERT |
317 |
{ |
|
318 |
RegisterMap map(thread, false); |
|
319 |
frame check = thread->last_frame(); |
|
320 |
while (id() != check.id()) { |
|
321 |
check = check.sender(&map); |
|
322 |
} |
|
323 |
assert(check.is_deoptimized_frame(), "missed deopt"); |
|
324 |
} |
|
325 |
#endif // ASSERT |
|
326 |
} |
|
327 |
||
328 |
frame frame::java_sender() const { |
|
329 |
RegisterMap map(JavaThread::current(), false); |
|
330 |
frame s; |
|
331 |
for (s = sender(&map); !(s.is_java_frame() || s.is_first_frame()); s = s.sender(&map)) ; |
|
332 |
guarantee(s.is_java_frame(), "tried to get caller of first java frame"); |
|
333 |
return s; |
|
334 |
} |
|
335 |
||
336 |
frame frame::real_sender(RegisterMap* map) const { |
|
337 |
frame result = sender(map); |
|
338 |
while (result.is_runtime_frame()) { |
|
339 |
result = result.sender(map); |
|
340 |
} |
|
341 |
return result; |
|
342 |
} |
|
343 |
||
344 |
// Note: called by profiler - NOT for current thread |
|
345 |
frame frame::profile_find_Java_sender_frame(JavaThread *thread) { |
|
346 |
// If we don't recognize this frame, walk back up the stack until we do |
|
347 |
RegisterMap map(thread, false); |
|
348 |
frame first_java_frame = frame(); |
|
349 |
||
350 |
// Find the first Java frame on the stack starting with input frame |
|
351 |
if (is_java_frame()) { |
|
352 |
// top frame is compiled frame or deoptimized frame |
|
353 |
first_java_frame = *this; |
|
354 |
} else if (safe_for_sender(thread)) { |
|
355 |
for (frame sender_frame = sender(&map); |
|
356 |
sender_frame.safe_for_sender(thread) && !sender_frame.is_first_frame(); |
|
357 |
sender_frame = sender_frame.sender(&map)) { |
|
358 |
if (sender_frame.is_java_frame()) { |
|
359 |
first_java_frame = sender_frame; |
|
360 |
break; |
|
361 |
} |
|
362 |
} |
|
363 |
} |
|
364 |
return first_java_frame; |
|
365 |
} |
|
366 |
||
367 |
// Interpreter frames |
|
368 |
||
369 |
||
370 |
void frame::interpreter_frame_set_locals(intptr_t* locs) { |
|
371 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
372 |
*interpreter_frame_locals_addr() = locs; |
|
373 |
} |
|
374 |
||
375 |
methodOop frame::interpreter_frame_method() const { |
|
376 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
377 |
methodOop m = *interpreter_frame_method_addr(); |
|
378 |
assert(m->is_perm(), "bad methodOop in interpreter frame"); |
|
379 |
assert(m->is_method(), "not a methodOop"); |
|
380 |
return m; |
|
381 |
} |
|
382 |
||
383 |
void frame::interpreter_frame_set_method(methodOop method) { |
|
384 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
385 |
*interpreter_frame_method_addr() = method; |
|
386 |
} |
|
387 |
||
388 |
void frame::interpreter_frame_set_bcx(intptr_t bcx) { |
|
389 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
390 |
if (ProfileInterpreter) { |
|
391 |
bool formerly_bci = is_bci(interpreter_frame_bcx()); |
|
392 |
bool is_now_bci = is_bci(bcx); |
|
393 |
*interpreter_frame_bcx_addr() = bcx; |
|
394 |
||
395 |
intptr_t mdx = interpreter_frame_mdx(); |
|
396 |
||
397 |
if (mdx != 0) { |
|
398 |
if (formerly_bci) { |
|
399 |
if (!is_now_bci) { |
|
400 |
// The bcx was just converted from bci to bcp. |
|
401 |
// Convert the mdx in parallel. |
|
402 |
methodDataOop mdo = interpreter_frame_method()->method_data(); |
|
403 |
assert(mdo != NULL, ""); |
|
404 |
int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one. |
|
405 |
address mdp = mdo->di_to_dp(mdi); |
|
406 |
interpreter_frame_set_mdx((intptr_t)mdp); |
|
407 |
} |
|
408 |
} else { |
|
409 |
if (is_now_bci) { |
|
410 |
// The bcx was just converted from bcp to bci. |
|
411 |
// Convert the mdx in parallel. |
|
412 |
methodDataOop mdo = interpreter_frame_method()->method_data(); |
|
413 |
assert(mdo != NULL, ""); |
|
414 |
int mdi = mdo->dp_to_di((address)mdx); |
|
415 |
interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0. |
|
416 |
} |
|
417 |
} |
|
418 |
} |
|
419 |
} else { |
|
420 |
*interpreter_frame_bcx_addr() = bcx; |
|
421 |
} |
|
422 |
} |
|
423 |
||
424 |
jint frame::interpreter_frame_bci() const { |
|
425 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
426 |
intptr_t bcx = interpreter_frame_bcx(); |
|
427 |
return is_bci(bcx) ? bcx : interpreter_frame_method()->bci_from((address)bcx); |
|
428 |
} |
|
429 |
||
430 |
void frame::interpreter_frame_set_bci(jint bci) { |
|
431 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
432 |
assert(!is_bci(interpreter_frame_bcx()), "should not set bci during GC"); |
|
433 |
interpreter_frame_set_bcx((intptr_t)interpreter_frame_method()->bcp_from(bci)); |
|
434 |
} |
|
435 |
||
436 |
address frame::interpreter_frame_bcp() const { |
|
437 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
438 |
intptr_t bcx = interpreter_frame_bcx(); |
|
439 |
return is_bci(bcx) ? interpreter_frame_method()->bcp_from(bcx) : (address)bcx; |
|
440 |
} |
|
441 |
||
442 |
void frame::interpreter_frame_set_bcp(address bcp) { |
|
443 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
444 |
assert(!is_bci(interpreter_frame_bcx()), "should not set bcp during GC"); |
|
445 |
interpreter_frame_set_bcx((intptr_t)bcp); |
|
446 |
} |
|
447 |
||
448 |
void frame::interpreter_frame_set_mdx(intptr_t mdx) { |
|
449 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
450 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
451 |
*interpreter_frame_mdx_addr() = mdx; |
|
452 |
} |
|
453 |
||
454 |
address frame::interpreter_frame_mdp() const { |
|
455 |
assert(ProfileInterpreter, "must be profiling interpreter"); |
|
456 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
457 |
intptr_t bcx = interpreter_frame_bcx(); |
|
458 |
intptr_t mdx = interpreter_frame_mdx(); |
|
459 |
||
460 |
assert(!is_bci(bcx), "should not access mdp during GC"); |
|
461 |
return (address)mdx; |
|
462 |
} |
|
463 |
||
464 |
void frame::interpreter_frame_set_mdp(address mdp) { |
|
465 |
assert(is_interpreted_frame(), "interpreted frame expected"); |
|
466 |
if (mdp == NULL) { |
|
467 |
// Always allow the mdp to be cleared. |
|
468 |
interpreter_frame_set_mdx((intptr_t)mdp); |
|
469 |
} |
|
470 |
intptr_t bcx = interpreter_frame_bcx(); |
|
471 |
assert(!is_bci(bcx), "should not set mdp during GC"); |
|
472 |
interpreter_frame_set_mdx((intptr_t)mdp); |
|
473 |
} |
|
474 |
||
475 |
BasicObjectLock* frame::next_monitor_in_interpreter_frame(BasicObjectLock* current) const { |
|
476 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
477 |
#ifdef ASSERT |
|
478 |
interpreter_frame_verify_monitor(current); |
|
479 |
#endif |
|
480 |
BasicObjectLock* next = (BasicObjectLock*) (((intptr_t*) current) + interpreter_frame_monitor_size()); |
|
481 |
return next; |
|
482 |
} |
|
483 |
||
484 |
BasicObjectLock* frame::previous_monitor_in_interpreter_frame(BasicObjectLock* current) const { |
|
485 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
486 |
#ifdef ASSERT |
|
487 |
// // This verification needs to be checked before being enabled |
|
488 |
// interpreter_frame_verify_monitor(current); |
|
489 |
#endif |
|
490 |
BasicObjectLock* previous = (BasicObjectLock*) (((intptr_t*) current) - interpreter_frame_monitor_size()); |
|
491 |
return previous; |
|
492 |
} |
|
493 |
||
494 |
// Interpreter locals and expression stack locations. |
|
495 |
||
496 |
intptr_t* frame::interpreter_frame_local_at(int index) const { |
|
497 |
const int n = Interpreter::local_offset_in_bytes(index)/wordSize; |
|
498 |
return &((*interpreter_frame_locals_addr())[n]); |
|
499 |
} |
|
500 |
||
501 |
intptr_t* frame::interpreter_frame_expression_stack_at(jint offset) const { |
|
502 |
const int i = offset * interpreter_frame_expression_stack_direction(); |
|
5419 | 503 |
const int n = i * Interpreter::stackElementWords; |
1 | 504 |
return &(interpreter_frame_expression_stack()[n]); |
505 |
} |
|
506 |
||
507 |
jint frame::interpreter_frame_expression_stack_size() const { |
|
508 |
// Number of elements on the interpreter expression stack |
|
509 |
// Callers should span by stackElementWords |
|
5419 | 510 |
int element_size = Interpreter::stackElementWords; |
1 | 511 |
if (frame::interpreter_frame_expression_stack_direction() < 0) { |
512 |
return (interpreter_frame_expression_stack() - |
|
513 |
interpreter_frame_tos_address() + 1)/element_size; |
|
514 |
} else { |
|
515 |
return (interpreter_frame_tos_address() - |
|
516 |
interpreter_frame_expression_stack() + 1)/element_size; |
|
517 |
} |
|
518 |
} |
|
519 |
||
520 |
||
521 |
// (frame::interpreter_frame_sender_sp accessor is in frame_<arch>.cpp) |
|
522 |
||
523 |
const char* frame::print_name() const { |
|
524 |
if (is_native_frame()) return "Native"; |
|
525 |
if (is_interpreted_frame()) return "Interpreted"; |
|
526 |
if (is_compiled_frame()) { |
|
527 |
if (is_deoptimized_frame()) return "Deoptimized"; |
|
528 |
return "Compiled"; |
|
529 |
} |
|
530 |
if (sp() == NULL) return "Empty"; |
|
531 |
return "C"; |
|
532 |
} |
|
533 |
||
534 |
void frame::print_value_on(outputStream* st, JavaThread *thread) const { |
|
535 |
NOT_PRODUCT(address begin = pc()-40;) |
|
536 |
NOT_PRODUCT(address end = NULL;) |
|
537 |
||
538 |
st->print("%s frame (sp=" INTPTR_FORMAT " unextended sp=" INTPTR_FORMAT, print_name(), sp(), unextended_sp()); |
|
539 |
if (sp() != NULL) |
|
540 |
st->print(", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT, fp(), pc()); |
|
541 |
||
542 |
if (StubRoutines::contains(pc())) { |
|
543 |
st->print_cr(")"); |
|
544 |
st->print("("); |
|
545 |
StubCodeDesc* desc = StubCodeDesc::desc_for(pc()); |
|
546 |
st->print("~Stub::%s", desc->name()); |
|
547 |
NOT_PRODUCT(begin = desc->begin(); end = desc->end();) |
|
548 |
} else if (Interpreter::contains(pc())) { |
|
549 |
st->print_cr(")"); |
|
550 |
st->print("("); |
|
551 |
InterpreterCodelet* desc = Interpreter::codelet_containing(pc()); |
|
552 |
if (desc != NULL) { |
|
553 |
st->print("~"); |
|
554 |
desc->print(); |
|
555 |
NOT_PRODUCT(begin = desc->code_begin(); end = desc->code_end();) |
|
556 |
} else { |
|
557 |
st->print("~interpreter"); |
|
558 |
} |
|
559 |
} |
|
560 |
st->print_cr(")"); |
|
561 |
||
562 |
if (_cb != NULL) { |
|
563 |
st->print(" "); |
|
564 |
_cb->print_value_on(st); |
|
565 |
st->cr(); |
|
566 |
#ifndef PRODUCT |
|
567 |
if (end == NULL) { |
|
6418 | 568 |
begin = _cb->code_begin(); |
569 |
end = _cb->code_end(); |
|
1 | 570 |
} |
571 |
#endif |
|
572 |
} |
|
573 |
NOT_PRODUCT(if (WizardMode && Verbose) Disassembler::decode(begin, end);) |
|
574 |
} |
|
575 |
||
576 |
||
577 |
void frame::print_on(outputStream* st) const { |
|
578 |
print_value_on(st,NULL); |
|
579 |
if (is_interpreted_frame()) { |
|
580 |
interpreter_frame_print_on(st); |
|
581 |
} |
|
582 |
} |
|
583 |
||
584 |
||
585 |
void frame::interpreter_frame_print_on(outputStream* st) const { |
|
586 |
#ifndef PRODUCT |
|
587 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
588 |
jint i; |
|
589 |
for (i = 0; i < interpreter_frame_method()->max_locals(); i++ ) { |
|
590 |
intptr_t x = *interpreter_frame_local_at(i); |
|
591 |
st->print(" - local [" INTPTR_FORMAT "]", x); |
|
592 |
st->fill_to(23); |
|
593 |
st->print_cr("; #%d", i); |
|
594 |
} |
|
595 |
for (i = interpreter_frame_expression_stack_size() - 1; i >= 0; --i ) { |
|
596 |
intptr_t x = *interpreter_frame_expression_stack_at(i); |
|
597 |
st->print(" - stack [" INTPTR_FORMAT "]", x); |
|
598 |
st->fill_to(23); |
|
599 |
st->print_cr("; #%d", i); |
|
600 |
} |
|
601 |
// locks for synchronization |
|
602 |
for (BasicObjectLock* current = interpreter_frame_monitor_end(); |
|
603 |
current < interpreter_frame_monitor_begin(); |
|
604 |
current = next_monitor_in_interpreter_frame(current)) { |
|
4896
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
605 |
st->print(" - obj ["); |
1 | 606 |
current->obj()->print_value_on(st); |
4896
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
607 |
st->print_cr("]"); |
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
608 |
st->print(" - lock ["); |
1 | 609 |
current->lock()->print_on(st); |
4896
88b4193b82b0
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
4752
diff
changeset
|
610 |
st->print_cr("]"); |
1 | 611 |
} |
612 |
// monitor |
|
613 |
st->print_cr(" - monitor[" INTPTR_FORMAT "]", interpreter_frame_monitor_begin()); |
|
614 |
// bcp |
|
615 |
st->print(" - bcp [" INTPTR_FORMAT "]", interpreter_frame_bcp()); |
|
616 |
st->fill_to(23); |
|
617 |
st->print_cr("; @%d", interpreter_frame_bci()); |
|
618 |
// locals |
|
619 |
st->print_cr(" - locals [" INTPTR_FORMAT "]", interpreter_frame_local_at(0)); |
|
620 |
// method |
|
621 |
st->print(" - method [" INTPTR_FORMAT "]", (address)interpreter_frame_method()); |
|
622 |
st->fill_to(23); |
|
623 |
st->print("; "); |
|
624 |
interpreter_frame_method()->print_name(st); |
|
625 |
st->cr(); |
|
626 |
#endif |
|
627 |
} |
|
628 |
||
629 |
// Return whether the frame is in the VM or os indicating a Hotspot problem. |
|
630 |
// Otherwise, it's likely a bug in the native library that the Java code calls, |
|
631 |
// hopefully indicating where to submit bugs. |
|
632 |
static void print_C_frame(outputStream* st, char* buf, int buflen, address pc) { |
|
633 |
// C/C++ frame |
|
634 |
bool in_vm = os::address_is_in_vm(pc); |
|
635 |
st->print(in_vm ? "V" : "C"); |
|
636 |
||
637 |
int offset; |
|
638 |
bool found; |
|
639 |
||
640 |
// libname |
|
641 |
found = os::dll_address_to_library_name(pc, buf, buflen, &offset); |
|
642 |
if (found) { |
|
643 |
// skip directory names |
|
644 |
const char *p1, *p2; |
|
645 |
p1 = buf; |
|
646 |
int len = (int)strlen(os::file_separator()); |
|
647 |
while ((p2 = strstr(p1, os::file_separator())) != NULL) p1 = p2 + len; |
|
648 |
st->print(" [%s+0x%x]", p1, offset); |
|
649 |
} else { |
|
650 |
st->print(" " PTR_FORMAT, pc); |
|
651 |
} |
|
652 |
||
653 |
// function name - os::dll_address_to_function_name() may return confusing |
|
654 |
// names if pc is within jvm.dll or libjvm.so, because JVM only has |
|
655 |
// JVM_xxxx and a few other symbols in the dynamic symbol table. Do this |
|
656 |
// only for native libraries. |
|
7447
32c42d627f41
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
7397
diff
changeset
|
657 |
if (!in_vm || Decoder::can_decode_C_frame_in_vm()) { |
1 | 658 |
found = os::dll_address_to_function_name(pc, buf, buflen, &offset); |
659 |
||
660 |
if (found) { |
|
661 |
st->print(" %s+0x%x", buf, offset); |
|
662 |
} |
|
663 |
} |
|
664 |
} |
|
665 |
||
666 |
// frame::print_on_error() is called by fatal error handler. Notice that we may |
|
667 |
// crash inside this function if stack frame is corrupted. The fatal error |
|
668 |
// handler can catch and handle the crash. Here we assume the frame is valid. |
|
669 |
// |
|
670 |
// First letter indicates type of the frame: |
|
671 |
// J: Java frame (compiled) |
|
672 |
// j: Java frame (interpreted) |
|
673 |
// V: VM frame (C/C++) |
|
674 |
// v: Other frames running VM generated code (e.g. stubs, adapters, etc.) |
|
675 |
// C: C/C++ frame |
|
676 |
// |
|
677 |
// We don't need detailed frame type as that in frame::print_name(). "C" |
|
678 |
// suggests the problem is in user lib; everything else is likely a VM bug. |
|
679 |
||
680 |
void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const { |
|
681 |
if (_cb != NULL) { |
|
682 |
if (Interpreter::contains(pc())) { |
|
683 |
methodOop m = this->interpreter_frame_method(); |
|
684 |
if (m != NULL) { |
|
685 |
m->name_and_sig_as_C_string(buf, buflen); |
|
686 |
st->print("j %s", buf); |
|
687 |
st->print("+%d", this->interpreter_frame_bci()); |
|
688 |
} else { |
|
689 |
st->print("j " PTR_FORMAT, pc()); |
|
690 |
} |
|
691 |
} else if (StubRoutines::contains(pc())) { |
|
692 |
StubCodeDesc* desc = StubCodeDesc::desc_for(pc()); |
|
693 |
if (desc != NULL) { |
|
694 |
st->print("v ~StubRoutines::%s", desc->name()); |
|
695 |
} else { |
|
696 |
st->print("v ~StubRoutines::" PTR_FORMAT, pc()); |
|
697 |
} |
|
698 |
} else if (_cb->is_buffer_blob()) { |
|
699 |
st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); |
|
700 |
} else if (_cb->is_nmethod()) { |
|
701 |
methodOop m = ((nmethod *)_cb)->method(); |
|
702 |
if (m != NULL) { |
|
703 |
m->name_and_sig_as_C_string(buf, buflen); |
|
704 |
st->print("J %s", buf); |
|
705 |
} else { |
|
706 |
st->print("J " PTR_FORMAT, pc()); |
|
707 |
} |
|
708 |
} else if (_cb->is_runtime_stub()) { |
|
709 |
st->print("v ~RuntimeStub::%s", ((RuntimeStub *)_cb)->name()); |
|
710 |
} else if (_cb->is_deoptimization_stub()) { |
|
711 |
st->print("v ~DeoptimizationBlob"); |
|
712 |
} else if (_cb->is_exception_stub()) { |
|
713 |
st->print("v ~ExceptionBlob"); |
|
714 |
} else if (_cb->is_safepoint_stub()) { |
|
715 |
st->print("v ~SafepointBlob"); |
|
716 |
} else { |
|
717 |
st->print("v blob " PTR_FORMAT, pc()); |
|
718 |
} |
|
719 |
} else { |
|
720 |
print_C_frame(st, buf, buflen, pc()); |
|
721 |
} |
|
722 |
} |
|
723 |
||
724 |
||
725 |
/* |
|
726 |
The interpreter_frame_expression_stack_at method in the case of SPARC needs the |
|
727 |
max_stack value of the method in order to compute the expression stack address. |
|
728 |
It uses the methodOop in order to get the max_stack value but during GC this |
|
729 |
methodOop value saved on the frame is changed by reverse_and_push and hence cannot |
|
730 |
be used. So we save the max_stack value in the FrameClosure object and pass it |
|
731 |
down to the interpreter_frame_expression_stack_at method |
|
732 |
*/ |
|
733 |
class InterpreterFrameClosure : public OffsetClosure { |
|
734 |
private: |
|
735 |
frame* _fr; |
|
736 |
OopClosure* _f; |
|
737 |
int _max_locals; |
|
738 |
int _max_stack; |
|
739 |
||
740 |
public: |
|
741 |
InterpreterFrameClosure(frame* fr, int max_locals, int max_stack, |
|
742 |
OopClosure* f) { |
|
743 |
_fr = fr; |
|
744 |
_max_locals = max_locals; |
|
745 |
_max_stack = max_stack; |
|
746 |
_f = f; |
|
747 |
} |
|
748 |
||
749 |
void offset_do(int offset) { |
|
750 |
oop* addr; |
|
751 |
if (offset < _max_locals) { |
|
752 |
addr = (oop*) _fr->interpreter_frame_local_at(offset); |
|
753 |
assert((intptr_t*)addr >= _fr->sp(), "must be inside the frame"); |
|
754 |
_f->do_oop(addr); |
|
755 |
} else { |
|
756 |
addr = (oop*) _fr->interpreter_frame_expression_stack_at((offset - _max_locals)); |
|
757 |
// In case of exceptions, the expression stack is invalid and the esp will be reset to express |
|
758 |
// this condition. Therefore, we call f only if addr is 'inside' the stack (i.e., addr >= esp for Intel). |
|
759 |
bool in_stack; |
|
760 |
if (frame::interpreter_frame_expression_stack_direction() > 0) { |
|
761 |
in_stack = (intptr_t*)addr <= _fr->interpreter_frame_tos_address(); |
|
762 |
} else { |
|
763 |
in_stack = (intptr_t*)addr >= _fr->interpreter_frame_tos_address(); |
|
764 |
} |
|
765 |
if (in_stack) { |
|
766 |
_f->do_oop(addr); |
|
767 |
} |
|
768 |
} |
|
769 |
} |
|
770 |
||
771 |
int max_locals() { return _max_locals; } |
|
772 |
frame* fr() { return _fr; } |
|
773 |
}; |
|
774 |
||
775 |
||
776 |
class InterpretedArgumentOopFinder: public SignatureInfo { |
|
777 |
private: |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
778 |
OopClosure* _f; // Closure to invoke |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
779 |
int _offset; // TOS-relative offset, decremented with each argument |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
780 |
bool _has_receiver; // true if the callee has a receiver |
1 | 781 |
frame* _fr; |
782 |
||
783 |
void set(int size, BasicType type) { |
|
784 |
_offset -= size; |
|
785 |
if (type == T_OBJECT || type == T_ARRAY) oop_offset_do(); |
|
786 |
} |
|
787 |
||
788 |
void oop_offset_do() { |
|
789 |
oop* addr; |
|
790 |
addr = (oop*)_fr->interpreter_frame_tos_at(_offset); |
|
791 |
_f->do_oop(addr); |
|
792 |
} |
|
793 |
||
794 |
public: |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
795 |
InterpretedArgumentOopFinder(symbolHandle signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureInfo(signature), _has_receiver(has_receiver) { |
1 | 796 |
// compute size of arguments |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
797 |
int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); |
1 | 798 |
assert(!fr->is_interpreted_frame() || |
799 |
args_size <= fr->interpreter_frame_expression_stack_size(), |
|
800 |
"args cannot be on stack anymore"); |
|
801 |
// initialize InterpretedArgumentOopFinder |
|
802 |
_f = f; |
|
803 |
_fr = fr; |
|
804 |
_offset = args_size; |
|
805 |
} |
|
806 |
||
807 |
void oops_do() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
808 |
if (_has_receiver) { |
1 | 809 |
--_offset; |
810 |
oop_offset_do(); |
|
811 |
} |
|
812 |
iterate_parameters(); |
|
813 |
} |
|
814 |
}; |
|
815 |
||
816 |
||
817 |
// Entry frame has following form (n arguments) |
|
818 |
// +-----------+ |
|
819 |
// sp -> | last arg | |
|
820 |
// +-----------+ |
|
821 |
// : ::: : |
|
822 |
// +-----------+ |
|
823 |
// (sp+n)->| first arg| |
|
824 |
// +-----------+ |
|
825 |
||
826 |
||
827 |
||
828 |
// visits and GC's all the arguments in entry frame |
|
829 |
class EntryFrameOopFinder: public SignatureInfo { |
|
830 |
private: |
|
831 |
bool _is_static; |
|
832 |
int _offset; |
|
833 |
frame* _fr; |
|
834 |
OopClosure* _f; |
|
835 |
||
836 |
void set(int size, BasicType type) { |
|
837 |
assert (_offset >= 0, "illegal offset"); |
|
838 |
if (type == T_OBJECT || type == T_ARRAY) oop_at_offset_do(_offset); |
|
839 |
_offset -= size; |
|
840 |
} |
|
841 |
||
842 |
void oop_at_offset_do(int offset) { |
|
5402
c51fd0c1d005
6888953: some calls to function-like macros are missing semicolons
jcoomes
parents:
4896
diff
changeset
|
843 |
assert (offset >= 0, "illegal offset"); |
1 | 844 |
oop* addr = (oop*) _fr->entry_frame_argument_at(offset); |
845 |
_f->do_oop(addr); |
|
846 |
} |
|
847 |
||
848 |
public: |
|
849 |
EntryFrameOopFinder(frame* frame, symbolHandle signature, bool is_static) : SignatureInfo(signature) { |
|
850 |
_f = NULL; // will be set later |
|
851 |
_fr = frame; |
|
852 |
_is_static = is_static; |
|
853 |
_offset = ArgumentSizeComputer(signature).size() - 1; // last parameter is at index 0 |
|
854 |
} |
|
855 |
||
856 |
void arguments_do(OopClosure* f) { |
|
857 |
_f = f; |
|
858 |
if (!_is_static) oop_at_offset_do(_offset+1); // do the receiver |
|
859 |
iterate_parameters(); |
|
860 |
} |
|
861 |
||
862 |
}; |
|
863 |
||
864 |
oop* frame::interpreter_callee_receiver_addr(symbolHandle signature) { |
|
865 |
ArgumentSizeComputer asc(signature); |
|
866 |
int size = asc.size(); |
|
867 |
return (oop *)interpreter_frame_tos_at(size); |
|
868 |
} |
|
869 |
||
870 |
||
871 |
void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) { |
|
872 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
873 |
assert(map != NULL, "map must be set"); |
|
874 |
Thread *thread = Thread::current(); |
|
875 |
methodHandle m (thread, interpreter_frame_method()); |
|
876 |
jint bci = interpreter_frame_bci(); |
|
877 |
||
878 |
assert(Universe::heap()->is_in(m()), "must be valid oop"); |
|
879 |
assert(m->is_method(), "checking frame value"); |
|
880 |
assert((m->is_native() && bci == 0) || (!m->is_native() && bci >= 0 && bci < m->code_size()), "invalid bci value"); |
|
881 |
||
882 |
// Handle the monitor elements in the activation |
|
883 |
for ( |
|
884 |
BasicObjectLock* current = interpreter_frame_monitor_end(); |
|
885 |
current < interpreter_frame_monitor_begin(); |
|
886 |
current = next_monitor_in_interpreter_frame(current) |
|
887 |
) { |
|
888 |
#ifdef ASSERT |
|
889 |
interpreter_frame_verify_monitor(current); |
|
890 |
#endif |
|
891 |
current->oops_do(f); |
|
892 |
} |
|
893 |
||
894 |
// process fixed part |
|
895 |
f->do_oop((oop*)interpreter_frame_method_addr()); |
|
896 |
f->do_oop((oop*)interpreter_frame_cache_addr()); |
|
897 |
||
898 |
// Hmm what about the mdp? |
|
899 |
#ifdef CC_INTERP |
|
900 |
// Interpreter frame in the midst of a call have a methodOop within the |
|
901 |
// object. |
|
902 |
interpreterState istate = get_interpreterState(); |
|
903 |
if (istate->msg() == BytecodeInterpreter::call_method) { |
|
904 |
f->do_oop((oop*)&istate->_result._to_call._callee); |
|
905 |
} |
|
906 |
||
907 |
#endif /* CC_INTERP */ |
|
908 |
||
7109 | 909 |
#if !defined(PPC) || defined(ZERO) |
1 | 910 |
if (m->is_native()) { |
911 |
#ifdef CC_INTERP |
|
912 |
f->do_oop((oop*)&istate->_oop_temp); |
|
913 |
#else |
|
914 |
f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset )); |
|
915 |
#endif /* CC_INTERP */ |
|
916 |
} |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
917 |
#else // PPC |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
918 |
if (m->is_native() && m->is_static()) { |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
919 |
f->do_oop(interpreter_frame_mirror_addr()); |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
920 |
} |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
921 |
#endif // PPC |
1 | 922 |
|
923 |
int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); |
|
924 |
||
925 |
symbolHandle signature; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
926 |
bool has_receiver = false; |
1 | 927 |
|
928 |
// Process a callee's arguments if we are at a call site |
|
929 |
// (i.e., if we are at an invoke bytecode) |
|
930 |
// This is used sometimes for calling into the VM, not for another |
|
931 |
// interpreted or compiled frame. |
|
932 |
if (!m->is_native()) { |
|
933 |
Bytecode_invoke *call = Bytecode_invoke_at_check(m, bci); |
|
934 |
if (call != NULL) { |
|
935 |
signature = symbolHandle(thread, call->signature()); |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
936 |
has_receiver = call->has_receiver(); |
1 | 937 |
if (map->include_argument_oops() && |
938 |
interpreter_frame_expression_stack_size() > 0) { |
|
939 |
ResourceMark rm(thread); // is this right ??? |
|
940 |
// we are at a call site & the expression stack is not empty |
|
941 |
// => process callee's arguments |
|
942 |
// |
|
943 |
// Note: The expression stack can be empty if an exception |
|
2131 | 944 |
// occurred during method resolution/execution. In all |
1 | 945 |
// cases we empty the expression stack completely be- |
946 |
// fore handling the exception (the exception handling |
|
947 |
// code in the interpreter calls a blocking runtime |
|
948 |
// routine which can cause this code to be executed). |
|
949 |
// (was bug gri 7/27/98) |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
950 |
oops_interpreted_arguments_do(signature, has_receiver, f); |
1 | 951 |
} |
952 |
} |
|
953 |
} |
|
954 |
||
5419 | 955 |
InterpreterFrameClosure blk(this, max_locals, m->max_stack(), f); |
956 |
||
957 |
// process locals & expression stack |
|
958 |
InterpreterOopMap mask; |
|
959 |
if (query_oop_map_cache) { |
|
960 |
m->mask_for(bci, &mask); |
|
1 | 961 |
} else { |
5419 | 962 |
OopMapCache::compute_one_oop_map(m, bci, &mask); |
1 | 963 |
} |
5419 | 964 |
mask.iterate_oop(&blk); |
1 | 965 |
} |
966 |
||
967 |
||
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
968 |
void frame::oops_interpreted_arguments_do(symbolHandle signature, bool has_receiver, OopClosure* f) { |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
969 |
InterpretedArgumentOopFinder finder(signature, has_receiver, this, f); |
1 | 970 |
finder.oops_do(); |
971 |
} |
|
972 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
973 |
void frame::oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* reg_map) { |
1 | 974 |
assert(_cb != NULL, "sanity check"); |
975 |
if (_cb->oop_maps() != NULL) { |
|
976 |
OopMapSet::oops_do(this, reg_map, f); |
|
977 |
||
978 |
// Preserve potential arguments for a callee. We handle this by dispatching |
|
979 |
// on the codeblob. For c2i, we do |
|
980 |
if (reg_map->include_argument_oops()) { |
|
981 |
_cb->preserve_callee_argument_oops(*this, reg_map, f); |
|
982 |
} |
|
983 |
} |
|
984 |
// In cases where perm gen is collected, GC will want to mark |
|
985 |
// oops referenced from nmethods active on thread stacks so as to |
|
986 |
// prevent them from being collected. However, this visit should be |
|
987 |
// restricted to certain phases of the collection only. The |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
988 |
// closure decides how it wants nmethods to be traced. |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
989 |
if (cf != NULL) |
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
990 |
cf->do_code_blob(_cb); |
1 | 991 |
} |
992 |
||
993 |
class CompiledArgumentOopFinder: public SignatureInfo { |
|
994 |
protected: |
|
995 |
OopClosure* _f; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
996 |
int _offset; // the current offset, incremented with each argument |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
997 |
bool _has_receiver; // true if the callee has a receiver |
1 | 998 |
frame _fr; |
999 |
RegisterMap* _reg_map; |
|
1000 |
int _arg_size; |
|
1001 |
VMRegPair* _regs; // VMReg list of arguments |
|
1002 |
||
1003 |
void set(int size, BasicType type) { |
|
1004 |
if (type == T_OBJECT || type == T_ARRAY) handle_oop_offset(); |
|
1005 |
_offset += size; |
|
1006 |
} |
|
1007 |
||
1008 |
virtual void handle_oop_offset() { |
|
1009 |
// Extract low order register number from register array. |
|
1010 |
// In LP64-land, the high-order bits are valid but unhelpful. |
|
1011 |
VMReg reg = _regs[_offset].first(); |
|
1012 |
oop *loc = _fr.oopmapreg_to_location(reg, _reg_map); |
|
1013 |
_f->do_oop(loc); |
|
1014 |
} |
|
1015 |
||
1016 |
public: |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1017 |
CompiledArgumentOopFinder(symbolHandle signature, bool has_receiver, OopClosure* f, frame fr, const RegisterMap* reg_map) |
1 | 1018 |
: SignatureInfo(signature) { |
1019 |
||
1020 |
// initialize CompiledArgumentOopFinder |
|
1021 |
_f = f; |
|
1022 |
_offset = 0; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1023 |
_has_receiver = has_receiver; |
1 | 1024 |
_fr = fr; |
1025 |
_reg_map = (RegisterMap*)reg_map; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1026 |
_arg_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0); |
1 | 1027 |
|
1028 |
int arg_size; |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1029 |
_regs = SharedRuntime::find_callee_arguments(signature(), has_receiver, &arg_size); |
1 | 1030 |
assert(arg_size == _arg_size, "wrong arg size"); |
1031 |
} |
|
1032 |
||
1033 |
void oops_do() { |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1034 |
if (_has_receiver) { |
1 | 1035 |
handle_oop_offset(); |
1036 |
_offset++; |
|
1037 |
} |
|
1038 |
iterate_parameters(); |
|
1039 |
} |
|
1040 |
}; |
|
1041 |
||
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1042 |
void frame::oops_compiled_arguments_do(symbolHandle signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f) { |
1 | 1043 |
ResourceMark rm; |
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
3908
diff
changeset
|
1044 |
CompiledArgumentOopFinder finder(signature, has_receiver, f, *this, reg_map); |
1 | 1045 |
finder.oops_do(); |
1046 |
} |
|
1047 |
||
1048 |
||
1049 |
// Get receiver out of callers frame, i.e. find parameter 0 in callers |
|
1050 |
// frame. Consult ADLC for where parameter 0 is to be found. Then |
|
1051 |
// check local reg_map for it being a callee-save register or argument |
|
1052 |
// register, both of which are saved in the local frame. If not found |
|
1053 |
// there, it must be an in-stack argument of the caller. |
|
1054 |
// Note: caller.sp() points to callee-arguments |
|
1055 |
oop frame::retrieve_receiver(RegisterMap* reg_map) { |
|
1056 |
frame caller = *this; |
|
1057 |
||
1058 |
// First consult the ADLC on where it puts parameter 0 for this signature. |
|
1059 |
VMReg reg = SharedRuntime::name_for_receiver(); |
|
1060 |
oop r = *caller.oopmapreg_to_location(reg, reg_map); |
|
1061 |
assert( Universe::heap()->is_in_or_null(r), "bad receiver" ); |
|
1062 |
return r; |
|
1063 |
} |
|
1064 |
||
1065 |
||
1066 |
oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const { |
|
1067 |
if(reg->is_reg()) { |
|
1068 |
// If it is passed in a register, it got spilled in the stub frame. |
|
1069 |
return (oop *)reg_map->location(reg); |
|
1070 |
} else { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1071 |
int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1072 |
return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes); |
1 | 1073 |
} |
1074 |
} |
|
1075 |
||
1076 |
BasicLock* frame::compiled_synchronized_native_monitor(nmethod* nm) { |
|
1077 |
if (nm == NULL) { |
|
1078 |
assert(_cb != NULL && _cb->is_nmethod() && |
|
1079 |
nm->method()->is_native() && |
|
1080 |
nm->method()->is_synchronized(), |
|
1081 |
"should not call this otherwise"); |
|
1082 |
nm = (nmethod*) _cb; |
|
1083 |
} |
|
1084 |
int byte_offset = in_bytes(nm->compiled_synchronized_native_basic_lock_sp_offset()); |
|
1085 |
assert(byte_offset >= 0, "should not see invalid offset"); |
|
1086 |
return (BasicLock*) &sp()[byte_offset / wordSize]; |
|
1087 |
} |
|
1088 |
||
1089 |
oop frame::compiled_synchronized_native_monitor_owner(nmethod* nm) { |
|
1090 |
if (nm == NULL) { |
|
1091 |
assert(_cb != NULL && _cb->is_nmethod() && |
|
1092 |
nm->method()->is_native() && |
|
1093 |
nm->method()->is_synchronized(), |
|
1094 |
"should not call this otherwise"); |
|
1095 |
nm = (nmethod*) _cb; |
|
1096 |
} |
|
1097 |
int byte_offset = in_bytes(nm->compiled_synchronized_native_basic_lock_owner_sp_offset()); |
|
1098 |
assert(byte_offset >= 0, "should not see invalid offset"); |
|
1099 |
oop owner = ((oop*) sp())[byte_offset / wordSize]; |
|
1100 |
assert( Universe::heap()->is_in(owner), "bad receiver" ); |
|
1101 |
return owner; |
|
1102 |
} |
|
1103 |
||
1104 |
void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) { |
|
1105 |
assert(map != NULL, "map must be set"); |
|
1106 |
if (map->include_argument_oops()) { |
|
1107 |
// must collect argument oops, as nobody else is doing it |
|
1108 |
Thread *thread = Thread::current(); |
|
1109 |
methodHandle m (thread, entry_frame_call_wrapper()->callee_method()); |
|
1110 |
symbolHandle signature (thread, m->signature()); |
|
1111 |
EntryFrameOopFinder finder(this, signature, m->is_static()); |
|
1112 |
finder.arguments_do(f); |
|
1113 |
} |
|
1114 |
// Traverse the Handle Block saved in the entry frame |
|
1115 |
entry_frame_call_wrapper()->oops_do(f); |
|
1116 |
} |
|
1117 |
||
1118 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
1119 |
void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { |
4489
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1120 |
#ifndef PRODUCT |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1121 |
// simulate GC crash here to dump java thread in error report |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1122 |
if (CrashGCForDumpingJavaThread) { |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1123 |
char *t = NULL; |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1124 |
*t = 'c'; |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1125 |
} |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1126 |
#endif |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1127 |
if (is_interpreted_frame()) { |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1128 |
oops_interpreted_do(f, map, use_interpreter_oop_map_cache); |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1129 |
} else if (is_entry_frame()) { |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1130 |
oops_entry_do(f, map); |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1131 |
} else if (CodeCache::contains(pc())) { |
514173c9a0c2
6361589: Print out stack trace for target thread of GC crash
minqi
parents:
3908
diff
changeset
|
1132 |
oops_code_blob_do(f, cf, map); |
6187 | 1133 |
#ifdef SHARK |
1134 |
} else if (is_fake_stub_frame()) { |
|
1135 |
// nothing to do |
|
1136 |
#endif // SHARK |
|
1 | 1137 |
} else { |
1138 |
ShouldNotReachHere(); |
|
1139 |
} |
|
1140 |
} |
|
1141 |
||
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
1142 |
void frame::nmethods_do(CodeBlobClosure* cf) { |
1 | 1143 |
if (_cb != NULL && _cb->is_nmethod()) { |
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
1144 |
cf->do_code_blob(_cb); |
1 | 1145 |
} |
1146 |
} |
|
1147 |
||
1148 |
||
1149 |
void frame::gc_prologue() { |
|
1150 |
if (is_interpreted_frame()) { |
|
1151 |
// set bcx to bci to become methodOop position independent during GC |
|
1152 |
interpreter_frame_set_bcx(interpreter_frame_bci()); |
|
1153 |
} |
|
1154 |
} |
|
1155 |
||
1156 |
||
1157 |
void frame::gc_epilogue() { |
|
1158 |
if (is_interpreted_frame()) { |
|
1159 |
// set bcx back to bcp for interpreter |
|
1160 |
interpreter_frame_set_bcx((intptr_t)interpreter_frame_bcp()); |
|
1161 |
} |
|
1162 |
// call processor specific epilog function |
|
1163 |
pd_gc_epilog(); |
|
1164 |
} |
|
1165 |
||
1166 |
||
1167 |
# ifdef ENABLE_ZAP_DEAD_LOCALS |
|
1168 |
||
1169 |
void frame::CheckValueClosure::do_oop(oop* p) { |
|
1170 |
if (CheckOopishValues && Universe::heap()->is_in_reserved(*p)) { |
|
1171 |
warning("value @ " INTPTR_FORMAT " looks oopish (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current()); |
|
1172 |
} |
|
1173 |
} |
|
1174 |
frame::CheckValueClosure frame::_check_value; |
|
1175 |
||
1176 |
||
1177 |
void frame::CheckOopClosure::do_oop(oop* p) { |
|
1178 |
if (*p != NULL && !(*p)->is_oop()) { |
|
1179 |
warning("value @ " INTPTR_FORMAT " should be an oop (" INTPTR_FORMAT ") (thread = " INTPTR_FORMAT ")", p, (address)*p, Thread::current()); |
|
1180 |
} |
|
1181 |
} |
|
1182 |
frame::CheckOopClosure frame::_check_oop; |
|
1183 |
||
1184 |
void frame::check_derived_oop(oop* base, oop* derived) { |
|
1185 |
_check_oop.do_oop(base); |
|
1186 |
} |
|
1187 |
||
1188 |
||
1189 |
void frame::ZapDeadClosure::do_oop(oop* p) { |
|
1190 |
if (TraceZapDeadLocals) tty->print_cr("zapping @ " INTPTR_FORMAT " containing " INTPTR_FORMAT, p, (address)*p); |
|
1191 |
// Need cast because on _LP64 the conversion to oop is ambiguous. Constant |
|
1192 |
// can be either long or int. |
|
1193 |
*p = (oop)(int)0xbabebabe; |
|
1194 |
} |
|
1195 |
frame::ZapDeadClosure frame::_zap_dead; |
|
1196 |
||
1197 |
void frame::zap_dead_locals(JavaThread* thread, const RegisterMap* map) { |
|
1198 |
assert(thread == Thread::current(), "need to synchronize to do this to another thread"); |
|
1199 |
// Tracing - part 1 |
|
1200 |
if (TraceZapDeadLocals) { |
|
1201 |
ResourceMark rm(thread); |
|
1202 |
tty->print_cr("--------------------------------------------------------------------------------"); |
|
1203 |
tty->print("Zapping dead locals in "); |
|
1204 |
print_on(tty); |
|
1205 |
tty->cr(); |
|
1206 |
} |
|
1207 |
// Zapping |
|
1208 |
if (is_entry_frame ()) zap_dead_entry_locals (thread, map); |
|
1209 |
else if (is_interpreted_frame()) zap_dead_interpreted_locals(thread, map); |
|
1210 |
else if (is_compiled_frame()) zap_dead_compiled_locals (thread, map); |
|
1211 |
||
1212 |
else |
|
1213 |
// could be is_runtime_frame |
|
1214 |
// so remove error: ShouldNotReachHere(); |
|
1215 |
; |
|
1216 |
// Tracing - part 2 |
|
1217 |
if (TraceZapDeadLocals) { |
|
1218 |
tty->cr(); |
|
1219 |
} |
|
1220 |
} |
|
1221 |
||
1222 |
||
1223 |
void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* map) { |
|
1224 |
// get current interpreter 'pc' |
|
1225 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
1226 |
methodOop m = interpreter_frame_method(); |
|
1227 |
int bci = interpreter_frame_bci(); |
|
1228 |
||
1229 |
int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); |
|
1230 |
||
5419 | 1231 |
// process dynamic part |
1232 |
InterpreterFrameClosure value_blk(this, max_locals, m->max_stack(), |
|
1233 |
&_check_value); |
|
1234 |
InterpreterFrameClosure oop_blk(this, max_locals, m->max_stack(), |
|
1235 |
&_check_oop ); |
|
1236 |
InterpreterFrameClosure dead_blk(this, max_locals, m->max_stack(), |
|
1237 |
&_zap_dead ); |
|
1 | 1238 |
|
5419 | 1239 |
// get frame map |
1240 |
InterpreterOopMap mask; |
|
1241 |
m->mask_for(bci, &mask); |
|
1242 |
mask.iterate_all( &oop_blk, &value_blk, &dead_blk); |
|
1 | 1243 |
} |
1244 |
||
1245 |
||
1246 |
void frame::zap_dead_compiled_locals(JavaThread* thread, const RegisterMap* reg_map) { |
|
1247 |
||
1248 |
ResourceMark rm(thread); |
|
1249 |
assert(_cb != NULL, "sanity check"); |
|
1250 |
if (_cb->oop_maps() != NULL) { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1251 |
OopMapSet::all_do(this, reg_map, &_check_oop, check_derived_oop, &_check_value); |
1 | 1252 |
} |
1253 |
} |
|
1254 |
||
1255 |
||
1256 |
void frame::zap_dead_entry_locals(JavaThread*, const RegisterMap*) { |
|
1257 |
if (TraceZapDeadLocals) warning("frame::zap_dead_entry_locals unimplemented"); |
|
1258 |
} |
|
1259 |
||
1260 |
||
1261 |
void frame::zap_dead_deoptimized_locals(JavaThread*, const RegisterMap*) { |
|
1262 |
if (TraceZapDeadLocals) warning("frame::zap_dead_deoptimized_locals unimplemented"); |
|
1263 |
} |
|
1264 |
||
1265 |
# endif // ENABLE_ZAP_DEAD_LOCALS |
|
1266 |
||
1267 |
void frame::verify(const RegisterMap* map) { |
|
1268 |
// for now make sure receiver type is correct |
|
1269 |
if (is_interpreted_frame()) { |
|
1270 |
methodOop method = interpreter_frame_method(); |
|
1271 |
guarantee(method->is_method(), "method is wrong in frame::verify"); |
|
1272 |
if (!method->is_static()) { |
|
1273 |
// fetch the receiver |
|
1274 |
oop* p = (oop*) interpreter_frame_local_at(0); |
|
1275 |
// make sure we have the right receiver type |
|
1276 |
} |
|
1277 |
} |
|
1278 |
COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "must be empty before verify");) |
|
3908
24b55ad4c228
6863023: need non-perm oops in code cache for JSR 292
jrose
parents:
2131
diff
changeset
|
1279 |
oops_do_internal(&VerifyOopClosure::verify_oop, NULL, (RegisterMap*)map, false); |
1 | 1280 |
} |
1281 |
||
1282 |
||
1283 |
#ifdef ASSERT |
|
1284 |
bool frame::verify_return_pc(address x) { |
|
1285 |
if (StubRoutines::returns_to_call_stub(x)) { |
|
1286 |
return true; |
|
1287 |
} |
|
1288 |
if (CodeCache::contains(x)) { |
|
1289 |
return true; |
|
1290 |
} |
|
1291 |
if (Interpreter::contains(x)) { |
|
1292 |
return true; |
|
1293 |
} |
|
1294 |
return false; |
|
1295 |
} |
|
1296 |
#endif |
|
1297 |
||
1298 |
||
1299 |
#ifdef ASSERT |
|
1300 |
void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const { |
|
1301 |
assert(is_interpreted_frame(), "Not an interpreted frame"); |
|
1302 |
// verify that the value is in the right part of the frame |
|
1303 |
address low_mark = (address) interpreter_frame_monitor_end(); |
|
1304 |
address high_mark = (address) interpreter_frame_monitor_begin(); |
|
1305 |
address current = (address) value; |
|
1306 |
||
1307 |
const int monitor_size = frame::interpreter_frame_monitor_size(); |
|
1308 |
guarantee((high_mark - current) % monitor_size == 0 , "Misaligned top of BasicObjectLock*"); |
|
1309 |
guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); |
|
1310 |
||
1311 |
guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); |
|
1312 |
guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); |
|
1313 |
} |
|
1314 |
#endif |
|
1315 |
||
1316 |
||
1317 |
//----------------------------------------------------------------------------------- |
|
1318 |
// StackFrameStream implementation |
|
1319 |
||
1320 |
StackFrameStream::StackFrameStream(JavaThread *thread, bool update) : _reg_map(thread, update) { |
|
1321 |
assert(thread->has_last_Java_frame(), "sanity check"); |
|
1322 |
_fr = thread->last_frame(); |
|
1323 |
_is_done = false; |
|
1324 |
} |