diff --git a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp index c656736aa64..2a661ab9cbb 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/z/zAddress_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -85,7 +85,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/arm/arm.ad b/src/hotspot/cpu/arm/arm.ad index a3db5c0619c..617745dee20 100644 --- a/src/hotspot/cpu/arm/arm.ad +++ b/src/hotspot/cpu/arm/arm.ad @@ -1,5 +1,5 @@ // -// Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2008, 2025, 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 @@ -283,7 +283,7 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { } st->print_cr("PUSH R_FP|R_LR_LR"); st->print("\t"); if (framesize != 0) { - st->print ("SUB R_SP, R_SP, " SIZE_FORMAT,framesize); + st->print ("SUB R_SP, R_SP, %zu", framesize); } if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) { @@ -362,7 +362,7 @@ void MachEpilogNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { framesize -= 2*wordSize; if (framesize != 0) { - st->print("ADD R_SP, R_SP, " SIZE_FORMAT "\n\t",framesize); + st->print("ADD R_SP, R_SP, %zu\n\t",framesize); } st->print("POP R_FP|R_LR_LR"); diff --git a/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp b/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp index 5891d50f715..e495606d399 100644 --- a/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -82,7 +82,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp index 715f0d8aff7..9e91ea0ce2b 100644 --- a/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/z/zAddress_riscv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Huawei Technologies Co., Ltd. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -84,7 +84,7 @@ static size_t probe_valid_max_address_bit() { munmap(result_addr, page_size); } } - log_info_p(gc, init)("Probing address space for the highest valid bit: " SIZE_FORMAT, max_address_bit); + log_info_p(gc, init)("Probing address space for the highest valid bit: %zu", max_address_bit); return MAX2(max_address_bit, MINIMUM_MAX_ADDRESS_BIT); #else // LINUX return DEFAULT_MAX_ADDRESS_BIT; diff --git a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp index d81562d9e9a..72724fb66d1 100644 --- a/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp +++ b/src/hotspot/cpu/s390/macroAssembler_s390.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -75,7 +75,7 @@ inline void MacroAssembler::load_address(Register d, const Address &a) { } else if (Displacement::is_validDisp(a.disp())) { z_lay(d, a.disp(), a.indexOrR0(), a.baseOrR0()); } else { - guarantee(false, "displacement = " SIZE_FORMAT_X ", out of range for LA/LAY", a.disp()); + guarantee(false, "displacement = 0x%zx, out of range for LA/LAY", a.disp()); } } diff --git a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp index e0be0639594..d0816aee74f 100644 --- a/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp +++ b/src/hotspot/cpu/x86/gc/z/zAddress_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -32,7 +32,7 @@ inline uintptr_t ZPointer::remap_bits(uintptr_t colored) { inline constexpr int ZPointer::load_shift_lookup(uintptr_t value) { const size_t index = load_shift_lookup_index(value); - assert(index == 0 || is_power_of_2(index), "Incorrect load shift: " SIZE_FORMAT, index); + assert(index == 0 || is_power_of_2(index), "Incorrect load shift: %zu", index); return ZPointerLoadShiftTable[index]; } diff --git a/src/hotspot/os/aix/loadlib_aix.cpp b/src/hotspot/os/aix/loadlib_aix.cpp index bc21aef3836..2c38e1b637c 100644 --- a/src/hotspot/os/aix/loadlib_aix.cpp +++ b/src/hotspot/os/aix/loadlib_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * Copyright (c) 2022, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -203,7 +203,7 @@ static bool reload_table() { } } - trcVerbose("loadquery buffer size is " SIZE_FORMAT ".", buflen); + trcVerbose("loadquery buffer size is %zu.", buflen); // Iterate over the loadquery result. For details see sys/ldr.h on AIX. ldi = (struct ld_info*) buffer; @@ -262,7 +262,7 @@ static bool reload_table() { lm->is_in_vm = true; } - trcVerbose("entry: %p " SIZE_FORMAT ", %p " SIZE_FORMAT ", %s %s %s, %d", + trcVerbose("entry: %p %zu, %p %zu, %s %s %s, %d", lm->text, lm->text_len, lm->data, lm->data_len, lm->path, lm->shortname, diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 555c09cda49..ec1bf83ffcd 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -450,7 +450,7 @@ static void query_multipage_support() { if (p != (void*) -1) { const size_t real_pagesize = os::Aix::query_pagesize(p); if (real_pagesize != pagesize) { - log_warning(pagesize)("real page size (" SIZE_FORMAT_X ") differs.", real_pagesize); + log_warning(pagesize)("real page size (0x%zx) differs.", real_pagesize); } else { can_use = true; } @@ -632,7 +632,7 @@ static void *thread_native_entry(Thread *thread) { address low_address = thread->stack_end(); address high_address = thread->stack_base(); lt.print("Thread is alive (tid: %zu, kernel thread id: %zu" - ", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %luk pages)).", + ", stack [" PTR_FORMAT " - " PTR_FORMAT " (%zuk using %luk pages)).", os::current_thread_id(), (uintx) kernel_thread_id, p2i(low_address), p2i(high_address), (high_address - low_address) / K, os::Aix::query_pagesize(low_address) / K); } @@ -733,7 +733,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, // guard pages might not fit on the tiny stack created. int ret = pthread_attr_setstacksize(&attr, stack_size); if (ret != 0) { - log_warning(os, thread)("The %sthread stack size specified is invalid: " SIZE_FORMAT "k", + log_warning(os, thread)("The %sthread stack size specified is invalid: %zuk", (thr_type == compiler_thread) ? "compiler " : ((thr_type == java_thread) ? "" : "VM "), stack_size / K); thread->set_osthread(nullptr); @@ -769,7 +769,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, thread->name(), ret, os::errno_name(ret), os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); // Log some OS information which might explain why creating the thread failed. log_warning(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads()); - log_warning(os, thread)("Checking JVM parameter MaxExpectedDataSegmentSize (currently " SIZE_FORMAT "k) might be helpful", MaxExpectedDataSegmentSize/K); + log_warning(os, thread)("Checking JVM parameter MaxExpectedDataSegmentSize (currently %zuk) might be helpful", MaxExpectedDataSegmentSize/K); LogStream st(Log(os, thread)::info()); os::Posix::print_rlimit_info(&st); os::print_memory_info(&st); @@ -840,7 +840,7 @@ bool os::create_attached_thread(JavaThread* thread) { PosixSignals::hotspot_sigmask(thread); log_info(os, thread)("Thread attached (tid: %zu, kernel thread id: %zu" - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) kernel_thread_id, p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1194,10 +1194,10 @@ void os::print_memory_info(outputStream* st) { os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { - st->print_cr("physical total : " SIZE_FORMAT, mi.real_total); - st->print_cr("physical free : " SIZE_FORMAT, mi.real_free); - st->print_cr("swap total : " SIZE_FORMAT, mi.pgsp_total); - st->print_cr("swap free : " SIZE_FORMAT, mi.pgsp_free); + st->print_cr("physical total : %zu", mi.real_total); + st->print_cr("physical free : %zu", mi.real_free); + st->print_cr("swap total : %zu", mi.pgsp_total); + st->print_cr("swap free : %zu", mi.pgsp_free); } st->cr(); @@ -1205,10 +1205,10 @@ void os::print_memory_info(outputStream* st) { st->print_cr("Program break at VM startup: " PTR_FORMAT ".", p2i(g_brk_at_startup)); address brk_now = (address)::sbrk(0); if (brk_now != (address)-1) { - st->print_cr("Program break now : " PTR_FORMAT " (distance: " SIZE_FORMAT "k).", + st->print_cr("Program break now : " PTR_FORMAT " (distance: %zuk).", p2i(brk_now), (size_t)((brk_now - g_brk_at_startup) / K)); } - st->print_cr("MaxExpectedDataSegmentSize : " SIZE_FORMAT "k.", MaxExpectedDataSegmentSize / K); + st->print_cr("MaxExpectedDataSegmentSize : %zuk.", MaxExpectedDataSegmentSize / K); st->cr(); // Print segments allocated with os::reserve_memory. @@ -1533,7 +1533,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { // work (see above), the system may have given us something other then 4K (LDR_CNTRL). const size_t real_pagesize = os::Aix::query_pagesize(addr); if (real_pagesize != (size_t)shmbuf.shm_pagesize) { - log_trace(os, map)("pagesize is, surprisingly, " SIZE_FORMAT, + log_trace(os, map)("pagesize is, surprisingly, %zu", real_pagesize); } @@ -1759,9 +1759,8 @@ static bool uncommit_mmaped_memory(char* addr, size_t size) { #ifdef PRODUCT static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec, - os::errno_name(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, exec, os::errno_name(err), err); } #endif @@ -1778,10 +1777,10 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool exec, bool os::pd_commit_memory(char* addr, size_t size, bool exec) { assert(is_aligned_to(addr, os::vm_page_size()), - "addr " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "addr " PTR_FORMAT " not aligned to vm_page_size (%zu)", p2i(addr), os::vm_page_size()); assert(is_aligned_to(size, os::vm_page_size()), - "size " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "size " PTR_FORMAT " not aligned to vm_page_size (%zu)", size, os::vm_page_size()); vmembk_t* const vmi = vmembk_find(addr); @@ -1813,10 +1812,10 @@ void os::pd_commit_memory_or_exit(char* addr, size_t size, bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) { assert(is_aligned_to(addr, os::vm_page_size()), - "addr " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "addr " PTR_FORMAT " not aligned to vm_page_size (%zu)", p2i(addr), os::vm_page_size()); assert(is_aligned_to(size, os::vm_page_size()), - "size " PTR_FORMAT " not aligned to vm_page_size (" SIZE_FORMAT ")", + "size " PTR_FORMAT " not aligned to vm_page_size (%zu)", size, os::vm_page_size()); // Dynamically do different things for mmap/shmat. diff --git a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp index 16835c83039..e2b142461ea 100644 --- a/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp +++ b/src/hotspot/os/bsd/gc/z/zPhysicalMemoryBacking_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -102,7 +102,7 @@ bool ZPhysicalMemoryBacking::commit_inner(zoffset offset, size_t length) const { assert(is_aligned(untype(offset), os::vm_page_size()), "Invalid offset"); assert(is_aligned(length, os::vm_page_size()), "Invalid length"); - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const uintptr_t addr = _base + untype(offset); @@ -149,7 +149,7 @@ size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) const { assert(is_aligned(untype(offset), os::vm_page_size()), "Invalid offset"); assert(is_aligned(length, os::vm_page_size()), "Invalid length"); - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const uintptr_t start = _base + untype(offset); diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index c724bef8b99..9818cdf7bab 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -745,7 +745,7 @@ bool os::create_attached_thread(JavaThread* thread) { PosixSignals::hotspot_sigmask(thread); log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); return true; @@ -1459,7 +1459,7 @@ void os::print_memory_info(outputStream* st) { size_t size = sizeof(swap_usage); st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); st->print(", physical " UINT64_FORMAT "k", os::physical_memory() >> 10); @@ -1586,7 +1586,7 @@ void os::jvm_path(char *buf, jint buflen) { static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" INTPTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::commit_memory(" INTPTR_FORMAT ", %zu" ", %d) failed; error='%s' (errno=%d)", (intptr_t)addr, size, exec, os::errno_name(err), err); } diff --git a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp index b648876ac60..be680f8430b 100644 --- a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -185,13 +185,13 @@ ZPhysicalMemoryBacking::ZPhysicalMemoryBacking(size_t max_capacity) // Make sure the filesystem block size is compatible if (ZGranuleSize % _block_size != 0) { - ZInitialize::error("Filesystem backing the heap has incompatible block size (" SIZE_FORMAT ")", + ZInitialize::error("Filesystem backing the heap has incompatible block size (%zu)", _block_size); return; } if (is_hugetlbfs() && _block_size != ZGranuleSize) { - ZInitialize::error("%s filesystem has unexpected block size " SIZE_FORMAT " (expected " SIZE_FORMAT ")", + ZInitialize::error("%s filesystem has unexpected block size %zu (expected %zu)", ZFILESYSTEM_HUGETLBFS, _block_size, ZGranuleSize); return; } @@ -316,7 +316,7 @@ void ZPhysicalMemoryBacking::warn_available_space(size_t max_capacity) const { return; } - log_info_p(gc, init)("Available space on backing filesystem: " SIZE_FORMAT "M", _available / M); + log_info_p(gc, init)("Available space on backing filesystem: %zuM", _available / M); // Warn if the filesystem doesn't currently have enough space available to hold // the max heap size. The max heap size will be capped if we later hit this limit @@ -324,9 +324,9 @@ void ZPhysicalMemoryBacking::warn_available_space(size_t max_capacity) const { if (_available < max_capacity) { log_warning_p(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); log_warning_p(gc)("Not enough space available on the backing filesystem to hold the current max Java heap"); - log_warning_p(gc)("size (" SIZE_FORMAT "M). Please adjust the size of the backing filesystem accordingly " + log_warning_p(gc)("size (%zuM). Please adjust the size of the backing filesystem accordingly " "(available", max_capacity / M); - log_warning_p(gc)("space is currently " SIZE_FORMAT "M). Continuing execution with the current filesystem " + log_warning_p(gc)("space is currently %zuM). Continuing execution with the current filesystem " "size could", _available / M); log_warning_p(gc)("lead to a premature OutOfMemoryError being thrown, due to failure to commit memory."); } @@ -342,7 +342,7 @@ void ZPhysicalMemoryBacking::warn_max_map_count(size_t max_capacity) const { } size_t actual_max_map_count = 0; - const int result = fscanf(file, SIZE_FORMAT, &actual_max_map_count); + const int result = fscanf(file, "%zu", &actual_max_map_count); fclose(file); if (result != 1) { // Failed to read file, skip check @@ -359,9 +359,9 @@ void ZPhysicalMemoryBacking::warn_max_map_count(size_t max_capacity) const { if (actual_max_map_count < required_max_map_count) { log_warning_p(gc)("***** WARNING! INCORRECT SYSTEM CONFIGURATION DETECTED! *****"); log_warning_p(gc)("The system limit on number of memory mappings per process might be too low for the given"); - log_warning_p(gc)("max Java heap size (" SIZE_FORMAT "M). Please adjust %s to allow for at", + log_warning_p(gc)("max Java heap size (%zuM). Please adjust %s to allow for at", max_capacity / M, filename); - log_warning_p(gc)("least " SIZE_FORMAT " mappings (current limit is " SIZE_FORMAT "). Continuing execution " + log_warning_p(gc)("least %zu mappings (current limit is %zu). Continuing execution " "with the current", required_max_map_count, actual_max_map_count); log_warning_p(gc)("limit could lead to a premature OutOfMemoryError being thrown, due to failure to map memory."); } @@ -598,7 +598,7 @@ ZErrno ZPhysicalMemoryBacking::fallocate(bool punch_hole, zoffset offset, size_t } bool ZPhysicalMemoryBacking::commit_inner(zoffset offset, size_t length) const { - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); retry: @@ -698,7 +698,7 @@ size_t ZPhysicalMemoryBacking::commit(zoffset offset, size_t length) const { } size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) const { - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); const ZErrno err = fallocate(true /* punch_hole */, offset, length); diff --git a/src/hotspot/os/linux/hugepages.cpp b/src/hotspot/os/linux/hugepages.cpp index c04ff7a4ca0..58c28e49683 100644 --- a/src/hotspot/os/linux/hugepages.cpp +++ b/src/hotspot/os/linux/hugepages.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2024, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -95,7 +95,7 @@ static bool read_number_file(const char* file, size_t* out) { bool rc = false; if (f != nullptr) { uint64_t i = 0; - if (::fscanf(f, SIZE_FORMAT, out) == 1) { + if (::fscanf(f, "%zu", out) == 1) { rc = true; } ::fclose(f); @@ -155,7 +155,7 @@ void ExplicitHugePageSupport::scan_os() { // that only exposes /proc/meminfo but not /sys/kernel/mm/hugepages. In that case, we are not // sure about the state of hugepage support by the kernel, so we won't use explicit hugepages. if (!_pagesizes.contains(_default_hugepage_size)) { - log_info(pagesize)("Unexpected configuration: default pagesize (" SIZE_FORMAT ") " + log_info(pagesize)("Unexpected configuration: default pagesize (%zu) " "has no associated directory in /sys/kernel/mm/hugepages..", _default_hugepage_size); _inconsistent = true; } diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 67c29913c86..1d01549fae5 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -925,7 +925,7 @@ static size_t get_static_tls_area_size(const pthread_attr_t *attr) { } } - log_info(os, thread)("Stack size adjustment for TLS is " SIZE_FORMAT, + log_info(os, thread)("Stack size adjustment for TLS is %zu", tls_size); return tls_size; } @@ -1032,7 +1032,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, // pthread_attr_setstacksize() function can fail // if the stack size exceeds a system-imposed limit. assert_status(status == EINVAL, status, "pthread_attr_setstacksize"); - log_warning(os, thread)("The %sthread stack size specified is invalid: " SIZE_FORMAT "k", + log_warning(os, thread)("The %sthread stack size specified is invalid: %zuk", (thr_type == compiler_thread) ? "compiler " : ((thr_type == java_thread) ? "" : "VM "), stack_size / K); thread->set_osthread(nullptr); @@ -1171,7 +1171,7 @@ bool os::create_attached_thread(JavaThread* thread) { PosixSignals::hotspot_sigmask(thread); log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" - ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + ", stack: " PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1457,8 +1457,8 @@ void os::Linux::capture_initial_stack(size_t max_size) { bool primordial = uintptr_t(&rlim) > uintptr_t(_initial_thread_stack_bottom) && uintptr_t(&rlim) < stack_top; - log_info(os, thread)("Capturing initial stack in %s thread: req. size: " SIZE_FORMAT "K, actual size: " - SIZE_FORMAT "K, top=" INTPTR_FORMAT ", bottom=" INTPTR_FORMAT, + log_info(os, thread)("Capturing initial stack in %s thread: req. size: %zuK, actual size: " + "%zuK, top=" INTPTR_FORMAT ", bottom=" INTPTR_FORMAT, primordial ? "primordial" : "user", max_size / K, _initial_thread_stack_size / K, stack_top, intptr_t(_initial_thread_stack_bottom)); } @@ -2390,7 +2390,7 @@ void os::Linux::print_process_memory_info(outputStream* st) { // If legacy mallinfo(), we can still print the values if we are sure they cannot have wrapped. might_have_wrapped = might_have_wrapped && (info.vmsize * K) > UINT_MAX; #endif - st->print_cr("C-Heap outstanding allocations: " SIZE_FORMAT "K, retained: " SIZE_FORMAT "K%s", + st->print_cr("C-Heap outstanding allocations: %zuK, retained: %zuK%s", total_allocated / K, free_retained / K, might_have_wrapped ? " (may have wrapped)" : ""); // Tunables @@ -2518,7 +2518,7 @@ void os::Linux::print_steal_info(outputStream* st) { void os::print_memory_info(outputStream* st) { st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); // values in struct sysinfo are "unsigned long" struct sysinfo si; @@ -2883,17 +2883,15 @@ static bool recoverable_mmap_error(int err) { static void warn_fail_commit_memory(char* addr, size_t size, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, exec, - os::strerror(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, exec, os::strerror(err), err); } static void warn_fail_commit_memory(char* addr, size_t size, size_t alignment_hint, bool exec, int err) { - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT - ", " SIZE_FORMAT ", %d) failed; error='%s' (errno=%d)", p2i(addr), size, - alignment_hint, exec, os::strerror(err), err); + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu, %zu, %d) failed; error='%s' (errno=%d)", + p2i(addr), size, alignment_hint, exec, os::strerror(err), err); } // NOTE: Linux kernel does not really reserve the pages for us. @@ -3043,7 +3041,7 @@ size_t os::pd_pretouch_memory(void* first, void* last, size_t page_size) { // OS will initially always use small pages. return os::vm_page_size(); } else if (err != 0) { - log_info(gc, os)("::madvise(" PTR_FORMAT ", " SIZE_FORMAT ", %d) failed; " + log_info(gc, os)("::madvise(" PTR_FORMAT ", %zu, %d) failed; " "error='%s' (errno=%d)", p2i(first), len, MADV_POPULATE_WRITE, os::strerror(err), err); } @@ -3760,7 +3758,7 @@ static bool hugetlbfs_sanity_check(size_t page_size) { munmap(p, page_size); return true; } else { - log_info(pagesize)("Large page size (" SIZE_FORMAT "%s) failed sanity check, " + log_info(pagesize)("Large page size (%zu%s) 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)); @@ -3772,7 +3770,7 @@ 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 (" SIZE_FORMAT "%s) passed sanity check", + 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_)); return true; @@ -3971,22 +3969,22 @@ 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: " SIZE_FORMAT "%s", + 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)); } else { if (all_large_pages.contains(LargePageSizeInBytes)) { large_page_size = LargePageSizeInBytes; - log_info(pagesize)("Overriding default large page size (" SIZE_FORMAT "%s) " - "using LargePageSizeInBytes: " SIZE_FORMAT "%s", + 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)); } else { large_page_size = default_large_page_size; - log_info(pagesize)("LargePageSizeInBytes is not a valid large page size (" SIZE_FORMAT "%s) " - "using the default large page size: " SIZE_FORMAT "%s", + 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), @@ -4031,7 +4029,7 @@ 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: " SIZE_FORMAT "%s, page size: " SIZE_FORMAT "%s, (errno = %d)", + " 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); } @@ -4060,8 +4058,7 @@ static bool commit_memory_special(size_t bytes, return false; } - log_debug(pagesize)("Commit special mapping: " PTR_FORMAT ", size=" SIZE_FORMAT "%s, page size=" - SIZE_FORMAT "%s", + 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), diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 61214a42969..6f756fbf648 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -972,7 +972,7 @@ char* os::Posix::describe_pthread_attr(char* buf, size_t buflen, const pthread_a // Work around glibc stack guard issue, see os::create_thread() in os_linux.cpp. LINUX_ONLY(if (os::Linux::adjustStackSizeForGuardPages()) stack_size -= guard_size;) pthread_attr_getdetachstate(attr, &detachstate); - jio_snprintf(buf, buflen, "stacksize: " SIZE_FORMAT "k, guardsize: " SIZE_FORMAT "k, %s", + jio_snprintf(buf, buflen, "stacksize: %zuk, guardsize: %zuk, %s", stack_size / K, guard_size / K, (detachstate == PTHREAD_CREATE_DETACHED ? "detached" : "joinable")); return buf; diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 5fbd5e76c5a..fdeb0b990d6 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1095,7 +1095,7 @@ static void unmap_shared(char* addr, size_t bytes) { res = ::munmap(addr, bytes); } if (res != 0) { - log_info(os)("os::release_memory failed (" PTR_FORMAT ", " SIZE_FORMAT ")", p2i(addr), bytes); + log_info(os)("os::release_memory failed (" PTR_FORMAT ", %zu)", p2i(addr), bytes); } } @@ -1227,7 +1227,7 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) { *addr = mapAddress; *sizep = size; - log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at " + log_debug(perf, memops)("mapped %zu bytes for vmid %d at " INTPTR_FORMAT, size, vmid, p2i((void*)mapAddress)); } diff --git a/src/hotspot/os/windows/gc/z/zMapper_windows.cpp b/src/hotspot/os/windows/gc/z/zMapper_windows.cpp index b2923a300e4..c716368a795 100644 --- a/src/hotspot/os/windows/gc/z/zMapper_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zMapper_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -57,7 +57,7 @@ // they will be split before being used. #define fatal_error(msg, addr, size) \ - fatal(msg ": " PTR_FORMAT " " SIZE_FORMAT "M (%d)", \ + fatal(msg ": " PTR_FORMAT " %zuM (%d)", \ (addr), (size) / M, GetLastError()) zaddress_unsafe ZMapper::reserve(zaddress_unsafe addr, size_t size) { @@ -251,7 +251,7 @@ void ZMapper::unreserve_for_shared_awe(zaddress_unsafe addr, size_t size) { ); if (!res) { - fatal("Failed to unreserve memory: " PTR_FORMAT " " SIZE_FORMAT "M (%d)", + fatal("Failed to unreserve memory: " PTR_FORMAT " %zuM (%d)", untype(addr), size / M, GetLastError()); } } diff --git a/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp b/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp index 0a66f04d31c..70cdc6e6e22 100644 --- a/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp +++ b/src/hotspot/os/windows/gc/z/zPhysicalMemoryBacking_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -157,10 +157,10 @@ public: size_t npages_res = npages; const bool res = AllocateUserPhysicalPages(ZAWESection, &npages_res, &_page_array[index]); if (!res) { - fatal("Failed to allocate physical memory " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to allocate physical memory %zuM @ " PTR_FORMAT " (%d)", size / M, untype(offset), GetLastError()); } else { - log_debug(gc)("Allocated physical memory: " SIZE_FORMAT "M @ " PTR_FORMAT, size / M, untype(offset)); + log_debug(gc)("Allocated physical memory: %zuM @ " PTR_FORMAT, size / M, untype(offset)); } // AllocateUserPhysicalPages might not be able to allocate the requested amount of memory. @@ -175,7 +175,7 @@ public: size_t npages_res = npages; const bool res = FreeUserPhysicalPages(ZAWESection, &npages_res, &_page_array[index]); if (!res) { - fatal("Failed to uncommit physical memory " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to uncommit physical memory %zuM @ " PTR_FORMAT " (%d)", size, untype(offset), GetLastError()); } @@ -188,7 +188,7 @@ public: const bool res = MapUserPhysicalPages((char*)untype(addr), npages, &_page_array[index]); if (!res) { - fatal("Failed to map view " PTR_FORMAT " " SIZE_FORMAT "M @ " PTR_FORMAT " (%d)", + fatal("Failed to map view " PTR_FORMAT " %zuM @ " PTR_FORMAT " (%d)", untype(addr), size / M, untype(offset), GetLastError()); } } @@ -198,7 +198,7 @@ public: const bool res = MapUserPhysicalPages((char*)untype(addr), npages, nullptr); if (!res) { - fatal("Failed to unmap view " PTR_FORMAT " " SIZE_FORMAT "M (%d)", + fatal("Failed to unmap view " PTR_FORMAT " %zuM (%d)", addr, size / M, GetLastError()); } } @@ -224,14 +224,14 @@ void ZPhysicalMemoryBacking::warn_commit_limits(size_t max_capacity) const { } size_t ZPhysicalMemoryBacking::commit(zoffset offset, size_t length) { - log_trace(gc, heap)("Committing memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Committing memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); return _impl->commit(offset, length); } size_t ZPhysicalMemoryBacking::uncommit(zoffset offset, size_t length) { - log_trace(gc, heap)("Uncommitting memory: " SIZE_FORMAT "M-" SIZE_FORMAT "M (" SIZE_FORMAT "M)", + log_trace(gc, heap)("Uncommitting memory: %zuM-%zuM (%zuM)", untype(offset) / M, untype(to_zoffset_end(offset, length)) / M, length / M); return _impl->uncommit(offset, length); diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 51bc015442c..130356dbc7f 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -198,12 +198,12 @@ struct PreserveLastError { static LPVOID virtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) { LPVOID result = ::VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); if (result != nullptr) { - log_trace(os)("VirtualAlloc(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x) returned " PTR_FORMAT "%s.", + log_trace(os)("VirtualAlloc(" PTR_FORMAT ", %zu, %x, %x) returned " PTR_FORMAT "%s.", p2i(lpAddress), dwSize, flAllocationType, flProtect, p2i(result), ((lpAddress != nullptr && result != lpAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("VirtualAlloc(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x) failed (%u).", + log_info(os)("VirtualAlloc(" PTR_FORMAT ", %zu, %x, %x) failed (%u).", p2i(lpAddress), dwSize, flAllocationType, flProtect, ple.v); } return result; @@ -213,11 +213,11 @@ static LPVOID virtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationTy static BOOL virtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType) { BOOL result = ::VirtualFree(lpAddress, dwSize, dwFreeType); if (result != FALSE) { - log_trace(os)("VirtualFree(" PTR_FORMAT ", " SIZE_FORMAT ", %x) succeeded", + log_trace(os)("VirtualFree(" PTR_FORMAT ", %zu, %x) succeeded", p2i(lpAddress), dwSize, dwFreeType); } else { PreserveLastError ple; - log_info(os)("VirtualFree(" PTR_FORMAT ", " SIZE_FORMAT ", %x) failed (%u).", + log_info(os)("VirtualFree(" PTR_FORMAT ", %zu, %x) failed (%u).", p2i(lpAddress), dwSize, dwFreeType, ple.v); } return result; @@ -228,12 +228,12 @@ static LPVOID virtualAllocExNuma(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSiz DWORD flProtect, DWORD nndPreferred) { LPVOID result = ::VirtualAllocExNuma(hProcess, lpAddress, dwSize, flAllocationType, flProtect, nndPreferred); if (result != nullptr) { - log_trace(os)("VirtualAllocExNuma(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x, %x) returned " PTR_FORMAT "%s.", + log_trace(os)("VirtualAllocExNuma(" PTR_FORMAT ", %zu, %x, %x, %x) returned " PTR_FORMAT "%s.", p2i(lpAddress), dwSize, flAllocationType, flProtect, nndPreferred, p2i(result), ((lpAddress != nullptr && result != lpAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("VirtualAllocExNuma(" PTR_FORMAT ", " SIZE_FORMAT ", %x, %x, %x) failed (%u).", + log_info(os)("VirtualAllocExNuma(" PTR_FORMAT ", %zu, %x, %x, %x) failed (%u).", p2i(lpAddress), dwSize, flAllocationType, flProtect, nndPreferred, ple.v); } return result; @@ -245,12 +245,12 @@ static LPVOID mapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, LPVOID result = ::MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress); if (result != nullptr) { - log_trace(os)("MapViewOfFileEx(" PTR_FORMAT ", " SIZE_FORMAT ") returned " PTR_FORMAT "%s.", + log_trace(os)("MapViewOfFileEx(" PTR_FORMAT ", %zu) returned " PTR_FORMAT "%s.", p2i(lpBaseAddress), dwNumberOfBytesToMap, p2i(result), ((lpBaseAddress != nullptr && result != lpBaseAddress) ? " " : "")); } else { PreserveLastError ple; - log_info(os)("MapViewOfFileEx(" PTR_FORMAT ", " SIZE_FORMAT ") failed (%u).", + log_info(os)("MapViewOfFileEx(" PTR_FORMAT ", %zu) failed (%u).", p2i(lpBaseAddress), dwNumberOfBytesToMap, ple.v); } return result; @@ -544,7 +544,7 @@ static unsigned thread_native_entry(void* t) { res = 20115; // java thread } - log_info(os, thread)("Thread is alive (tid: %zu, stacksize: " SIZE_FORMAT "k).", os::current_thread_id(), thread->stack_size() / K); + log_info(os, thread)("Thread is alive (tid: %zu, stacksize: %zuk).", os::current_thread_id(), thread->stack_size() / K); #ifdef USE_VECTORED_EXCEPTION_HANDLING // Any exception is caught by the Vectored Exception Handler, so VM can @@ -630,7 +630,7 @@ bool os::create_attached_thread(JavaThread* thread) { thread->set_osthread(osthread); log_info(os, thread)("Thread attached (tid: %zu, stack: " - PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", + PTR_FORMAT " - " PTR_FORMAT " (%zuK) ).", os::current_thread_id(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -663,7 +663,7 @@ static char* describe_beginthreadex_attributes(char* buf, size_t buflen, if (stacksize == 0) { ss.print("stacksize: default, "); } else { - ss.print("stacksize: " SIZE_FORMAT "k, ", stacksize / K); + ss.print("stacksize: %zuk, ", stacksize / K); } ss.print("flags: "); #define PRINT_FLAG(f) if (initflag & f) ss.print( #f " "); @@ -2083,7 +2083,7 @@ void os::get_summary_cpu_info(char* buf, size_t buflen) { void os::print_memory_info(outputStream* st) { st->print("Memory:"); - st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); + st->print(" %zuk page", os::vm_page_size()>>10); // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect // value if total memory is larger than 4GB @@ -3433,7 +3433,7 @@ 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=" SIZE_FORMAT "%s", + 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)); // Will try to find a suitable address at most 20 times. The reason we need to try @@ -3495,7 +3495,7 @@ static void warn_fail_commit_memory(char* addr, size_t bytes, bool exec) { int err = os::get_last_error(); char buf[256]; size_t buf_len = os::lasterror(buf, sizeof(buf)); - warning("INFO: os::commit_memory(" PTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::commit_memory(" PTR_FORMAT ", %zu" ", %d) failed; error='%s' (DOS error/errno=%d)", addr, bytes, exec, buf_len != 0 ? buf : "", err); } @@ -3725,7 +3725,7 @@ bool os::protect_memory(char* addr, size_t bytes, ProtType prot, int err = os::get_last_error(); char buf[256]; size_t buf_len = os::lasterror(buf, sizeof(buf)); - warning("INFO: os::protect_memory(" PTR_FORMAT ", " SIZE_FORMAT + warning("INFO: os::protect_memory(" PTR_FORMAT ", %zu" ") failed; error='%s' (DOS error/errno=%d)", addr, bytes, buf_len != 0 ? buf : "", err); } diff --git a/src/hotspot/os/windows/perfMemory_windows.cpp b/src/hotspot/os/windows/perfMemory_windows.cpp index 06b057315cb..84c4d840a99 100644 --- a/src/hotspot/os/windows/perfMemory_windows.cpp +++ b/src/hotspot/os/windows/perfMemory_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -1561,7 +1561,7 @@ static size_t sharedmem_filesize(const char* filename, TRAPS) { if ((statbuf.st_size == 0) || (statbuf.st_size % os::vm_page_size() != 0)) { if (PrintMiscellaneous && Verbose) { - warning("unexpected file size: size = " SIZE_FORMAT "\n", + warning("unexpected file size: size = %zu\n", statbuf.st_size); } THROW_MSG_0(vmSymbols::java_io_IOException(), @@ -1660,7 +1660,7 @@ static void open_file_mapping(int vmid, char** addrp, size_t* sizep, TRAPS) { // invalidating the mapped view of the file CloseHandle(fmh); - log_debug(perf, memops)("mapped " SIZE_FORMAT " bytes for vmid %d at " + log_debug(perf, memops)("mapped %zu bytes for vmid %d at " INTPTR_FORMAT, size, vmid, mapAddress); }