Mercurial > hg > truffle
comparison src/os/bsd/vm/os_bsd.cpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | 917873d2983d |
children | f73af4455d7d ce8f6bb717c9 |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 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. |
121 | 121 |
122 // for timer info max values which include all bits | 122 // for timer info max values which include all bits |
123 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) | 123 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) |
124 | 124 |
125 #define LARGEPAGES_BIT (1 << 6) | 125 #define LARGEPAGES_BIT (1 << 6) |
126 | |
127 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
128 | |
126 //////////////////////////////////////////////////////////////////////////////// | 129 //////////////////////////////////////////////////////////////////////////////// |
127 // global variables | 130 // global variables |
128 julong os::Bsd::_physical_memory = 0; | 131 julong os::Bsd::_physical_memory = 0; |
129 | 132 |
130 #ifdef __APPLE__ | 133 #ifdef __APPLE__ |
2388 | 2391 |
2389 bool warn_on_failure = UseLargePages && | 2392 bool warn_on_failure = UseLargePages && |
2390 (!FLAG_IS_DEFAULT(UseLargePages) || | 2393 (!FLAG_IS_DEFAULT(UseLargePages) || |
2391 !FLAG_IS_DEFAULT(LargePageSizeInBytes) | 2394 !FLAG_IS_DEFAULT(LargePageSizeInBytes) |
2392 ); | 2395 ); |
2393 char msg[128]; | |
2394 | 2396 |
2395 // Create a large shared memory region to attach to based on size. | 2397 // Create a large shared memory region to attach to based on size. |
2396 // Currently, size is the total size of the heap | 2398 // Currently, size is the total size of the heap |
2397 int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W); | 2399 int shmid = shmget(key, bytes, IPC_CREAT|SHM_R|SHM_W); |
2398 if (shmid == -1) { | 2400 if (shmid == -1) { |
2409 // Note 2: it's possible there's enough physical memory available but | 2411 // Note 2: it's possible there's enough physical memory available but |
2410 // they are so fragmented after a long run that they can't | 2412 // they are so fragmented after a long run that they can't |
2411 // coalesce into large pages. Try to reserve large pages when | 2413 // coalesce into large pages. Try to reserve large pages when |
2412 // the system is still "fresh". | 2414 // the system is still "fresh". |
2413 if (warn_on_failure) { | 2415 if (warn_on_failure) { |
2414 jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); | 2416 warning("Failed to reserve shared memory (errno = %d).", errno); |
2415 warning(msg); | |
2416 } | 2417 } |
2417 return NULL; | 2418 return NULL; |
2418 } | 2419 } |
2419 | 2420 |
2420 // attach to the region | 2421 // attach to the region |
2427 // segment immediately. | 2428 // segment immediately. |
2428 shmctl(shmid, IPC_RMID, NULL); | 2429 shmctl(shmid, IPC_RMID, NULL); |
2429 | 2430 |
2430 if ((intptr_t)addr == -1) { | 2431 if ((intptr_t)addr == -1) { |
2431 if (warn_on_failure) { | 2432 if (warn_on_failure) { |
2432 jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); | 2433 warning("Failed to attach shared memory (errno = %d).", err); |
2433 warning(msg); | |
2434 } | 2434 } |
2435 return NULL; | 2435 return NULL; |
2436 } | 2436 } |
2437 | 2437 |
2438 // The memory is committed | 2438 // The memory is committed |
3927 | 3927 |
3928 bool os::check_heap(bool force) { | 3928 bool os::check_heap(bool force) { |
3929 return true; | 3929 return true; |
3930 } | 3930 } |
3931 | 3931 |
3932 ATTRIBUTE_PRINTF(3, 0) | |
3932 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { | 3933 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) { |
3933 return ::vsnprintf(buf, count, format, args); | 3934 return ::vsnprintf(buf, count, format, args); |
3934 } | 3935 } |
3935 | 3936 |
3936 // Is a (classpath) directory empty? | 3937 // Is a (classpath) directory empty? |