< prev index next >

src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp

Print this page
rev 59326 : 8244949: [PPC64] Reengineer assembler stop function
Reviewed-by:


 348       //     To notify all threads that they have to reach a safe point, safe point polling is used:
 349       //     All threads poll a certain mapped memory page. Normally, this page has read access.
 350       //     If the VM wants to inform the threads about impending safe points, it puts this
 351       //     page to read only ("poisens" the page), and the threads then reach a safe point.
 352       //   used for null checks:
 353       //     If the compiler finds a store it uses it for a null check. Unfortunately this
 354       //     happens rarely.  In heap based and disjoint base compressd oop modes also loads
 355       //     are used for null checks.
 356 
 357       // A VM-related SIGILL may only occur if we are not in the zero page.
 358       // On AIX, we get a SIGILL if we jump to 0x0 or to somewhere else
 359       // in the zero page, because it is filled with 0x0. We ignore
 360       // explicit SIGILLs in the zero page.
 361       if (sig == SIGILL && (pc < (address) 0x200)) {
 362         if (TraceTraps) {
 363           tty->print_raw_cr("SIGILL happened inside zero page.");
 364         }
 365         goto report_and_die;
 366       }
 367 

 368       // Handle signal from NativeJump::patch_verified_entry().
 369       if (( TrapBasedNotEntrantChecks && sig == SIGTRAP && nativeInstruction_at(pc)->is_sigtrap_zombie_not_entrant()) ||
 370           (!TrapBasedNotEntrantChecks && sig == SIGILL  && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant())) {
 371         if (TraceTraps) {
 372           tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
 373         }
 374         stub = SharedRuntime::get_handle_wrong_method_stub();
 375         goto run_stub;
 376       }
 377 
 378       else if (USE_POLL_BIT_ONLY
 379                ? (sig == SIGTRAP && ((NativeInstruction*)pc)->is_safepoint_poll())
 380                : (sig == SIGSEGV && SafepointMechanism::is_poll_address(addr))) {
 381         if (TraceTraps) {
 382           tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
 383                         USE_POLL_BIT_ONLY ? "SIGTRAP" : "SIGSEGV");
 384         }
 385         stub = SharedRuntime::get_poll_stub(pc);
 386         goto run_stub;
 387       }
 388 
 389       // SIGTRAP-based ic miss check in compiled code.
 390       else if (sig == SIGTRAP && TrapBasedICMissChecks &&
 391                nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) {
 392         if (TraceTraps) {


 417       }
 418 
 419 #ifdef COMPILER2
 420       // SIGTRAP-based implicit range check in compiled code.
 421       else if (sig == SIGTRAP && TrapBasedRangeChecks &&
 422                nativeInstruction_at(pc)->is_sigtrap_range_check()) {
 423         if (TraceTraps) {
 424           tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc);
 425         }
 426         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
 427         goto run_stub;
 428       }
 429 #endif
 430 
 431       else if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) {
 432         if (TraceTraps) {
 433           tty->print_raw_cr("Fix SIGFPE handler, trying divide by zero handler.");
 434         }
 435         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
 436         goto run_stub;
























 437       }
 438 
 439       else if (sig == SIGBUS) {
 440         // BugId 4454115: A read from a MappedByteBuffer can fault here if the
 441         // underlying file has been truncated. Do not crash the VM in such a case.
 442         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 443         CompiledMethod* nm = cb->as_compiled_method_or_null();
 444         bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
 445         if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
 446           address next_pc = pc + 4;
 447           if (is_unsafe_arraycopy) {
 448             next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
 449           }
 450           next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
 451           os::Aix::ucontext_set_pc(uc, next_pc);
 452           return 1;
 453         }
 454       }
 455     }
 456 




 348       //     To notify all threads that they have to reach a safe point, safe point polling is used:
 349       //     All threads poll a certain mapped memory page. Normally, this page has read access.
 350       //     If the VM wants to inform the threads about impending safe points, it puts this
 351       //     page to read only ("poisens" the page), and the threads then reach a safe point.
 352       //   used for null checks:
 353       //     If the compiler finds a store it uses it for a null check. Unfortunately this
 354       //     happens rarely.  In heap based and disjoint base compressd oop modes also loads
 355       //     are used for null checks.
 356 
 357       // A VM-related SIGILL may only occur if we are not in the zero page.
 358       // On AIX, we get a SIGILL if we jump to 0x0 or to somewhere else
 359       // in the zero page, because it is filled with 0x0. We ignore
 360       // explicit SIGILLs in the zero page.
 361       if (sig == SIGILL && (pc < (address) 0x200)) {
 362         if (TraceTraps) {
 363           tty->print_raw_cr("SIGILL happened inside zero page.");
 364         }
 365         goto report_and_die;
 366       }
 367 
 368       int stop_type = -1;
 369       // Handle signal from NativeJump::patch_verified_entry().
 370       if (sig == SIGILL && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant()) {

 371         if (TraceTraps) {
 372           tty->print_cr("trap: zombie_not_entrant");
 373         }
 374         stub = SharedRuntime::get_handle_wrong_method_stub();
 375         goto run_stub;
 376       }
 377 
 378       else if (USE_POLL_BIT_ONLY
 379                ? (sig == SIGTRAP && ((NativeInstruction*)pc)->is_safepoint_poll())
 380                : (sig == SIGSEGV && SafepointMechanism::is_poll_address(addr))) {
 381         if (TraceTraps) {
 382           tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
 383                         USE_POLL_BIT_ONLY ? "SIGTRAP" : "SIGSEGV");
 384         }
 385         stub = SharedRuntime::get_poll_stub(pc);
 386         goto run_stub;
 387       }
 388 
 389       // SIGTRAP-based ic miss check in compiled code.
 390       else if (sig == SIGTRAP && TrapBasedICMissChecks &&
 391                nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) {
 392         if (TraceTraps) {


 417       }
 418 
 419 #ifdef COMPILER2
 420       // SIGTRAP-based implicit range check in compiled code.
 421       else if (sig == SIGTRAP && TrapBasedRangeChecks &&
 422                nativeInstruction_at(pc)->is_sigtrap_range_check()) {
 423         if (TraceTraps) {
 424           tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc);
 425         }
 426         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
 427         goto run_stub;
 428       }
 429 #endif
 430 
 431       else if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) {
 432         if (TraceTraps) {
 433           tty->print_raw_cr("Fix SIGFPE handler, trying divide by zero handler.");
 434         }
 435         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
 436         goto run_stub;
 437       }
 438 
 439       // stop on request
 440       else if (sig == SIGTRAP && (stop_type = nativeInstruction_at(pc)->get_stop_type()) != -1) {
 441         const char *msg = NULL,
 442                    *detail_msg = (const char*)(uc->uc_mcontext.jmp_context.gpr[0]);
 443         switch (stop_type) {
 444           case MacroAssembler::stop_stop              :  msg = "stop"; break;
 445           case MacroAssembler::stop_untested          :  msg = "untested"; break;
 446           case MacroAssembler::stop_unimplemented     :  msg = "unimplemented"; break;
 447           case MacroAssembler::stop_shouldnotreachhere:  msg = "shouldnotreachhere"; detail_msg = NULL; break;
 448           default: msg = "unknown"; break;
 449         }
 450         if (detail_msg == NULL) {
 451           detail_msg = "no details provided";
 452         }
 453 
 454         if (TraceTraps) {
 455           tty->print_cr("trap: %s: %s (SIGTRAP, stop type %d)", msg, detail_msg, stop_type);
 456         }
 457 
 458         va_list detail_args;
 459         VMError::report_and_die(t, ucVoid, NULL, 0, msg, detail_msg, detail_args);
 460         va_end(detail_args);
 461       }
 462 
 463       else if (sig == SIGBUS) {
 464         // BugId 4454115: A read from a MappedByteBuffer can fault here if the
 465         // underlying file has been truncated. Do not crash the VM in such a case.
 466         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 467         CompiledMethod* nm = cb->as_compiled_method_or_null();
 468         bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
 469         if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
 470           address next_pc = pc + 4;
 471           if (is_unsafe_arraycopy) {
 472             next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
 473           }
 474           next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
 475           os::Aix::ucontext_set_pc(uc, next_pc);
 476           return 1;
 477         }
 478       }
 479     }
 480 


< prev index next >