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