Mercurial > hg > truffle
diff src/share/vm/utilities/globalDefinitions.hpp @ 9060:cc32ccaaf47f
8003310: Enable -Wunused-function when compiling with gcc
Summary: Add the -Wunused-function flag and remove a number of unused functions.
Reviewed-by: dholmes, coleenp, kvn
author | mikael |
---|---|
date | Thu, 04 Apr 2013 10:01:26 -0700 |
parents | 203f64878aab |
children | 7a5aec879506 |
line wrap: on
line diff
--- a/src/share/vm/utilities/globalDefinitions.hpp Wed Apr 03 16:43:09 2013 -0700 +++ b/src/share/vm/utilities/globalDefinitions.hpp Thu Apr 04 10:01:26 2013 -0700 @@ -419,6 +419,24 @@ return align_size_up(offset, HeapWordsPerLong); } +// Clamp an address to be within a specific page +// 1. If addr is on the page it is returned as is +// 2. If addr is above the page_address the start of the *next* page will be returned +// 3. Otherwise, if addr is below the page_address the start of the page will be returned +inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) { + if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) { + // address is in the specified page, just return it as is + return addr; + } else if (addr > page_address) { + // address is above specified page, return start of next page + return (address)align_size_down(intptr_t(page_address), page_size) + page_size; + } else { + // address is below specified page, return start of page + return (address)align_size_down(intptr_t(page_address), page_size); + } +} + + // The expected size in bytes of a cache line, used to pad data structures. #define DEFAULT_CACHE_LINE_SIZE 64 @@ -1296,4 +1314,15 @@ return *(void**)addr; } + +#ifndef PRODUCT + +// For unit testing only +class GlobalDefinitions { +public: + static void test_globals(); +}; + +#endif // PRODUCT + #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP