Mercurial > hg > truffle
comparison src/os/solaris/vm/os_solaris.cpp @ 14328:2c2a99f6cf83
8029775: Solaris code cleanup
8033464: Linux code cleanup
Summary: cleaned up warnings in solaris and linux specific os code.
Reviewed-by: coleenp, fparain, dcubed
Contributed-by: gerald.thornbrugh@oracle.com
author | coleenp |
---|---|
date | Thu, 06 Feb 2014 14:28:35 -0500 |
parents | b59507f713e0 |
children | 8a9bb7821e28 6c9332549827 |
comparison
equal
deleted
inserted
replaced
14324:c86519f8d826 | 14328:2c2a99f6cf83 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
2230 st->print("%s",(p.pr_mflags & MA_WRITE) ? "w" : "-"); | 2230 st->print("%s",(p.pr_mflags & MA_WRITE) ? "w" : "-"); |
2231 st->print("%s",(p.pr_mflags & MA_EXEC) ? "x" : "-"); | 2231 st->print("%s",(p.pr_mflags & MA_EXEC) ? "x" : "-"); |
2232 st->cr(); | 2232 st->cr(); |
2233 status = true; | 2233 status = true; |
2234 } | 2234 } |
2235 ::close(fd); | 2235 } |
2236 } | 2236 ::close(fd); |
2237 } | 2237 } |
2238 return status; | 2238 return status; |
2239 } | 2239 } |
2240 | 2240 |
2241 void os::pd_print_cpu_info(outputStream* st) { | 2241 void os::pd_print_cpu_info(outputStream* st) { |
2255 // but they're the same for all the solaris architectures that we support. | 2255 // but they're the same for all the solaris architectures that we support. |
2256 const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR", | 2256 const char *ill_names[] = { "ILL0", "ILL_ILLOPC", "ILL_ILLOPN", "ILL_ILLADR", |
2257 "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG", | 2257 "ILL_ILLTRP", "ILL_PRVOPC", "ILL_PRVREG", |
2258 "ILL_COPROC", "ILL_BADSTK" }; | 2258 "ILL_COPROC", "ILL_BADSTK" }; |
2259 | 2259 |
2260 const size_t ill_names_length = (sizeof(ill_names)/sizeof(char *)); | |
2261 | |
2260 const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV", | 2262 const char *fpe_names[] = { "FPE0", "FPE_INTDIV", "FPE_INTOVF", "FPE_FLTDIV", |
2261 "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES", | 2263 "FPE_FLTOVF", "FPE_FLTUND", "FPE_FLTRES", |
2262 "FPE_FLTINV", "FPE_FLTSUB" }; | 2264 "FPE_FLTINV", "FPE_FLTSUB" }; |
2265 const size_t fpe_names_length = (sizeof(fpe_names)/sizeof(char *)); | |
2263 | 2266 |
2264 const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" }; | 2267 const char *segv_names[] = { "SEGV0", "SEGV_MAPERR", "SEGV_ACCERR" }; |
2268 const size_t segv_names_length = (sizeof(segv_names)/sizeof(char *)); | |
2265 | 2269 |
2266 const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" }; | 2270 const char *bus_names[] = { "BUS0", "BUS_ADRALN", "BUS_ADRERR", "BUS_OBJERR" }; |
2271 const size_t bus_names_length = (sizeof(bus_names)/sizeof(char *)); | |
2267 | 2272 |
2268 void os::print_siginfo(outputStream* st, void* siginfo) { | 2273 void os::print_siginfo(outputStream* st, void* siginfo) { |
2269 st->print("siginfo:"); | 2274 st->print("siginfo:"); |
2270 | 2275 |
2271 const int buflen = 100; | 2276 const int buflen = 100; |
2280 } | 2285 } |
2281 const int c = si->si_code; | 2286 const int c = si->si_code; |
2282 assert(c > 0, "unexpected si_code"); | 2287 assert(c > 0, "unexpected si_code"); |
2283 switch (si->si_signo) { | 2288 switch (si->si_signo) { |
2284 case SIGILL: | 2289 case SIGILL: |
2285 st->print(", si_code=%d (%s)", c, c > 8 ? "" : ill_names[c]); | 2290 st->print(", si_code=%d (%s)", c, |
2291 c >= ill_names_length ? "" : ill_names[c]); | |
2286 st->print(", si_addr=" PTR_FORMAT, si->si_addr); | 2292 st->print(", si_addr=" PTR_FORMAT, si->si_addr); |
2287 break; | 2293 break; |
2288 case SIGFPE: | 2294 case SIGFPE: |
2289 st->print(", si_code=%d (%s)", c, c > 9 ? "" : fpe_names[c]); | 2295 st->print(", si_code=%d (%s)", c, |
2296 c >= fpe_names_length ? "" : fpe_names[c]); | |
2290 st->print(", si_addr=" PTR_FORMAT, si->si_addr); | 2297 st->print(", si_addr=" PTR_FORMAT, si->si_addr); |
2291 break; | 2298 break; |
2292 case SIGSEGV: | 2299 case SIGSEGV: |
2293 st->print(", si_code=%d (%s)", c, c > 2 ? "" : segv_names[c]); | 2300 st->print(", si_code=%d (%s)", c, |
2301 c >= segv_names_length ? "" : segv_names[c]); | |
2294 st->print(", si_addr=" PTR_FORMAT, si->si_addr); | 2302 st->print(", si_addr=" PTR_FORMAT, si->si_addr); |
2295 break; | 2303 break; |
2296 case SIGBUS: | 2304 case SIGBUS: |
2297 st->print(", si_code=%d (%s)", c, c > 3 ? "" : bus_names[c]); | 2305 st->print(", si_code=%d (%s)", c, |
2306 c >= bus_names_length ? "" : bus_names[c]); | |
2298 st->print(", si_addr=" PTR_FORMAT, si->si_addr); | 2307 st->print(", si_addr=" PTR_FORMAT, si->si_addr); |
2299 break; | 2308 break; |
2300 default: | 2309 default: |
2301 st->print(", si_code=%d", si->si_code); | 2310 st->print(", si_code=%d", si->si_code); |
2302 // no si_addr | 2311 // no si_addr |
3010 // Scan the pages from start to end until a page different than | 3019 // Scan the pages from start to end until a page different than |
3011 // the one described in the info parameter is encountered. | 3020 // the one described in the info parameter is encountered. |
3012 char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { | 3021 char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) { |
3013 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; | 3022 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; |
3014 const size_t types = sizeof(info_types) / sizeof(info_types[0]); | 3023 const size_t types = sizeof(info_types) / sizeof(info_types[0]); |
3015 uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT]; | 3024 uint64_t addrs[MAX_MEMINFO_CNT], outdata[types * MAX_MEMINFO_CNT + 1]; |
3016 uint_t validity[MAX_MEMINFO_CNT]; | 3025 uint_t validity[MAX_MEMINFO_CNT]; |
3017 | 3026 |
3018 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size); | 3027 size_t page_size = MAX2((size_t)os::vm_page_size(), page_expected->size); |
3019 uint64_t p = (uint64_t)start; | 3028 uint64_t p = (uint64_t)start; |
3020 while (p < (uint64_t)end) { | 3029 while (p < (uint64_t)end) { |
3049 } else { | 3058 } else { |
3050 return NULL; | 3059 return NULL; |
3051 } | 3060 } |
3052 } | 3061 } |
3053 | 3062 |
3054 if (i != addrs_count) { | 3063 if (i < addrs_count) { |
3055 if ((validity[i] & 2) != 0) { | 3064 if ((validity[i] & 2) != 0) { |
3056 page_found->lgrp_id = outdata[types * i]; | 3065 page_found->lgrp_id = outdata[types * i]; |
3057 } else { | 3066 } else { |
3058 page_found->lgrp_id = -1; | 3067 page_found->lgrp_id = -1; |
3059 } | 3068 } |