8253742: POSIX signal code cleanup

Reviewed-by: stuefe, dholmes
This commit is contained in:
Gerard Ziemski 2020-11-18 15:29:13 +00:00
parent fa8dce4f77
commit 50a2c22ff7
20 changed files with 155 additions and 262 deletions

View file

@ -106,11 +106,11 @@ char* os::non_memory_address_word() {
return (char*) -1;
}
address os::Linux::ucontext_get_pc(const ucontext_t * uc) {
address os::Posix::ucontext_get_pc(const ucontext_t * uc) {
return (address)uc->uc_mcontext.gregs[REG_PC];
}
void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
void os::Posix::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc;
}
@ -129,7 +129,7 @@ address os::fetch_frame_from_context(const void* ucVoid,
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = os::Linux::ucontext_get_pc(uc);
epc = os::Posix::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
@ -219,10 +219,10 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
//%note os_trap_1
if (info != NULL && uc != NULL && thread != NULL) {
pc = (address) os::Linux::ucontext_get_pc(uc);
pc = (address) os::Posix::ucontext_get_pc(uc);
if (StubRoutines::is_safefetch_fault(pc)) {
os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
os::Posix::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
return true;
}
@ -355,7 +355,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) {
int page_size = os::vm_page_size();
address addr = (address) info->si_addr;
address pc = os::Linux::ucontext_get_pc(uc);
address pc = os::Posix::ucontext_get_pc(uc);
// Make sure the pc and the faulting address are sane.
//
// If an instruction spans a page boundary, and the page containing
@ -417,7 +417,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
os::Linux::ucontext_set_pc(uc, stub);
os::Posix::ucontext_set_pc(uc, stub);
return true;
}
@ -590,7 +590,7 @@ void os::print_context(outputStream *st, const void *context) {
// Note: it may be unsafe to inspect memory near pc. For example, pc may
// point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best.
address pc = os::Linux::ucontext_get_pc(uc);
address pc = os::Posix::ucontext_get_pc(uc);
print_instructions(st, pc, sizeof(char));
st->cr();
}