< prev index next >

src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp

Print this page
rev 48405 : 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
Summary: Use mmap on AIX to allocate protected page. Use trap instructions for polling if UseSIGTRAP is enabled.
Reviewed-by:


  29 #include "classfile/classLoader.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "code/codeCache.hpp"
  33 #include "code/icBuffer.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "interpreter/interpreter.hpp"
  36 #include "memory/allocation.inline.hpp"
  37 #include "nativeInst_ppc.hpp"
  38 #include "os_share_linux.hpp"
  39 #include "prims/jniFastGetField.hpp"
  40 #include "prims/jvm_misc.hpp"
  41 #include "runtime/arguments.hpp"
  42 #include "runtime/extendedPC.hpp"
  43 #include "runtime/frame.inline.hpp"
  44 #include "runtime/interfaceSupport.hpp"
  45 #include "runtime/java.hpp"
  46 #include "runtime/javaCalls.hpp"
  47 #include "runtime/mutexLocker.hpp"
  48 #include "runtime/osThread.hpp"

  49 #include "runtime/sharedRuntime.hpp"
  50 #include "runtime/stubRoutines.hpp"
  51 #include "runtime/thread.inline.hpp"
  52 #include "runtime/timer.hpp"
  53 #include "utilities/events.hpp"
  54 #include "utilities/vmError.hpp"
  55 
  56 // put OS-includes here
  57 # include <sys/types.h>
  58 # include <sys/mman.h>
  59 # include <pthread.h>
  60 # include <signal.h>
  61 # include <errno.h>
  62 # include <dlfcn.h>
  63 # include <stdlib.h>
  64 # include <stdio.h>
  65 # include <unistd.h>
  66 # include <sys/resource.h>
  67 # include <pthread.h>
  68 # include <sys/stat.h>


 365       // On AIX, we get a SIGILL if we jump to 0x0 or to somewhere else
 366       // in the zero page, because it is filled with 0x0. We ignore
 367       // explicit SIGILLs in the zero page.
 368       if (sig == SIGILL && (pc < (address) 0x200)) {
 369         if (TraceTraps) {
 370           tty->print_raw_cr("SIGILL happened inside zero page.");
 371         }
 372         goto report_and_die;
 373       }
 374 
 375       CodeBlob *cb = NULL;
 376       // Handle signal from NativeJump::patch_verified_entry().
 377       if (( TrapBasedNotEntrantChecks && sig == SIGTRAP && nativeInstruction_at(pc)->is_sigtrap_zombie_not_entrant()) ||
 378           (!TrapBasedNotEntrantChecks && sig == SIGILL  && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant())) {
 379         if (TraceTraps) {
 380           tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
 381         }
 382         stub = SharedRuntime::get_handle_wrong_method_stub();
 383       }
 384 
 385       else if (sig == SIGSEGV &&
 386                // A linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults
 387                // in 64bit mode (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6),
 388                // especially when we try to read from the safepoint polling page. So the check
 389                //   (address)info->si_addr == os::get_standard_polling_page()
 390                // doesn't work for us. We use:
 391                ((NativeInstruction*)pc)->is_safepoint_poll() &&
 392                CodeCache::contains((void*) pc) &&
 393                ((cb = CodeCache::find_blob(pc)) != NULL) &&
 394                cb->is_compiled()) {
 395         if (TraceTraps) {
 396           tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));

 397         }
 398         stub = SharedRuntime::get_poll_stub(pc);
 399       }
 400 
 401       // SIGTRAP-based ic miss check in compiled code.
 402       else if (sig == SIGTRAP && TrapBasedICMissChecks &&
 403                nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) {
 404         if (TraceTraps) {
 405           tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
 406         }
 407         stub = SharedRuntime::get_ic_miss_stub();
 408       }
 409 
 410       // SIGTRAP-based implicit null check in compiled code.
 411       else if (sig == SIGTRAP && TrapBasedNullChecks &&
 412                nativeInstruction_at(pc)->is_sigtrap_null_check()) {
 413         if (TraceTraps) {
 414           tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
 415         }
 416         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);




  29 #include "classfile/classLoader.hpp"
  30 #include "classfile/systemDictionary.hpp"
  31 #include "classfile/vmSymbols.hpp"
  32 #include "code/codeCache.hpp"
  33 #include "code/icBuffer.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "interpreter/interpreter.hpp"
  36 #include "memory/allocation.inline.hpp"
  37 #include "nativeInst_ppc.hpp"
  38 #include "os_share_linux.hpp"
  39 #include "prims/jniFastGetField.hpp"
  40 #include "prims/jvm_misc.hpp"
  41 #include "runtime/arguments.hpp"
  42 #include "runtime/extendedPC.hpp"
  43 #include "runtime/frame.inline.hpp"
  44 #include "runtime/interfaceSupport.hpp"
  45 #include "runtime/java.hpp"
  46 #include "runtime/javaCalls.hpp"
  47 #include "runtime/mutexLocker.hpp"
  48 #include "runtime/osThread.hpp"
  49 #include "runtime/safepointMechanism.hpp"
  50 #include "runtime/sharedRuntime.hpp"
  51 #include "runtime/stubRoutines.hpp"
  52 #include "runtime/thread.inline.hpp"
  53 #include "runtime/timer.hpp"
  54 #include "utilities/events.hpp"
  55 #include "utilities/vmError.hpp"
  56 
  57 // put OS-includes here
  58 # include <sys/types.h>
  59 # include <sys/mman.h>
  60 # include <pthread.h>
  61 # include <signal.h>
  62 # include <errno.h>
  63 # include <dlfcn.h>
  64 # include <stdlib.h>
  65 # include <stdio.h>
  66 # include <unistd.h>
  67 # include <sys/resource.h>
  68 # include <pthread.h>
  69 # include <sys/stat.h>


 366       // On AIX, we get a SIGILL if we jump to 0x0 or to somewhere else
 367       // in the zero page, because it is filled with 0x0. We ignore
 368       // explicit SIGILLs in the zero page.
 369       if (sig == SIGILL && (pc < (address) 0x200)) {
 370         if (TraceTraps) {
 371           tty->print_raw_cr("SIGILL happened inside zero page.");
 372         }
 373         goto report_and_die;
 374       }
 375 
 376       CodeBlob *cb = NULL;
 377       // Handle signal from NativeJump::patch_verified_entry().
 378       if (( TrapBasedNotEntrantChecks && sig == SIGTRAP && nativeInstruction_at(pc)->is_sigtrap_zombie_not_entrant()) ||
 379           (!TrapBasedNotEntrantChecks && sig == SIGILL  && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant())) {
 380         if (TraceTraps) {
 381           tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL");
 382         }
 383         stub = SharedRuntime::get_handle_wrong_method_stub();
 384       }
 385 
 386       else if (sig == ((SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? SIGTRAP : SIGSEGV) &&
 387                // A linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults
 388                // in 64bit mode (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6),
 389                // especially when we try to read from the safepoint polling page. So the check
 390                //   (address)info->si_addr == os::get_standard_polling_page()
 391                // doesn't work for us. We use:
 392                ((NativeInstruction*)pc)->is_safepoint_poll() &&
 393                CodeCache::contains((void*) pc) &&
 394                ((cb = CodeCache::find_blob(pc)) != NULL) &&
 395                cb->is_compiled()) {
 396         if (TraceTraps) {
 397           tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
 398                         (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) ? "SIGTRAP" : "SIGSEGV");
 399         }
 400         stub = SharedRuntime::get_poll_stub(pc);
 401       }
 402 
 403       // SIGTRAP-based ic miss check in compiled code.
 404       else if (sig == SIGTRAP && TrapBasedICMissChecks &&
 405                nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) {
 406         if (TraceTraps) {
 407           tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
 408         }
 409         stub = SharedRuntime::get_ic_miss_stub();
 410       }
 411 
 412       // SIGTRAP-based implicit null check in compiled code.
 413       else if (sig == SIGTRAP && TrapBasedNullChecks &&
 414                nativeInstruction_at(pc)->is_sigtrap_null_check()) {
 415         if (TraceTraps) {
 416           tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
 417         }
 418         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);


< prev index next >