提交 cf94d9df 编写于 作者: D dcubed

8029775: Solaris code cleanup

Summary: cleaned up warnings in solaris specific os code.
Reviewed-by: coleenp, fparain, dcubed
Contributed-by: gerald.thornbrugh@oracle.com
上级 2e8b8e63
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -2232,8 +2232,8 @@ static bool check_addr0(outputStream* st) {
st->cr();
status = true;
}
::close(fd);
}
::close(fd);
}
return status;
}
......@@ -2257,13 +2257,18 @@ const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR",
"ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG",
"ILL_COPROC", "ILL_BADSTK" };
const size_t ill_names_length = (sizeof(ill_names)/sizeof(char *));
const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV",
"FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES",
"FPE_FLTINV", "FPE_FLTSUB" };
const size_t fpe_names_length = (sizeof(fpe_names)/sizeof(char *));
const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" };
const size_t segv_names_length = (sizeof(segv_names)/sizeof(char *));
const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" };
const size_t bus_names_length = (sizeof(bus_names)/sizeof(char *));
void os::print_siginfo(outputStream* st, void* siginfo) {
st->print("siginfo:");
......@@ -2282,19 +2287,23 @@ void os::print_siginfo(outputStream* st, void* siginfo) {
assert(c > 0, "unexpected si_code");
switch (si->si_signo) {
case SIGILL:
st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]);
st->print(", si_code=%d (%s)", c,
c >= ill_names_length ? "" : ill_names[c]);
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
case SIGFPE:
st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]);
st->print(", si_code=%d (%s)", c,
c >= fpe_names_length ? "" : fpe_names[c]);
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
case SIGSEGV:
st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]);
st->print(", si_code=%d (%s)", c,
c >= segv_names_length ? "" : segv_names[c]);
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
case SIGBUS:
st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]);
st->print(", si_code=%d (%s)", c,
c >= bus_names_length ? "" : bus_names[c]);
st->print(", si_addr=" PTR_FORMAT, si->si_addr);
break;
default:
......@@ -3011,7 +3020,7 @@ bool os::get_page_info(char *start, page_info* info) {
char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE };
const size_t types = sizeof(info_types) / sizeof(info_types[0]);
uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT];
uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1];
uint_t validity[MAX_MEMINFO_CNT];
size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size);
......@@ -3050,7 +3059,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info
}
}
if (i != addrs_count) {
if (i < addrs_count) {
if ((validity[i] & 2) != 0) {
page_found->lgrp_id = outdata[types * i];
} else {
......
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -431,10 +431,12 @@ static char* get_user_name(int vmid, TRAPS) {
RESTARTABLE(::read(fd, addr, remaining), result);
if (result == OS_ERR) {
::close(fd);
THROW_MSG_0(vmSymbols::java_io_IOException(), "Read error");
} else {
remaining-=result;
addr+=result;
}
remaining-=result;
addr+=result;
}
::close(fd);
......@@ -906,8 +908,16 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);
assert(fd != OS_ERR, "unexpected value");
fd = open_sharedmem_file(rfilename, file_flags, THREAD);
if (fd == OS_ERR) {
return;
}
if (HAS_PENDING_EXCEPTION) {
::close(fd);
return;
}
if (*sizep == 0) {
size = sharedmem_filesize(fd, CHECK);
......
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -475,9 +475,11 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
stub = StubRoutines::handler_for_unsafe_access();
if (cb != NULL) {
nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
stub = StubRoutines::handler_for_unsafe_access();
}
}
}
else
......@@ -724,6 +726,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
err.report_and_die();
ShouldNotReachHere();
return false;
}
void os::print_context(outputStream *st, void *context) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册