< prev index next >

src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp

Print this page




 400       }
 401     }
 402   }
 403   assert(fr->is_java_frame(), "Safety check");
 404   return true;
 405 }
 406 
 407 // By default, gcc always save frame pointer (%ebp/%rbp) on stack. It may get
 408 // turned off by -fomit-frame-pointer,
 409 frame os::get_sender_for_C_frame(frame* fr) {
 410   return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
 411 }
 412 
 413 intptr_t* _get_previous_fp() {
 414 #if defined(SPARC_WORKS) || defined(__clang__) || defined(__llvm__)
 415   register intptr_t **ebp;
 416   __asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
 417 #else
 418   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 419 #endif
 420   return (intptr_t*) *ebp;   // we want what it points to.








 421 }
 422 
 423 
 424 frame os::current_frame() {
 425   intptr_t* fp = _get_previous_fp();
 426   frame myframe((intptr_t*)os::current_stack_pointer(),
 427                 (intptr_t*)fp,
 428                 CAST_FROM_FN_PTR(address, os::current_frame));
 429   if (os::is_first_C_frame(&myframe)) {
 430     // stack is not walkable
 431     return frame();
 432   } else {
 433     return os::get_sender_for_C_frame(&myframe);
 434   }
 435 }
 436 
 437 // Utility functions
 438 
 439 // From IA32 System Programming Guide
 440 enum {




 400       }
 401     }
 402   }
 403   assert(fr->is_java_frame(), "Safety check");
 404   return true;
 405 }
 406 
 407 // By default, gcc always save frame pointer (%ebp/%rbp) on stack. It may get
 408 // turned off by -fomit-frame-pointer,
 409 frame os::get_sender_for_C_frame(frame* fr) {
 410   return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
 411 }
 412 
 413 intptr_t* _get_previous_fp() {
 414 #if defined(SPARC_WORKS) || defined(__clang__) || defined(__llvm__)
 415   register intptr_t **ebp;
 416   __asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
 417 #else
 418   register intptr_t **ebp __asm__ (SPELL_REG_FP);
 419 #endif
 420   // ebp is for this frame (_get_previous_fp). We want the ebp for the
 421   // caller of os::current_frame*(), so go up two frames. However, for
 422   // optimized builds, _get_previous_fp() will be inlined, so only go
 423   // up 1 frame in that case.
 424 #ifdef _NMT_NOINLINE_
 425   return **(intptr_t***)ebp;
 426 #else
 427   return *ebp;
 428 #endif
 429 }
 430 
 431 
 432 frame os::current_frame() {
 433   intptr_t* fp = _get_previous_fp();
 434   frame myframe((intptr_t*)os::current_stack_pointer(),
 435                 (intptr_t*)fp,
 436                 CAST_FROM_FN_PTR(address, os::current_frame));
 437   if (os::is_first_C_frame(&myframe)) {
 438     // stack is not walkable
 439     return frame();
 440   } else {
 441     return os::get_sender_for_C_frame(&myframe);
 442   }
 443 }
 444 
 445 // Utility functions
 446 
 447 // From IA32 System Programming Guide
 448 enum {


< prev index next >