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