319 assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer");
320 return result;
321 }
322
323 void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) {
324 *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value;
325 }
326
327 // Used by template based interpreter deoptimization
328 void frame::interpreter_frame_set_last_sp(intptr_t* sp) {
329 *((intptr_t**)addr_at(interpreter_frame_last_sp_offset)) = sp;
330 }
331
332 frame frame::sender_for_entry_frame(RegisterMap* map) const {
333 assert(map != NULL, "map must be set");
334 // Java frame called from C; skip all C frames and return top C
335 // frame of that chunk as the sender
336 JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
337 assert(!entry_frame_is_first(), "next Java fp must be non zero");
338 assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack");
339 map->clear();
340 assert(map->include_argument_oops(), "should be set by clear");
341 if (jfa->last_Java_pc() != NULL ) {
342 frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
343 return fr;
344 }
345 frame fr(jfa->last_Java_sp(), jfa->last_Java_fp());
346 return fr;
347 }
348
349 //------------------------------------------------------------------------------
350 // frame::verify_deopt_original_pc
351 //
352 // Verifies the calculated original PC of a deoptimization PC for the
353 // given unextended SP.
354 #ifdef ASSERT
355 void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
356 frame fr;
357
358 // This is ugly but it's better than to change {get,set}_original_pc
359 // to take an SP value as argument. And it's only a debugging
360 // method anyway.
361 fr._unextended_sp = unextended_sp;
362
363 address original_pc = nm->get_original_pc(&fr);
364 assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
365 }
366 #endif
752 }
753 internal_pf(sp, fp, pc, bcx);
754 }
755
756 // support for printing out where we are in a Java method
757 // needs to be passed current fp and bcp register values
758 // prints method name, bc index and bytecode name
759 extern "C" void pm(unsigned long fp, unsigned long bcx) {
760 DESCRIBE_FP_OFFSET(interpreter_frame_method);
761 unsigned long *p = (unsigned long *)fp;
762 Method* m = (Method*)p[frame::interpreter_frame_method_offset];
763 printbc(m, bcx);
764 }
765
766 #ifndef PRODUCT
767 // This is a generic constructor which is only used by pns() in debug.cpp.
768 frame::frame(void* sp, void* fp, void* pc) {
769 init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
770 }
771 #endif
|
319 assert((intptr_t*) result < fp(), "monitor end should be strictly below the frame pointer");
320 return result;
321 }
322
323 void frame::interpreter_frame_set_monitor_end(BasicObjectLock* value) {
324 *((BasicObjectLock**)addr_at(interpreter_frame_monitor_block_top_offset)) = value;
325 }
326
327 // Used by template based interpreter deoptimization
328 void frame::interpreter_frame_set_last_sp(intptr_t* sp) {
329 *((intptr_t**)addr_at(interpreter_frame_last_sp_offset)) = sp;
330 }
331
332 frame frame::sender_for_entry_frame(RegisterMap* map) const {
333 assert(map != NULL, "map must be set");
334 // Java frame called from C; skip all C frames and return top C
335 // frame of that chunk as the sender
336 JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
337 assert(!entry_frame_is_first(), "next Java fp must be non zero");
338 assert(jfa->last_Java_sp() > sp(), "must be above this frame on stack");
339 // Since we are walking the stack now this nested anchor is obviously walkable
340 // even if it wasn't when it was stacked.
341 if (!jfa->walkable()) {
342 // Capture _last_Java_pc (if needed) and mark anchor walkable.
343 jfa->capture_last_Java_pc();
344 }
345 map->clear();
346 assert(map->include_argument_oops(), "should be set by clear");
347 vmassert(jfa->last_Java_pc() != NULL, "not walkable");
348 frame fr(jfa->last_Java_sp(), jfa->last_Java_fp(), jfa->last_Java_pc());
349 return fr;
350 }
351
352 //------------------------------------------------------------------------------
353 // frame::verify_deopt_original_pc
354 //
355 // Verifies the calculated original PC of a deoptimization PC for the
356 // given unextended SP.
357 #ifdef ASSERT
358 void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) {
359 frame fr;
360
361 // This is ugly but it's better than to change {get,set}_original_pc
362 // to take an SP value as argument. And it's only a debugging
363 // method anyway.
364 fr._unextended_sp = unextended_sp;
365
366 address original_pc = nm->get_original_pc(&fr);
367 assert(nm->insts_contains(original_pc), "original PC must be in nmethod");
368 }
369 #endif
755 }
756 internal_pf(sp, fp, pc, bcx);
757 }
758
759 // support for printing out where we are in a Java method
760 // needs to be passed current fp and bcp register values
761 // prints method name, bc index and bytecode name
762 extern "C" void pm(unsigned long fp, unsigned long bcx) {
763 DESCRIBE_FP_OFFSET(interpreter_frame_method);
764 unsigned long *p = (unsigned long *)fp;
765 Method* m = (Method*)p[frame::interpreter_frame_method_offset];
766 printbc(m, bcx);
767 }
768
769 #ifndef PRODUCT
770 // This is a generic constructor which is only used by pns() in debug.cpp.
771 frame::frame(void* sp, void* fp, void* pc) {
772 init((intptr_t*)sp, (intptr_t*)fp, (address)pc);
773 }
774 #endif
775
776 void JavaFrameAnchor::make_walkable(JavaThread* thread) {
777 // last frame set?
778 if (last_Java_sp() == NULL) return;
779 // already walkable?
780 if (walkable()) return;
781 vmassert(Thread::current() == (Thread*)thread, "not current thread");
782 vmassert(last_Java_sp() != NULL, "not called from Java code?");
783 vmassert(last_Java_pc() == NULL, "already walkable");
784 capture_last_Java_pc();
785 vmassert(walkable(), "something went wrong");
786 }
787
788 void JavaFrameAnchor::capture_last_Java_pc() {
789 vmassert(_last_Java_sp != NULL, "no last frame set");
790 vmassert(_last_Java_pc == NULL, "already walkable");
791 _last_Java_pc = (address)_last_Java_sp[-1];
792 }
|