< prev index next >

src/os_cpu/linux_s390/vm/os_linux_s390.cpp

Print this page
rev 12273 : 8169317: [s390] Various minor bug fixes and adaptions.


 154   // stack slot. The call_stub stores the return_pc to the stack slot
 155   // of gpr10.
 156   if ((Interpreter::code() != NULL && Interpreter::contains(fr->pc())) ||
 157       (CodeCache::contains(fr->pc()) && !StubRoutines::contains(fr->pc()))) {
 158     return frame(fr->sender_sp(), fr->sender_pc());
 159   } else {
 160     if (StubRoutines::contains(fr->pc())) {
 161       StubCodeDesc* desc = StubCodeDesc::desc_for(fr->pc());
 162       if (desc && !strcmp(desc->name(),"call_stub")) {
 163         return frame(fr->sender_sp(), fr->callstub_sender_pc());
 164       } else {
 165         return frame(fr->sender_sp(), fr->sender_pc());
 166       }
 167     } else {
 168       return frame(fr->sender_sp(), fr->native_sender_pc());
 169     }
 170   }
 171 }
 172 
 173 frame os::current_frame() {


 174   intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer());
 175   assert (csp != NULL, "sp should not be NULL");
 176   // Pass a dummy pc. This way we don't have to load it from the
 177   // stack, since we don't know in which slot we can find it.
 178   frame topframe(csp, (address)0x8);
 179   if (os::is_first_C_frame(&topframe)) {
 180     // Stack is not walkable.
 181     return frame();
 182   } else {
 183     frame senderFrame = os::get_sender_for_C_frame(&topframe);
 184     assert(senderFrame.pc() != NULL, "Sender pc should not be NULL");
 185     // Return sender of sender of current topframe which hopefully
 186     // both have pc != NULL.


 187     frame tmp = os::get_sender_for_C_frame(&topframe);
 188     return os::get_sender_for_C_frame(&tmp);



 189   }
 190 }
 191 
 192 // Utility functions
 193 
 194 extern "C" JNIEXPORT int
 195 JVM_handle_linux_signal(int sig,
 196                         siginfo_t* info,
 197                         void* ucVoid,
 198                         int abort_if_unrecognized) {
 199   ucontext_t* uc = (ucontext_t*) ucVoid;
 200 
 201   Thread* t = Thread::current_or_null_safe();
 202 
 203   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 204   // (no destructors can be run).
 205   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 206 
 207   SignalHandlerMark shm(t);
 208 


 357       }
 358 
 359       // SIGTRAP-based implicit range check in compiled code.
 360       else if (sig == SIGFPE && TrapBasedRangeChecks &&
 361                (trap_pc != NULL) &&
 362                Assembler::is_sigtrap_range_check(trap_pc)) {
 363         if (TraceTraps) {
 364           tty->print_cr("trap: RANGE_CHECK at " INTPTR_FORMAT " (SIGFPE)", p2i(trap_pc));
 365         }
 366         stub = SharedRuntime::continuation_for_implicit_exception(thread, trap_pc, SharedRuntime::IMPLICIT_NULL);
 367       }
 368 
 369       else if (sig == SIGFPE && info->si_code == FPE_INTDIV) {
 370         stub = SharedRuntime::continuation_for_implicit_exception(thread, trap_pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
 371       }
 372 
 373       else if (sig == SIGBUS) {
 374         // BugId 4454115: A read from a MappedByteBuffer can fault here if the
 375         // underlying file has been truncated. Do not crash the VM in such a case.
 376         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 377         nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL;
 378         if (nm != NULL && nm->has_unsafe_access()) {
 379           // We don't really need a stub here! Just set the pending exeption and
 380           // continue at the next instruction after the faulting read. Returning
 381           // garbage from this read is ok.
 382           thread->set_pending_unsafe_access_error();
 383           uc->uc_mcontext.psw.addr = ((unsigned long)pc) + Assembler::instr_len(pc);
 384           return true;
 385         }
 386       }
 387     }
 388 
 389     else { // thread->thread_state() != _thread_in_Java
 390       if (sig == SIGILL && VM_Version::is_determine_features_test_running()) {
 391         // SIGILL must be caused by VM_Version::determine_features().
 392         //*(int *) (pc-6)=0; // Patch instruction to 0 to indicate that it causes a SIGILL.
 393                              // Flushing of icache is not necessary.
 394         stub = pc; // Continue with next instruction.
 395       } else if (thread->thread_state() == _thread_in_vm &&
 396                  sig == SIGBUS && thread->doing_unsafe_access()) {
 397         // We don't really need a stub here! Just set the pending exeption and




 154   // stack slot. The call_stub stores the return_pc to the stack slot
 155   // of gpr10.
 156   if ((Interpreter::code() != NULL && Interpreter::contains(fr->pc())) ||
 157       (CodeCache::contains(fr->pc()) && !StubRoutines::contains(fr->pc()))) {
 158     return frame(fr->sender_sp(), fr->sender_pc());
 159   } else {
 160     if (StubRoutines::contains(fr->pc())) {
 161       StubCodeDesc* desc = StubCodeDesc::desc_for(fr->pc());
 162       if (desc && !strcmp(desc->name(),"call_stub")) {
 163         return frame(fr->sender_sp(), fr->callstub_sender_pc());
 164       } else {
 165         return frame(fr->sender_sp(), fr->sender_pc());
 166       }
 167     } else {
 168       return frame(fr->sender_sp(), fr->native_sender_pc());
 169     }
 170   }
 171 }
 172 
 173 frame os::current_frame() {
 174   // Expected to return the stack pointer of this method.
 175   // But if inlined, returns the stack pointer of our caller!
 176   intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer());
 177   assert (csp != NULL, "sp should not be NULL");
 178   // Pass a dummy pc. This way we don't have to load it from the
 179   // stack, since we don't know in which slot we can find it.
 180   frame topframe(csp, (address)0x8);
 181   if (os::is_first_C_frame(&topframe)) {
 182     // Stack is not walkable.
 183     return frame();
 184   } else {
 185     frame senderFrame = os::get_sender_for_C_frame(&topframe);
 186     assert(senderFrame.pc() != NULL, "Sender pc should not be NULL");
 187     // Return sender of sender of current topframe which hopefully
 188     // both have pc != NULL.
 189 #ifdef _NMT_NOINLINE_   // Is set in slowdebug builds.
 190     // Current_stack_pointer is not inlined, we must pop one more frame.
 191     frame tmp = os::get_sender_for_C_frame(&topframe);
 192     return os::get_sender_for_C_frame(&tmp);
 193 #else
 194     return os::get_sender_for_C_frame(&topframe);
 195 #endif
 196   }
 197 }
 198 
 199 // Utility functions
 200 
 201 extern "C" JNIEXPORT int
 202 JVM_handle_linux_signal(int sig,
 203                         siginfo_t* info,
 204                         void* ucVoid,
 205                         int abort_if_unrecognized) {
 206   ucontext_t* uc = (ucontext_t*) ucVoid;
 207 
 208   Thread* t = Thread::current_or_null_safe();
 209 
 210   // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
 211   // (no destructors can be run).
 212   os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
 213 
 214   SignalHandlerMark shm(t);
 215 


 364       }
 365 
 366       // SIGTRAP-based implicit range check in compiled code.
 367       else if (sig == SIGFPE && TrapBasedRangeChecks &&
 368                (trap_pc != NULL) &&
 369                Assembler::is_sigtrap_range_check(trap_pc)) {
 370         if (TraceTraps) {
 371           tty->print_cr("trap: RANGE_CHECK at " INTPTR_FORMAT " (SIGFPE)", p2i(trap_pc));
 372         }
 373         stub = SharedRuntime::continuation_for_implicit_exception(thread, trap_pc, SharedRuntime::IMPLICIT_NULL);
 374       }
 375 
 376       else if (sig == SIGFPE && info->si_code == FPE_INTDIV) {
 377         stub = SharedRuntime::continuation_for_implicit_exception(thread, trap_pc, SharedRuntime::IMPLICIT_DIVIDE_BY_ZERO);
 378       }
 379 
 380       else if (sig == SIGBUS) {
 381         // BugId 4454115: A read from a MappedByteBuffer can fault here if the
 382         // underlying file has been truncated. Do not crash the VM in such a case.
 383         CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
 384         CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
 385         if (nm != NULL && nm->has_unsafe_access()) {
 386           // We don't really need a stub here! Just set the pending exeption and
 387           // continue at the next instruction after the faulting read. Returning
 388           // garbage from this read is ok.
 389           thread->set_pending_unsafe_access_error();
 390           uc->uc_mcontext.psw.addr = ((unsigned long)pc) + Assembler::instr_len(pc);
 391           return true;
 392         }
 393       }
 394     }
 395 
 396     else { // thread->thread_state() != _thread_in_Java
 397       if (sig == SIGILL && VM_Version::is_determine_features_test_running()) {
 398         // SIGILL must be caused by VM_Version::determine_features().
 399         //*(int *) (pc-6)=0; // Patch instruction to 0 to indicate that it causes a SIGILL.
 400                              // Flushing of icache is not necessary.
 401         stub = pc; // Continue with next instruction.
 402       } else if (thread->thread_state() == _thread_in_vm &&
 403                  sig == SIGBUS && thread->doing_unsafe_access()) {
 404         // We don't really need a stub here! Just set the pending exeption and


< prev index next >