mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8029775: Solaris code cleanup
8033464: Linux code cleanup Cleaned up warnings in solaris and linux specific os code. Reviewed-by: coleenp, fparain, dcubed
This commit is contained in:
parent
aae536aad7
commit
d3a85e73a7
5 changed files with 54 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -3000,7 +3000,9 @@ address get_stack_commited_bottom(address bottom, size_t size) {
|
|||
|
||||
unsigned char vec[1];
|
||||
unsigned imin = 1, imax = pages + 1, imid;
|
||||
int mincore_return_value;
|
||||
int mincore_return_value = 0;
|
||||
|
||||
assert(imin < imax, "Unexpected page size");
|
||||
|
||||
while (imin < imax) {
|
||||
imid = (imax + imin) / 2;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -891,8 +891,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);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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:
|
||||
|
@ -3012,7 +3021,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);
|
||||
|
@ -3051,7 +3060,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 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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,11 +431,13 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
::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);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 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,11 +475,13 @@ 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);
|
||||
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
|
||||
if (sig == SIGFPE && info->si_code == FPE_INTDIV) {
|
||||
// integer divide by zero
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue