8145114: const-correctness for ucontext_t* reading functions

Reviewed-by: dholmes, coleenp
This commit is contained in:
Thomas Stuefe 2015-12-14 02:29:11 -05:00
parent db823b775b
commit 0eda47f124
24 changed files with 151 additions and 151 deletions

View File

@ -1216,7 +1216,7 @@ void os::shutdown() {
// Note: os::abort() might be called very early during initialization, or
// called from signal handler. Before adding something to os::abort(), make
// sure it is async-safe and can handle partially initialized VM.
void os::abort(bool dump_core, void* siginfo, void* context) {
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
#ifndef PRODUCT
@ -3815,7 +3815,7 @@ void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
Thread* thread = context.thread();
OSThread* osthread = thread->osthread();
if (osthread->ucontext() != NULL) {
_epc = os::Aix::ucontext_get_pc((ucontext_t *) context.ucontext());
_epc = os::Aix::ucontext_get_pc((const ucontext_t *) context.ucontext());
} else {
// NULL context is unexpected, double-check this is the VMThread.
guarantee(thread->is_VM_thread(), "can only be called for VMThread");

View File

@ -123,8 +123,8 @@ class Aix {
static int vm_default_page_size(void ) { return 8*K; }
static address ucontext_get_pc(const ucontext_t* uc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static intptr_t* ucontext_get_fp(ucontext_t* uc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
// Set PC into context. Needed for continuation after signal.
static void ucontext_set_pc(ucontext_t* uc, address pc);

View File

@ -1077,7 +1077,7 @@ void os::shutdown() {
// Note: os::abort() might be called very early during initialization, or
// called from signal handler. Before adding something to os::abort(), make
// sure it is async-safe and can handle partially initialized VM.
void os::abort(bool dump_core, void* siginfo, void* context) {
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
#ifndef PRODUCT
@ -3643,7 +3643,7 @@ void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
Thread* thread = context.thread();
OSThread* osthread = thread->osthread();
if (osthread->ucontext() != NULL) {
_epc = os::Bsd::ucontext_get_pc((ucontext_t *) context.ucontext());
_epc = os::Bsd::ucontext_get_pc((const ucontext_t *) context.ucontext());
} else {
// NULL context is unexpected, double-check this is the VMThread
guarantee(thread->is_VM_thread(), "can only be called for VMThread");

View File

@ -86,17 +86,17 @@ class Bsd {
static int page_size(void) { return _page_size; }
static void set_page_size(int val) { _page_size = val; }
static address ucontext_get_pc(ucontext_t* uc);
static address ucontext_get_pc(const ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static intptr_t* ucontext_get_fp(ucontext_t* uc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
//
// This interface should be declared in os_bsd_i486.hpp, but
// that file provides extensions to the os class and not the
// Bsd class.
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
intptr_t** ret_sp, intptr_t** ret_fp);
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);

View File

@ -1341,7 +1341,7 @@ void os::shutdown() {
// Note: os::abort() might be called very early during initialization, or
// called from signal handler. Before adding something to os::abort(), make
// sure it is async-safe and can handle partially initialized VM.
void os::abort(bool dump_core, void* siginfo, void* context) {
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
#ifndef PRODUCT
@ -4853,7 +4853,7 @@ void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
Thread* thread = context.thread();
OSThread* osthread = thread->osthread();
if (osthread->ucontext() != NULL) {
_epc = os::Linux::ucontext_get_pc((ucontext_t *) context.ucontext());
_epc = os::Linux::ucontext_get_pc((const ucontext_t *) context.ucontext());
} else {
// NULL context is unexpected, double-check this is the VMThread
guarantee(thread->is_VM_thread(), "can only be called for VMThread");

View File

@ -123,17 +123,17 @@ class Linux {
static int vm_default_page_size(void) { return _vm_default_page_size; }
static address ucontext_get_pc(ucontext_t* uc);
static address ucontext_get_pc(const ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static intptr_t* ucontext_get_fp(ucontext_t* uc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
//
// This interface should be declared in os_linux_i486.hpp, but
// that file provides extensions to the os class and not the
// Linux class.
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
intptr_t** ret_sp, intptr_t** ret_fp);
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);

View File

@ -1031,7 +1031,7 @@ int os::Posix::unblock_thread_signal_mask(const sigset_t *set) {
return pthread_sigmask(SIG_UNBLOCK, set, NULL);
}
address os::Posix::ucontext_get_pc(ucontext_t* ctx) {
address os::Posix::ucontext_get_pc(const ucontext_t* ctx) {
#ifdef TARGET_OS_FAMILY_linux
return Linux::ucontext_get_pc(ctx);
#elif defined(TARGET_OS_FAMILY_solaris)

View File

@ -76,7 +76,7 @@ public:
// A POSIX conform, platform-independend siginfo print routine.
static void print_siginfo_brief(outputStream* os, const siginfo_t* si);
static address ucontext_get_pc(ucontext_t* ctx);
static address ucontext_get_pc(const ucontext_t* ctx);
// Set PC into context. Needed for continuation after signal.
static void ucontext_set_pc(ucontext_t* ctx, address pc);
};

View File

@ -1380,7 +1380,7 @@ void os::shutdown() {
// Note: os::abort() might be called very early during initialization, or
// called from signal handler. Before adding something to os::abort(), make
// sure it is async-safe and can handle partially initialized VM.
void os::abort(bool dump_core, void* siginfo, void* context) {
void os::abort(bool dump_core, void* siginfo, const void* context) {
os::shutdown();
if (dump_core) {
#ifndef PRODUCT
@ -3736,7 +3736,7 @@ void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
Thread* thread = context.thread();
OSThread* osthread = thread->osthread();
if (osthread->ucontext() != NULL) {
_epc = os::Solaris::ucontext_get_pc((ucontext_t *) context.ucontext());
_epc = os::Solaris::ucontext_get_pc((const ucontext_t *) context.ucontext());
} else {
// NULL context is unexpected, double-check this is the VMThread
guarantee(thread->is_VM_thread(), "can only be called for VMThread");

View File

@ -130,15 +130,15 @@ class Solaris {
static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
static bool valid_stack_address(Thread* thread, address sp);
static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect);
static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
ucontext_t* uc);
static bool valid_ucontext(Thread* thread, const ucontext_t* valid, const ucontext_t* suspect);
static const ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
const ucontext_t* uc);
static ExtendedPC ucontext_get_ExtendedPC(ucontext_t* uc);
static intptr_t* ucontext_get_sp(ucontext_t* uc);
static ExtendedPC ucontext_get_ExtendedPC(const ucontext_t* uc);
static intptr_t* ucontext_get_sp(const ucontext_t* uc);
// ucontext_get_fp() is only used by Solaris X86 (see note below)
static intptr_t* ucontext_get_fp(ucontext_t* uc);
static address ucontext_get_pc(ucontext_t* uc);
static intptr_t* ucontext_get_fp(const ucontext_t* uc);
static address ucontext_get_pc(const ucontext_t* uc);
static void ucontext_set_pc(ucontext_t* uc, address pc);
// For Analyzer Forte AsyncGetCallTrace profiling support:
@ -147,7 +147,7 @@ class Solaris {
// We should have different declarations of this interface in
// os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
// provides extensions to the os class and not the Solaris class.
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
static ExtendedPC fetch_frame_from_ucontext(Thread* thread, const ucontext_t* uc,
intptr_t** ret_sp, intptr_t** ret_fp);
static bool get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr);

View File

@ -1028,7 +1028,7 @@ void os::check_dump_limit(char* buffer, size_t buffsz) {
VMError::record_coredump_status(buffer, status);
}
void os::abort(bool dump_core, void* siginfo, void* context) {
void os::abort(bool dump_core, void* siginfo, const void* context) {
HINSTANCE dbghelp;
EXCEPTION_POINTERS ep;
MINIDUMP_EXCEPTION_INFORMATION mei;

View File

@ -98,12 +98,12 @@ address os::Aix::ucontext_get_pc(const ucontext_t * uc) {
return (address)uc->uc_mcontext.jmp_context.iar;
}
intptr_t* os::Aix::ucontext_get_sp(ucontext_t * uc) {
intptr_t* os::Aix::ucontext_get_sp(const ucontext_t * uc) {
// gpr1 holds the stack pointer on aix
return (intptr_t*)uc->uc_mcontext.jmp_context.gpr[1/*REG_SP*/];
}
intptr_t* os::Aix::ucontext_get_fp(ucontext_t * uc) {
intptr_t* os::Aix::ucontext_get_fp(const ucontext_t * uc) {
return NULL;
}
@ -111,11 +111,11 @@ void os::Aix::ucontext_set_pc(ucontext_t* uc, address new_pc) {
uc->uc_mcontext.jmp_context.iar = (uint64_t) new_pc;
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t* uc = (ucontext_t*)ucVoid;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Aix::ucontext_get_pc(uc));
@ -131,7 +131,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -507,10 +507,10 @@ size_t os::Aix::default_guard_size(os::ThreadType thr_type) {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t* uc = (ucontext_t*)context;
const ucontext_t* uc = (const ucontext_t*)context;
st->print_cr("Registers:");
st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.jmp_context.iar);
@ -544,7 +544,7 @@ void os::print_context(outputStream *st, void *context) {
st->cr();
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;

View File

@ -304,7 +304,7 @@ void os::initialize_thread(Thread* thr) {
// Nothing to do.
}
address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
address os::Bsd::ucontext_get_pc(const ucontext_t * uc) {
return (address)uc->context_pc;
}
@ -312,11 +312,11 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->context_pc = (intptr_t)pc ;
}
intptr_t* os::Bsd::ucontext_get_sp(ucontext_t * uc) {
intptr_t* os::Bsd::ucontext_get_sp(const ucontext_t * uc) {
return (intptr_t*)uc->context_sp;
}
intptr_t* os::Bsd::ucontext_get_fp(ucontext_t * uc) {
intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) {
return (intptr_t*)uc->context_fp;
}
@ -327,7 +327,7 @@ intptr_t* os::Bsd::ucontext_get_fp(ucontext_t * uc) {
// os::fetch_frame_from_context().
// This method is also used for stack overflow signal handling.
ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
@ -336,11 +336,11 @@ ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread,
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t* uc = (ucontext_t*)ucVoid;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Bsd::ucontext_get_pc(uc));
@ -356,7 +356,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -971,10 +971,10 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
#ifdef AMD64
st->print( "RAX=" INTPTR_FORMAT, uc->context_rax);
@ -1032,10 +1032,10 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -106,7 +106,7 @@ void os::initialize_thread(Thread* thr) {
// Nothing to do.
}
address os::Bsd::ucontext_get_pc(ucontext_t* uc) {
address os::Bsd::ucontext_get_pc(const ucontext_t* uc) {
ShouldNotCallThis();
return NULL;
}
@ -115,14 +115,14 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ShouldNotCallThis();
return ExtendedPC();
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
ShouldNotCallThis();
return frame();
}
@ -374,11 +374,11 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream* st, void* context) {
void os::print_context(outputStream* st, const void* context) {
ShouldNotCallThis();
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
ShouldNotCallThis();
}

View File

@ -109,7 +109,7 @@ char* os::non_memory_address_word() {
void os::initialize_thread(Thread *thr) {
}
address os::Linux::ucontext_get_pc(ucontext_t * uc) {
address os::Linux::ucontext_get_pc(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (address)uc->uc_mcontext.gregs[REG_PC];
#else
@ -125,7 +125,7 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
#endif
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
#else
@ -133,7 +133,7 @@ intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
#endif
}
intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
#ifdef BUILTIN_SIM
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
#else
@ -147,7 +147,7 @@ intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
// frames. Currently we don't do that on Linux, so it's the same as
// os::fetch_frame_from_context().
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
@ -156,11 +156,11 @@ ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t* uc = (ucontext_t*)ucVoid;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
@ -176,7 +176,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -591,10 +591,10 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
#ifdef BUILTIN_SIM
st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
@ -643,10 +643,10 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -99,7 +99,7 @@ void os::initialize_thread(Thread *thread) { }
// Frame information (pc, sp, fp) retrieved via ucontext
// always looks like a C-frame according to the frame
// conventions in frame_ppc64.hpp.
address os::Linux::ucontext_get_pc(ucontext_t * uc) {
address os::Linux::ucontext_get_pc(const ucontext_t * uc) {
// On powerpc64, ucontext_t is not selfcontained but contains
// a pointer to an optional substructure (mcontext_t.regs) containing the volatile
// registers - NIP, among others.
@ -122,19 +122,19 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->uc_mcontext.regs->nip = (unsigned long)pc;
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
}
intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
return NULL;
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t* uc = (ucontext_t*)ucVoid;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
@ -150,7 +150,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -564,10 +564,10 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t* uc = (ucontext_t*)context;
const ucontext_t* uc = (const ucontext_t*)context;
st->print_cr("Registers:");
st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
@ -595,10 +595,10 @@ void os::print_context(outputStream *st, void *context) {
st->cr();
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -92,7 +92,7 @@ enum {
// signal frames. Currently we don't do that on Linux, so it's the
// same as os::fetch_frame_from_context().
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc,
const ucontext_t* uc,
intptr_t** ret_sp,
intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
@ -102,10 +102,10 @@ ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ucontext_t* uc = (ucontext_t*) ucVoid;
const ucontext_t* uc = (const ucontext_t*) ucVoid;
ExtendedPC epc;
if (uc != NULL) {
@ -130,7 +130,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, NULL);
return frame(sp, frame::unpatchable, epc.pc());
@ -213,10 +213,10 @@ char* os::non_memory_address_word() {
void os::initialize_thread(Thread* thr) {}
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t* uc = (ucontext_t*)context;
const ucontext_t* uc = (const ucontext_t*)context;
sigcontext* sc = (sigcontext*)context;
st->print_cr("Registers:");
@ -291,11 +291,11 @@ void os::print_context(outputStream *st, void *context) {
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
sigcontext* sc = (sigcontext*)context;
const ucontext_t *uc = (const ucontext_t*)context;
const sigcontext* sc = (const sigcontext*)context;
intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Register to memory mapping:");
@ -343,7 +343,7 @@ void os::print_register_info(outputStream *st, void *context) {
}
address os::Linux::ucontext_get_pc(ucontext_t* uc) {
address os::Linux::ucontext_get_pc(const ucontext_t* uc) {
return (address) SIG_PC((sigcontext*)uc);
}
@ -353,13 +353,13 @@ void os::Linux::ucontext_set_pc(ucontext_t* uc, address pc) {
SIG_NPC(ctx) = (intptr_t)(pc+4);
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t *uc) {
intptr_t* os::Linux::ucontext_get_sp(const ucontext_t *uc) {
return (intptr_t*)
((intptr_t)SIG_REGS((sigcontext*)uc).u_regs[CON_O6] + STACK_BIAS);
}
// not used on Sparc
intptr_t* os::Linux::ucontext_get_fp(ucontext_t *uc) {
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t *uc) {
ShouldNotReachHere();
return NULL;
}
@ -684,7 +684,7 @@ JVM_handle_linux_signal(int sig,
}
if (pc == NULL && uc != NULL) {
pc = os::Linux::ucontext_get_pc((ucontext_t*)uc);
pc = os::Linux::ucontext_get_pc((const ucontext_t*)uc);
}
// unmask current signal

View File

@ -117,7 +117,7 @@ void os::initialize_thread(Thread* thr) {
// Nothing to do.
}
address os::Linux::ucontext_get_pc(ucontext_t * uc) {
address os::Linux::ucontext_get_pc(const ucontext_t * uc) {
return (address)uc->uc_mcontext.gregs[REG_PC];
}
@ -125,11 +125,11 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc;
}
intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
}
intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
}
@ -140,7 +140,7 @@ intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
// os::fetch_frame_from_context().
// This method is also used for stack overflow signal handling.
ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
@ -149,11 +149,11 @@ ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread,
return os::fetch_frame_from_context(uc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t* uc = (ucontext_t*)ucVoid;
const ucontext_t* uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = ExtendedPC(os::Linux::ucontext_get_pc(uc));
@ -169,7 +169,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -784,10 +784,10 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
#ifdef AMD64
st->print( "RAX=" INTPTR_FORMAT, (intptr_t)uc->uc_mcontext.gregs[REG_RAX]);
@ -847,10 +847,10 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -100,7 +100,7 @@ void os::initialize_thread(Thread * thr){
// Nothing to do.
}
address os::Linux::ucontext_get_pc(ucontext_t* uc) {
address os::Linux::ucontext_get_pc(const ucontext_t* uc) {
ShouldNotCallThis();
}
@ -108,13 +108,13 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
ShouldNotCallThis();
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp,
intptr_t** ret_fp) {
ShouldNotCallThis();
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
ShouldNotCallThis();
}
@ -406,11 +406,11 @@ size_t os::current_stack_size() {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_context(outputStream* st, void* context) {
void os::print_context(outputStream* st, const void* context) {
ShouldNotCallThis();
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
ShouldNotCallThis();
}

View File

@ -121,7 +121,7 @@ char* os::non_memory_address_word() {
// There are issues with libthread giving out uc_links for different threads
// on the same uc_link chain and bad or circular links.
//
bool os::Solaris::valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect) {
bool os::Solaris::valid_ucontext(Thread* thread, const ucontext_t* valid, const ucontext_t* suspect) {
if (valid >= suspect ||
valid->uc_stack.ss_flags != suspect->uc_stack.ss_flags ||
valid->uc_stack.ss_sp != suspect->uc_stack.ss_sp ||
@ -148,10 +148,10 @@ bool os::Solaris::valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t*
// We will only follow one level of uc_link since there are libthread
// issues with ucontext linking and it is better to be safe and just
// let caller retry later.
ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
ucontext_t *uc) {
const ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
const ucontext_t *uc) {
ucontext_t *retuc = NULL;
const ucontext_t *retuc = NULL;
// Sometimes the topmost register windows are not properly flushed.
// i.e., if the kernel would have needed to take a page fault
@ -179,7 +179,7 @@ ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
}
// Assumes ucontext is valid
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(const ucontext_t *uc) {
address pc = (address)uc->uc_mcontext.gregs[REG_PC];
// set npc to zero to avoid using it for safepoint, good for profiling only
return ExtendedPC(pc);
@ -191,17 +191,17 @@ void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
}
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
intptr_t* os::Solaris::ucontext_get_sp(const ucontext_t *uc) {
return (intptr_t*)((intptr_t)uc->uc_mcontext.gregs[REG_SP] + STACK_BIAS);
}
// Solaris X86 only
intptr_t* os::Solaris::ucontext_get_fp(ucontext_t *uc) {
intptr_t* os::Solaris::ucontext_get_fp(const ucontext_t *uc) {
ShouldNotReachHere();
return NULL;
}
address os::Solaris::ucontext_get_pc(ucontext_t *uc) {
address os::Solaris::ucontext_get_pc(const ucontext_t *uc) {
return (address) uc->uc_mcontext.gregs[REG_PC];
}
@ -215,24 +215,24 @@ address os::Solaris::ucontext_get_pc(ucontext_t *uc) {
// here we try to skip nested signal frames.
// This method is also used for stack overflow signal handling.
ExtendedPC os::Solaris::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp == NULL, "just checking");
ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc);
const ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc);
return os::fetch_frame_from_context(luc, ret_sp, ret_fp);
}
// ret_fp parameter is only used by Solaris X86.
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t *uc = (ucontext_t*)ucVoid;
const ucontext_t *uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = os::Solaris::ucontext_get_ExtendedPC(uc);
@ -246,7 +246,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -605,10 +605,10 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
return false;
}
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT
@ -682,10 +682,10 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
st->print_cr("Register to memory mapping:");

View File

@ -121,7 +121,7 @@ char* os::non_memory_address_word() {
// There are issues with libthread giving out uc_links for different threads
// on the same uc_link chain and bad or circular links.
//
bool os::Solaris::valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect) {
bool os::Solaris::valid_ucontext(Thread* thread, const ucontext_t* valid, const ucontext_t* suspect) {
if (valid >= suspect ||
valid->uc_stack.ss_flags != suspect->uc_stack.ss_flags ||
valid->uc_stack.ss_sp != suspect->uc_stack.ss_sp ||
@ -146,10 +146,10 @@ bool os::Solaris::valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t*
// We will only follow one level of uc_link since there are libthread
// issues with ucontext linking and it is better to be safe and just
// let caller retry later.
ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
ucontext_t *uc) {
const ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
const ucontext_t *uc) {
ucontext_t *retuc = NULL;
const ucontext_t *retuc = NULL;
if (uc != NULL) {
if (uc->uc_link == NULL) {
@ -171,7 +171,7 @@ ucontext_t* os::Solaris::get_valid_uc_in_signal_handler(Thread *thread,
}
// Assumes ucontext is valid
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(ucontext_t *uc) {
ExtendedPC os::Solaris::ucontext_get_ExtendedPC(const ucontext_t *uc) {
return ExtendedPC((address)uc->uc_mcontext.gregs[REG_PC]);
}
@ -180,16 +180,16 @@ void os::Solaris::ucontext_set_pc(ucontext_t* uc, address pc) {
}
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_sp(ucontext_t *uc) {
intptr_t* os::Solaris::ucontext_get_sp(const ucontext_t *uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
}
// Assumes ucontext is valid
intptr_t* os::Solaris::ucontext_get_fp(ucontext_t *uc) {
intptr_t* os::Solaris::ucontext_get_fp(const ucontext_t *uc) {
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP];
}
address os::Solaris::ucontext_get_pc(ucontext_t *uc) {
address os::Solaris::ucontext_get_pc(const ucontext_t *uc) {
return (address) uc->uc_mcontext.gregs[REG_PC];
}
@ -200,21 +200,21 @@ address os::Solaris::ucontext_get_pc(ucontext_t *uc) {
// here we try to skip nested signal frames.
// This method is also used for stack overflow signal handling.
ExtendedPC os::Solaris::fetch_frame_from_ucontext(Thread* thread,
ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) {
assert(thread != NULL, "just checking");
assert(ret_sp != NULL, "just checking");
assert(ret_fp != NULL, "just checking");
ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc);
const ucontext_t *luc = os::Solaris::get_valid_uc_in_signal_handler(thread, uc);
return os::fetch_frame_from_context(luc, ret_sp, ret_fp);
}
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
ucontext_t *uc = (ucontext_t*)ucVoid;
const ucontext_t *uc = (const ucontext_t*)ucVoid;
if (uc != NULL) {
epc = os::Solaris::ucontext_get_ExtendedPC(uc);
@ -230,7 +230,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -774,10 +774,10 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
return false;
}
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Registers:");
#ifdef AMD64
st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]);
@ -833,10 +833,10 @@ void os::print_context(outputStream *st, void *context) {
print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
ucontext_t *uc = (ucontext_t*)context;
const ucontext_t *uc = (const ucontext_t*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -359,7 +359,7 @@ cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_boot
* while (...) {... fr = os::get_sender_for_C_frame(&fr); }
* loop in vmError.cpp. We need to roll our own loop.
*/
bool os::platform_print_native_stack(outputStream* st, void* context,
bool os::platform_print_native_stack(outputStream* st, const void* context,
char *buf, int buf_size)
{
CONTEXT ctx;
@ -435,7 +435,7 @@ bool os::platform_print_native_stack(outputStream* st, void* context,
}
#endif // AMD64
ExtendedPC os::fetch_frame_from_context(void* ucVoid,
ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
intptr_t** ret_sp, intptr_t** ret_fp) {
ExtendedPC epc;
@ -455,7 +455,7 @@ ExtendedPC os::fetch_frame_from_context(void* ucVoid,
return epc;
}
frame os::fetch_frame_from_context(void* ucVoid) {
frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* sp;
intptr_t* fp;
ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp);
@ -527,10 +527,10 @@ frame os::current_frame() {
}
}
void os::print_context(outputStream *st, void *context) {
void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
CONTEXT* uc = (CONTEXT*)context;
const CONTEXT* uc = (const CONTEXT*)context;
st->print_cr("Registers:");
#ifdef AMD64
@ -588,10 +588,10 @@ void os::print_context(outputStream *st, void *context) {
}
void os::print_register_info(outputStream *st, void *context) {
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
CONTEXT* uc = (CONTEXT*)context;
const CONTEXT* uc = (const CONTEXT*)context;
st->print_cr("Register to memory mapping:");
st->cr();

View File

@ -66,7 +66,7 @@
#ifdef AMD64
#define PLATFORM_PRINT_NATIVE_STACK 1
static bool platform_print_native_stack(outputStream* st, void* context,
static bool platform_print_native_stack(outputStream* st, const void* context,
char *buf, int buf_size);
#endif

View File

@ -471,8 +471,8 @@ class os: AllStatic {
static int pd_self_suspend_thread(Thread* thread);
static ExtendedPC fetch_frame_from_context(void* ucVoid, intptr_t** sp, intptr_t** fp);
static frame fetch_frame_from_context(void* ucVoid);
static ExtendedPC fetch_frame_from_context(const void* ucVoid, intptr_t** sp, intptr_t** fp);
static frame fetch_frame_from_context(const void* ucVoid);
static frame fetch_frame_from_ucontext(Thread* thread, void* ucVoid);
static ExtendedPC get_thread_pc(Thread *thread);
@ -499,7 +499,7 @@ class os: AllStatic {
// Terminate with an error. Default is to generate a core file on platforms
// that support such things. This calls shutdown() and then aborts.
static void abort(bool dump_core, void *siginfo, void *context);
static void abort(bool dump_core, void *siginfo, const void *context);
static void abort(bool dump_core = true);
// Die immediately, no exit hook, no abort hook, no cleanup.
@ -604,8 +604,8 @@ class os: AllStatic {
static void print_memory_info(outputStream* st);
static void print_dll_info(outputStream* st);
static void print_environment_variables(outputStream* st, const char** env_list);
static void print_context(outputStream* st, void* context);
static void print_register_info(outputStream* st, void* context);
static void print_context(outputStream* st, const void* context);
static void print_register_info(outputStream* st, const void* context);
static void print_siginfo(outputStream* st, void* siginfo);
static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
static void print_date_and_time(outputStream* st, char* buf, size_t buflen);
@ -848,7 +848,7 @@ class os: AllStatic {
public:
#ifndef PLATFORM_PRINT_NATIVE_STACK
// No platform-specific code for printing the native stack.
static bool platform_print_native_stack(outputStream* st, void* context,
static bool platform_print_native_stack(outputStream* st, const void* context,
char *buf, int buf_size) {
return false;
}