diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 57b8a37baf2..35455b7b4ad 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -3775,10 +3775,9 @@ static bool hugetlbfs_sanity_check(size_t page_size) { munmap(p, page_size); return true; } else { - log_info(pagesize)("Large page size (%zu%s) failed sanity check, " + log_info(pagesize)("Large page size (" EXACTFMT ") failed sanity check, " "checking if smaller large page sizes are usable", - byte_size_in_exact_unit(page_size), - exact_unit_for_byte_size(page_size)); + EXACTFMTARGS(page_size)); for (size_t page_size_ = page_sizes.next_smaller(page_size); page_size_ > os::vm_page_size(); page_size_ = page_sizes.next_smaller(page_size_)) { @@ -3787,9 +3786,8 @@ static bool hugetlbfs_sanity_check(size_t page_size) { if (p != MAP_FAILED) { // Mapping succeeded, sanity check passed. munmap(p, page_size_); - log_info(pagesize)("Large page size (%zu%s) passed sanity check", - byte_size_in_exact_unit(page_size_), - exact_unit_for_byte_size(page_size_)); + log_info(pagesize)("Large page size (" EXACTFMT ") passed sanity check", + EXACTFMTARGS(page_size_)); return true; } } @@ -3986,26 +3984,21 @@ void os::Linux::large_page_init() { LargePageSizeInBytes == 0 || LargePageSizeInBytes == default_large_page_size) { large_page_size = default_large_page_size; - log_info(pagesize)("Using the default large page size: %zu%s", - byte_size_in_exact_unit(large_page_size), - exact_unit_for_byte_size(large_page_size)); + log_info(pagesize)("Using the default large page size: " EXACTFMT, + EXACTFMTARGS(large_page_size)); } else { if (all_large_pages.contains(LargePageSizeInBytes)) { large_page_size = LargePageSizeInBytes; - log_info(pagesize)("Overriding default large page size (%zu%s) " - "using LargePageSizeInBytes: %zu%s", - byte_size_in_exact_unit(default_large_page_size), - exact_unit_for_byte_size(default_large_page_size), - byte_size_in_exact_unit(large_page_size), - exact_unit_for_byte_size(large_page_size)); + log_info(pagesize)("Overriding default large page size (" EXACTFMT ") " + "using LargePageSizeInBytes: " EXACTFMT, + EXACTFMTARGS(default_large_page_size), + EXACTFMTARGS(large_page_size)); } else { large_page_size = default_large_page_size; - log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (%zu%s) " - "using the default large page size: %zu%s", - byte_size_in_exact_unit(LargePageSizeInBytes), - exact_unit_for_byte_size(LargePageSizeInBytes), - byte_size_in_exact_unit(large_page_size), - exact_unit_for_byte_size(large_page_size)); + log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (" EXACTFMT ") " + "using the default large page size: " EXACTFMT, + EXACTFMTARGS(LargePageSizeInBytes), + EXACTFMTARGS(large_page_size)); } } @@ -4046,9 +4039,8 @@ static void log_on_commit_special_failure(char* req_addr, size_t bytes, assert(error == ENOMEM, "Only expect to fail if no memory is available"); log_info(pagesize)("Failed to reserve and commit memory with given page size. req_addr: " PTR_FORMAT - " size: %zu%s, page size: %zu%s, (errno = %d)", - p2i(req_addr), byte_size_in_exact_unit(bytes), exact_unit_for_byte_size(bytes), - byte_size_in_exact_unit(page_size), exact_unit_for_byte_size(page_size), error); + " size: " EXACTFMT ", page size: " EXACTFMT ", (errno = %d)", + p2i(req_addr), EXACTFMTARGS(bytes), EXACTFMTARGS(page_size), error); } static bool commit_memory_special(size_t bytes, @@ -4075,11 +4067,8 @@ static bool commit_memory_special(size_t bytes, return false; } - log_debug(pagesize)("Commit special mapping: " PTR_FORMAT ", size=%zu%s, page size=%zu%s", - p2i(addr), byte_size_in_exact_unit(bytes), - exact_unit_for_byte_size(bytes), - byte_size_in_exact_unit(page_size), - exact_unit_for_byte_size(page_size)); + log_debug(pagesize)("Commit special mapping: " PTR_FORMAT ", size=" EXACTFMT ", page size=" EXACTFMT, + p2i(addr), EXACTFMTARGS(bytes), EXACTFMTARGS(page_size)); assert(is_aligned(addr, page_size), "Must be"); return true; } diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 7ad9f80141c..06fe8a826cd 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3409,8 +3409,8 @@ static char* find_aligned_address(size_t size, size_t alignment) { } static char* reserve_large_pages_aligned(size_t size, size_t alignment, bool exec) { - log_debug(pagesize)("Reserving large pages at an aligned address, alignment=%zu%s", - byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); + log_debug(pagesize)("Reserving large pages at an aligned address, alignment=" EXACTFMT, + EXACTFMTARGS(alignment)); // Will try to find a suitable address at most 20 times. The reason we need to try // multiple times is that between finding the aligned address and trying to commit diff --git a/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp b/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp index fec5110fba3..7869de1cd79 100644 --- a/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonInitLogger.cpp @@ -33,8 +33,7 @@ void EpsilonInitLogger::print_gc_specific() { if (UseTLAB) { size_t max_tlab = EpsilonHeap::heap()->max_tlab_size() * HeapWordSize; - log_info(gc, init)("TLAB Size Max: %zu%s", - byte_size_in_exact_unit(max_tlab), exact_unit_for_byte_size(max_tlab)); + log_info(gc, init)("TLAB Size Max: " EXACTFMT, EXACTFMTARGS(max_tlab)); if (EpsilonElasticTLAB) { log_info(gc, init)("TLAB Size Elasticity: %.2fx", EpsilonTLABElasticity); } diff --git a/src/hotspot/share/gc/parallel/parallelInitLogger.cpp b/src/hotspot/share/gc/parallel/parallelInitLogger.cpp index b6d1034f60a..b28f0385c51 100644 --- a/src/hotspot/share/gc/parallel/parallelInitLogger.cpp +++ b/src/hotspot/share/gc/parallel/parallelInitLogger.cpp @@ -28,12 +28,12 @@ void ParallelInitLogger::print_heap() { log_info_p(gc, init)("Alignments:" - " Space %zu%s," - " Generation %zu%s," - " Heap %zu%s", - byte_size_in_exact_unit(SpaceAlignment), exact_unit_for_byte_size(SpaceAlignment), - byte_size_in_exact_unit(GenAlignment), exact_unit_for_byte_size(GenAlignment), - byte_size_in_exact_unit(HeapAlignment), exact_unit_for_byte_size(HeapAlignment)); + " Space " EXACTFMT "," + " Generation " EXACTFMT "," + " Heap " EXACTFMT, + EXACTFMTARGS(SpaceAlignment), + EXACTFMTARGS(GenAlignment), + EXACTFMTARGS(HeapAlignment)); GCInitLogger::print_heap(); } diff --git a/src/hotspot/share/gc/shared/gcInitLogger.cpp b/src/hotspot/share/gc/shared/gcInitLogger.cpp index 0a327ea7dfe..f2d9fffdc11 100644 --- a/src/hotspot/share/gc/shared/gcInitLogger.cpp +++ b/src/hotspot/share/gc/shared/gcInitLogger.cpp @@ -90,12 +90,9 @@ void GCInitLogger::print_compressed_oops() { } void GCInitLogger::print_heap() { - log_info_p(gc, init)("Heap Min Capacity: %zu%s", - byte_size_in_exact_unit(MinHeapSize), exact_unit_for_byte_size(MinHeapSize)); - log_info_p(gc, init)("Heap Initial Capacity: %zu%s", - byte_size_in_exact_unit(InitialHeapSize), exact_unit_for_byte_size(InitialHeapSize)); - log_info_p(gc, init)("Heap Max Capacity: %zu%s", - byte_size_in_exact_unit(MaxHeapSize), exact_unit_for_byte_size(MaxHeapSize)); + log_info_p(gc, init)("Heap Min Capacity: " EXACTFMT, EXACTFMTARGS(MinHeapSize)); + log_info_p(gc, init)("Heap Initial Capacity: " EXACTFMT, EXACTFMTARGS(InitialHeapSize)); + log_info_p(gc, init)("Heap Max Capacity: " EXACTFMT, EXACTFMTARGS(MaxHeapSize)); log_info_p(gc, init)("Pre-touch: %s", AlwaysPreTouch ? "Enabled" : "Disabled"); } diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index c43090f9699..29111062529 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -362,10 +362,7 @@ void ZCollectedHeap::print_on_error(outputStream* st) const { st->print_cr("ZGC Globals:"); st->print_cr(" Young Collection: %s/%u", ZGeneration::young()->phase_to_string(), ZGeneration::young()->seqnum()); st->print_cr(" Old Collection: %s/%u", ZGeneration::old()->phase_to_string(), ZGeneration::old()->seqnum()); - st->print_cr(" Offset Max: %zu%s (" PTR_FORMAT ")", - byte_size_in_exact_unit(ZAddressOffsetMax), - exact_unit_for_byte_size(ZAddressOffsetMax), - ZAddressOffsetMax); + st->print_cr(" Offset Max: " EXACTFMT " (" PTR_FORMAT ")", EXACTFMTARGS(ZAddressOffsetMax), ZAddressOffsetMax); st->print_cr(" Page Size Small: %zuM", ZPageSizeSmall / M); st->print_cr(" Page Size Medium: %zuM", ZPageSizeMedium / M); st->cr(); diff --git a/src/hotspot/share/memory/memoryReserver.cpp b/src/hotspot/share/memory/memoryReserver.cpp index dad88ae97e5..43cc71355ff 100644 --- a/src/hotspot/share/memory/memoryReserver.cpp +++ b/src/hotspot/share/memory/memoryReserver.cpp @@ -130,9 +130,9 @@ ReservedSpace MemoryReserver::reserve_memory_special(char* requested_address, size_t alignment, size_t page_size, bool exec) { - log_trace(pagesize)("Attempt special mapping: size: %zu%s, alignment: %zu%s", - byte_size_in_exact_unit(size), exact_unit_for_byte_size(size), - byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); + log_trace(pagesize)("Attempt special mapping: size: " EXACTFMT ", alignment: " EXACTFMT, + EXACTFMTARGS(size), + EXACTFMTARGS(alignment)); char* base = os::reserve_memory_special(size, alignment, page_size, requested_address, exec); diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index be9b0eef455..4eb0621ff8a 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1810,8 +1810,6 @@ int os::create_binary_file(const char* path, bool rewrite_existing) { return ::open(path, oflags, S_IREAD | S_IWRITE); } -#define trace_page_size_params(size) byte_size_in_exact_unit(size), exact_unit_for_byte_size(size) - void os::trace_page_sizes(const char* str, const size_t region_min_size, const size_t region_max_size, @@ -1820,17 +1818,17 @@ void os::trace_page_sizes(const char* str, const size_t page_size) { log_info(pagesize)("%s: " - " min=%zu%s" - " max=%zu%s" + " min=" EXACTFMT + " max=" EXACTFMT " base=" PTR_FORMAT - " size=%zu%s" - " page_size=%zu%s", + " size=" EXACTFMT + " page_size=" EXACTFMT, str, - trace_page_size_params(region_min_size), - trace_page_size_params(region_max_size), + EXACTFMTARGS(region_min_size), + EXACTFMTARGS(region_max_size), p2i(base), - trace_page_size_params(size), - trace_page_size_params(page_size)); + EXACTFMTARGS(size), + EXACTFMTARGS(page_size)); } void os::trace_page_sizes_for_requested_size(const char* str, @@ -1841,17 +1839,17 @@ void os::trace_page_sizes_for_requested_size(const char* str, const size_t page_size) { log_info(pagesize)("%s:" - " req_size=%zu%s" - " req_page_size=%zu%s" + " req_size=" EXACTFMT + " req_page_size=" EXACTFMT " base=" PTR_FORMAT - " size=%zu%s" - " page_size=%zu%s", + " size=" EXACTFMT + " page_size=" EXACTFMT, str, - trace_page_size_params(requested_size), - trace_page_size_params(requested_page_size), + EXACTFMTARGS(requested_size), + EXACTFMTARGS(requested_page_size), p2i(base), - trace_page_size_params(size), - trace_page_size_params(page_size)); + EXACTFMTARGS(size), + EXACTFMTARGS(page_size)); }