From 6d6fbfa7159f6c073be93f85695ad81430d0f41c Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 3 Jan 2025 14:26:28 +0000 Subject: [PATCH 1/6] 8346990: Remove INTX_FORMAT and UINTX_FORMAT macros --- src/hotspot/cpu/arm/methodHandles_arm.cpp | 4 +- src/hotspot/cpu/ppc/vm_version_ppc.cpp | 4 +- src/hotspot/cpu/s390/assembler_s390.hpp | 4 +- src/hotspot/cpu/x86/vm_version_x86.cpp | 6 +- src/hotspot/os/aix/os_aix.cpp | 30 ++++----- src/hotspot/os/bsd/os_bsd.cpp | 12 ++-- src/hotspot/os/linux/os_linux.cpp | 32 +++++----- src/hotspot/os/windows/os_windows.cpp | 8 +-- src/hotspot/share/c1/c1_CFGPrinter.cpp | 4 +- src/hotspot/share/c1/c1_LIR.cpp | 4 +- src/hotspot/share/cds/archiveHeapLoader.cpp | 4 +- src/hotspot/share/cds/filemap.cpp | 6 +- src/hotspot/share/ci/ciMethodData.cpp | 4 +- .../share/classfile/classLoaderStats.cpp | 10 +-- src/hotspot/share/code/nmethod.cpp | 6 +- src/hotspot/share/code/vtableStubs.cpp | 4 +- src/hotspot/share/compiler/compileBroker.cpp | 10 +-- src/hotspot/share/compiler/compileLog.cpp | 4 +- .../share/compiler/compilerDirectives.hpp | 6 +- src/hotspot/share/compiler/compilerOracle.cpp | 10 +-- src/hotspot/share/compiler/disassembler.cpp | 4 +- src/hotspot/share/compiler/oopMap.cpp | 6 +- .../share/gc/g1/g1HeapSizingPolicy.cpp | 6 +- src/hotspot/share/gc/g1/g1InitLogger.cpp | 4 +- src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp | 4 +- .../share/gc/g1/jvmFlagConstraintsG1.cpp | 12 ++-- src/hotspot/share/gc/shared/ageTable.cpp | 6 +- .../share/gc/shared/jvmFlagConstraintsGC.cpp | 16 ++--- src/hotspot/share/gc/shared/oopStorage.cpp | 4 +- src/hotspot/share/gc/shared/workerPolicy.cpp | 8 +-- .../heuristics/shenandoahHeuristics.cpp | 6 +- .../gc/shenandoah/shenandoahAgeCensus.cpp | 2 +- .../gc/shenandoah/shenandoahMmuTracker.cpp | 2 +- .../gc/shenandoah/shenandoahVerifier.cpp | 4 +- src/hotspot/share/gc/z/zPhysicalMemory.cpp | 4 +- src/hotspot/share/gc/z/zVerify.cpp | 4 +- .../share/interpreter/bytecodeTracer.cpp | 6 +- .../share/interpreter/invocationCounter.cpp | 4 +- src/hotspot/share/jvmci/jvmci.cpp | 4 +- src/hotspot/share/jvmci/jvmciRuntime.cpp | 4 +- src/hotspot/share/logging/logAsyncWriter.hpp | 4 +- src/hotspot/share/logging/logDecorations.cpp | 4 +- src/hotspot/share/memory/heapInspection.cpp | 4 +- src/hotspot/share/memory/memoryReserver.cpp | 4 +- .../share/memory/metaspace/internalStats.cpp | 4 +- .../memory/metaspace/metaspaceCommon.cpp | 6 +- .../memory/metaspace/metaspaceReporter.cpp | 8 +-- .../memory/metaspace/metaspaceStatistics.cpp | 6 +- .../printCLDMetaspaceInfoClosure.cpp | 4 +- .../printMetaspaceInfoKlassClosure.cpp | 4 +- src/hotspot/share/memory/universe.cpp | 4 +- src/hotspot/share/nmt/memMapPrinter.cpp | 4 +- src/hotspot/share/oops/instanceKlass.cpp | 6 +- src/hotspot/share/oops/klass.cpp | 4 +- src/hotspot/share/oops/method.cpp | 4 +- src/hotspot/share/opto/idealGraphPrinter.cpp | 6 +- src/hotspot/share/opto/memnode.cpp | 4 +- src/hotspot/share/prims/jvmtiExport.cpp | 16 ++--- src/hotspot/share/runtime/arguments.cpp | 4 +- src/hotspot/share/runtime/deoptimization.cpp | 10 +-- src/hotspot/share/runtime/flags/jvmFlag.cpp | 10 +-- .../share/runtime/flags/jvmFlagAccess.cpp | 18 +++--- .../flags/jvmFlagConstraintsCompiler.cpp | 64 +++++++++---------- .../flags/jvmFlagConstraintsRuntime.cpp | 10 +-- src/hotspot/share/runtime/frame.cpp | 4 +- src/hotspot/share/runtime/java.cpp | 4 +- src/hotspot/share/runtime/javaThread.cpp | 26 ++++---- src/hotspot/share/runtime/objectMonitor.cpp | 8 +-- src/hotspot/share/runtime/osThreadBase.cpp | 4 +- src/hotspot/share/runtime/stackOverflow.cpp | 9 ++- src/hotspot/share/runtime/synchronizer.cpp | 4 +- src/hotspot/share/runtime/thread.cpp | 4 +- src/hotspot/share/runtime/threadSMR.cpp | 26 ++++---- src/hotspot/share/runtime/threads.cpp | 6 +- src/hotspot/share/runtime/vmThread.cpp | 6 +- src/hotspot/share/services/management.cpp | 4 +- src/hotspot/share/services/writeableFlags.cpp | 6 +- .../share/utilities/fakeRttiSupport.hpp | 8 +-- .../share/utilities/globalDefinitions.hpp | 14 +--- src/hotspot/share/utilities/ostream.cpp | 4 +- src/hotspot/share/utilities/vmError.cpp | 12 ++-- .../utilities/test_globalDefinitions.cpp | 18 +++--- .../test_singleWriterSynchronizer.cpp | 4 +- 83 files changed, 326 insertions(+), 339 deletions(-) diff --git a/src/hotspot/cpu/arm/methodHandles_arm.cpp b/src/hotspot/cpu/arm/methodHandles_arm.cpp index f59e01112e904..5203c8b82366a 100644 --- a/src/hotspot/cpu/arm/methodHandles_arm.cpp +++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp @@ -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 @@ -497,7 +497,7 @@ void trace_method_handle_stub(const char* adaptername, if (!has_mh) { mh_reg_name = "R5"; } - log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT, + log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+%zd) stack_size=%zd bp=" PTR_FORMAT, adaptername, mh_reg_name, mh_reg, (intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp); diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp index 9a4f13e41a04d..faeddb3410609 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -90,7 +90,7 @@ void VM_Version::initialize() { default: break; } guarantee(PowerArchitecturePPC64_ok, "PowerArchitecturePPC64 cannot be set to " - UINTX_FORMAT " on this machine", PowerArchitecturePPC64); + "%zu on this machine", PowerArchitecturePPC64); // Power 8: Configure Data Stream Control Register. if (PowerArchitecturePPC64 >= 8 && has_mfdscr()) { diff --git a/src/hotspot/cpu/s390/assembler_s390.hpp b/src/hotspot/cpu/s390/assembler_s390.hpp index 1ba90b69d1748..c0cee5bd55537 100644 --- a/src/hotspot/cpu/s390/assembler_s390.hpp +++ b/src/hotspot/cpu/s390/assembler_s390.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -140,7 +140,7 @@ class RelAddr { return 0; // Yet unknown branch destination. } else { guarantee(is_in_range_of_RelAddr(target, pc, shortForm), - "target not within reach at " INTPTR_FORMAT ", distance = " INTX_FORMAT, p2i(pc), (target - pc) ); + "target not within reach at " INTPTR_FORMAT ", distance = %zd", p2i(pc), (target - pc) ); return (int)((target - pc)>>1); } } diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 688cd4fa5a6d1..5672e4a07f5d6 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1722,9 +1722,9 @@ void VM_Version::get_processor_features() { if (ArrayOperationPartialInlineSize > MaxVectorSize) { ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0; if (ArrayOperationPartialInlineSize) { - warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize" INTX_FORMAT ")", MaxVectorSize); + warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize%zd)", MaxVectorSize); } else { - warning("Setting ArrayOperationPartialInlineSize as " INTX_FORMAT, ArrayOperationPartialInlineSize); + warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize); } } } diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 26627c2f8fb3b..93fed83143e21 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -631,7 +631,7 @@ static void *thread_native_entry(Thread *thread) { if (lt.is_enabled()) { address low_address = thread->stack_end(); address high_address = thread->stack_base(); - lt.print("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT + lt.print("Thread is alive (tid: %zu, kernel thread id: %zu" ", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k 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); @@ -681,7 +681,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, kernel thread id: %zu).", os::current_thread_id(), (uintx) kernel_thread_id); return 0; @@ -761,7 +761,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, if (ret == 0) { char buf[64]; - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); } else { char buf[64]; @@ -839,7 +839,7 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT + log_info(os, thread)("Thread attached (tid: %zu, kernel thread id: %zu" ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", os::current_thread_id(), (uintx) kernel_thread_id, p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1379,7 +1379,7 @@ struct vmembk_t { } void print_on(outputStream* os) const { - os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (" UINTX_FORMAT + os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (%zu" " bytes, %ld %s pages), %s", p2i(addr), p2i(addr) + size - 1, size, size / pagesize, describe_pagesize(pagesize), (type == VMEM_SHMATED ? "shmat" : "mmap") @@ -1456,7 +1456,7 @@ static void vmembk_print_on(outputStream* os) { // If is null, function will attach the memory anywhere. static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { - trcVerbose("reserve_shmated_memory " UINTX_FORMAT " bytes, wishaddress " + trcVerbose("reserve_shmated_memory %zu bytes, wishaddress " PTR_FORMAT "...", bytes, p2i(requested_addr)); // We must prevent anyone from attaching too close to the @@ -1477,7 +1477,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { int shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | S_IRUSR | S_IWUSR); if (shmid == -1) { ErrnoPreserver ep; - log_trace(os, map)("shmget(.., " UINTX_FORMAT ", ..) failed (errno=%s).", + log_trace(os, map)("shmget(.., %zu, ..) failed (errno=%s).", size, os::strerror(ep.saved_errno())); return nullptr; } @@ -1493,7 +1493,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { shmbuf.shm_pagesize = 64*K; if (shmctl(shmid, SHM_PAGESIZE, &shmbuf) != 0) { assert(false, - "Failed to set page size (need " UINTX_FORMAT + "Failed to set page size (need %zu" " 64K pages) - shmctl failed. (errno=%s).", size / (64 * K), os::strerror(os::get_last_error())); } @@ -1536,7 +1536,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { if (addr) { log_trace(os, map)("shm-allocated succeeded: " RANGEFMT - " (" UINTX_FORMAT " %s pages)", + " (%zu %s pages)", RANGEFMTARGS(addr, size), size / real_pagesize, describe_pagesize(real_pagesize)); @@ -1545,7 +1545,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) { log_trace(os, map)("shm-allocate failed: " RANGEFMT, RANGEFMTARGS(requested_addr, size)); } else { - log_trace(os, map)("failed to shm-allocate " UINTX_FORMAT + log_trace(os, map)("failed to shm-allocate %zu" " bytes at any address.", size); } @@ -1587,7 +1587,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) { if (rc != 0) { ErrnoPreserver ep; - log_warning(os)("disclaim64(" PTR_FORMAT ", " UINTX_FORMAT ") failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno())); + log_warning(os)("disclaim64(" PTR_FORMAT ", %zu) failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno())); return false; } return true; @@ -1599,7 +1599,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) { // If is given, an attempt is made to attach at the given address. // Failing that, memory is allocated at any address. static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) { - trcVerbose("reserve_mmaped_memory " UINTX_FORMAT " bytes, wishaddress " PTR_FORMAT "...", + trcVerbose("reserve_mmaped_memory %zu bytes, wishaddress " PTR_FORMAT "...", bytes, p2i(requested_addr)); if (requested_addr && !is_aligned_to(requested_addr, os::vm_page_size()) != 0) { @@ -1689,7 +1689,7 @@ static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) { } addr = addr_aligned; - trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (" UINTX_FORMAT " bytes)", + trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (%zu bytes)", p2i(addr), p2i(addr + bytes), bytes); // bookkeeping @@ -2783,7 +2783,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen -len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'dbx -a %d'; then switch to thread tid " INTX_FORMAT ", k-tid " INTX_FORMAT "\n" + "To debug, run 'dbx -a %d'; then switch to thread tid %zd, k-tid %zd\n" "Enter 'yes' to launch dbx automatically (PATH must include dbx)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 5db846275d4b4..c724bef8b99a4 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -605,7 +605,7 @@ static void *thread_native_entry(Thread *thread) { } } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); // call one more level start routine @@ -615,7 +615,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); return 0; @@ -660,7 +660,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, char buf[64]; if (ret == 0) { - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); } else { log_warning(os, thread)("Failed to start thread \"%s\" - pthread_create failed (%s) for attributes: %s.", @@ -744,7 +744,7 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT + log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -2524,7 +2524,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen-len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n" + "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zd (" INTPTR_FORMAT ")\n" "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), os::current_process_id(), diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 094ca2bf2fc91..d5f2889c5ab62 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -847,7 +847,7 @@ static void *thread_native_entry(Thread *thread) { } } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); assert(osthread->pthread_id() != 0, "pthread_id was not set as expected"); @@ -863,7 +863,7 @@ static void *thread_native_entry(Thread *thread) { // Prevent dereferencing it from here on out. thread = nullptr; - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", + log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).", os::current_thread_id(), (uintx) pthread_self()); return nullptr; @@ -1054,7 +1054,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, char buf[64]; if (ret == 0) { - log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ", + log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ", thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr)); // Print current timer slack if override is enabled and timer slack value is available. @@ -1062,7 +1062,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, if (TimerSlack >= 0) { int slack = prctl(PR_GET_TIMERSLACK); if (slack >= 0) { - log_info(os, thread)("Thread \"%s\" (pthread id: " UINTX_FORMAT ") timer slack: %dns", + log_info(os, thread)("Thread \"%s\" (pthread id: %zu) timer slack: %dns", thread->name(), (uintx) tid, slack); } } @@ -1170,7 +1170,7 @@ bool os::create_attached_thread(JavaThread* thread) { // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT + log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu" ", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", os::current_thread_id(), (uintx) pthread_self(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); @@ -1366,8 +1366,8 @@ void os::Linux::capture_initial_stack(size_t max_size) { // Skip blank chars do { s++; } while (s && isspace((unsigned char) *s)); -#define _UFM UINTX_FORMAT -#define _DFM INTX_FORMAT +#define _UFM "%zu" +#define _DFM "%zd" // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 @@ -1391,13 +1391,13 @@ void os::Linux::capture_initial_stack(size_t max_size) { &nice, // 19 %ld &junk, // 20 %ld &it_real, // 21 %ld - &start, // 22 UINTX_FORMAT - &vsize, // 23 UINTX_FORMAT - &rss, // 24 INTX_FORMAT - &rsslim, // 25 UINTX_FORMAT - &scodes, // 26 UINTX_FORMAT - &ecode, // 27 UINTX_FORMAT - &stack_start); // 28 UINTX_FORMAT + &start, // 22 %zu + &vsize, // 23 %zu + &rss, // 24 %zd + &rsslim, // 25 %zu + &scodes, // 26 %zu + &ecode, // 27 %zu + &stack_start); // 28 %zu } #undef _UFM @@ -5279,7 +5279,7 @@ bool os::start_debugging(char *buf, int buflen) { jio_snprintf(p, buflen-len, "\n\n" "Do you want to debug the problem?\n\n" - "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n" + "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zu (" INTPTR_FORMAT ")\n" "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" "Otherwise, press RETURN to abort...", os::current_process_id(), os::current_process_id(), diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index afd8fe01752b0..b167355c1eeae 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -530,7 +530,7 @@ static unsigned thread_native_entry(void* t) { res = 20115; // java thread } - log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", stacksize: " SIZE_FORMAT "k).", os::current_thread_id(), thread->stack_size() / K); + log_info(os, thread)("Thread is alive (tid: %zu, stacksize: " SIZE_FORMAT "k).", 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 @@ -552,7 +552,7 @@ static unsigned thread_native_entry(void* t) { // Note: at this point the thread object may already have deleted itself. // Do not dereference it from here on out. - log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id()); + log_info(os, thread)("Thread finished (tid: %zu).", os::current_thread_id()); // Thread must not return from exit_process_or_thread(), but if it does, // let it proceed to exit normally @@ -615,7 +615,7 @@ bool os::create_attached_thread(JavaThread* thread) { thread->set_osthread(osthread); - log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", stack: " + log_info(os, thread)("Thread attached (tid: %zu, stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).", os::current_thread_id(), p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K); diff --git a/src/hotspot/share/c1/c1_CFGPrinter.cpp b/src/hotspot/share/c1/c1_CFGPrinter.cpp index 5e167f5660c39..0e39b66d5caa8 100644 --- a/src/hotspot/share/c1/c1_CFGPrinter.cpp +++ b/src/hotspot/share/c1/c1_CFGPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -63,7 +63,7 @@ CFGPrinterOutput::CFGPrinterOutput(Compilation* compilation) _do_print_LIR(false) { char file_name[O_BUFLEN]; - jio_snprintf(file_name, sizeof(file_name), "output_tid" UINTX_FORMAT "_pid%u.cfg", + jio_snprintf(file_name, sizeof(file_name), "output_tid%zu_pid%u.cfg", os::current_thread_id(), os::current_process_id()); _output = new (mtCompiler) fileStream(file_name, "at"); } diff --git a/src/hotspot/share/c1/c1_LIR.cpp b/src/hotspot/share/c1/c1_LIR.cpp index 048eb6047ede9..a7bd33e77e071 100644 --- a/src/hotspot/share/c1/c1_LIR.cpp +++ b/src/hotspot/share/c1/c1_LIR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -1614,7 +1614,7 @@ void LIR_Address::print_value_on(outputStream* out) const { case times_8: out->print(" * 8"); break; } } - out->print(" Disp: " INTX_FORMAT, _disp); + out->print(" Disp: %zd", _disp); } // debug output of block header without InstructionPrinter diff --git a/src/hotspot/share/cds/archiveHeapLoader.cpp b/src/hotspot/share/cds/archiveHeapLoader.cpp index b05fd20f4f59f..65bff94e71c00 100644 --- a/src/hotspot/share/cds/archiveHeapLoader.cpp +++ b/src/hotspot/share/cds/archiveHeapLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -308,7 +308,7 @@ bool ArchiveHeapLoader::load_heap_region_impl(FileMapInfo* mapinfo, LoadedArchiv } assert(r->mapped_base() == (char*)load_address, "sanity"); log_info(cds)("Loaded heap region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT - " size " SIZE_FORMAT_W(6) " delta " INTX_FORMAT, + " size " SIZE_FORMAT_W(6) " delta %zd", loaded_region->_region_index, load_address, load_address + loaded_region->_region_size, loaded_region->_region_size, loaded_region->_runtime_offset); diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index c87081d9d14e6..45210080bb53c 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -285,7 +285,7 @@ void FileMapHeader::print(outputStream* st) { st->print_cr("- narrow_oop_shift %d", _narrow_oop_shift); st->print_cr("- compact_strings: %d", _compact_strings); st->print_cr("- compact_headers: %d", _compact_headers); - st->print_cr("- max_heap_size: " UINTX_FORMAT, _max_heap_size); + st->print_cr("- max_heap_size: %zu", _max_heap_size); st->print_cr("- narrow_oop_mode: %d", _narrow_oop_mode); st->print_cr("- compressed_oops: %d", _compressed_oops); st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs); @@ -2366,7 +2366,7 @@ bool FileMapInfo::map_heap_region_impl() { } log_info(cds)("Heap data mapped at " INTPTR_FORMAT ", size = " SIZE_FORMAT_W(8) " bytes", p2i(mapped_start), _mapped_heap_memregion.byte_size()); - log_info(cds)("CDS heap data relocation delta = " INTX_FORMAT " bytes", delta); + log_info(cds)("CDS heap data relocation delta = %zd bytes", delta); return true; } diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index 5abb342d03119..63b690c87c9b8 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.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 @@ -785,7 +785,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { // We could use INTPTR_FORMAT here but that's zero justified // which makes comparing it with the SA version of this output // harder. data()'s element type is intptr_t. - out->print(" " INTX_FORMAT_X, data()[i]); + out->print(" 0x%zx", data()[i]); } // The MDO contained oop references as ciObjects, so scan for those diff --git a/src/hotspot/share/classfile/classLoaderStats.cpp b/src/hotspot/share/classfile/classLoaderStats.cpp index 5fbd4ce00d922..1216811aeea6e 100644 --- a/src/hotspot/share/classfile/classLoaderStats.cpp +++ b/src/hotspot/share/classfile/classLoaderStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -112,7 +112,7 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c Klass* class_loader_klass = (cls._class_loader == nullptr ? nullptr : cls._class_loader->klass()); Klass* parent_klass = (cls._parent == nullptr ? nullptr : cls._parent->klass()); - _out->print(INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", + _out->print(INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " %6zu " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", p2i(class_loader_klass), p2i(parent_klass), p2i(cls._cld), cls._classes_count, cls._chunk_sz, cls._block_sz); @@ -123,7 +123,7 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c } _out->cr(); if (cls._hidden_classes_count > 0) { - _out->print_cr(SPACE SPACE SPACE " " UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " + hidden classes", + _out->print_cr(SPACE SPACE SPACE " %6zu " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " + hidden classes", "", "", "", cls._hidden_classes_count, cls._hidden_chunk_sz, cls._hidden_block_sz); @@ -135,9 +135,9 @@ bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& c void ClassLoaderStatsClosure::print() { _out->print_cr("ClassLoader" SPACE " Parent" SPACE " CLD*" SPACE " Classes ChunkSz BlockSz Type", "", "", ""); _stats->iterate(this); - _out->print("Total = " UINTX_FORMAT_W(-6), _total_loaders); + _out->print("Total = %-6zu", _total_loaders); _out->print(SPACE SPACE SPACE " ", "", "", ""); - _out->print_cr(UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", + _out->print_cr("%6zu " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ", _total_classes, _total_chunk_sz, _total_block_sz); diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 754a7786605ff..0d44c4f2e6d9f 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1586,7 +1586,7 @@ void nmethod::log_identity(xmlStream* log) const { #define LOG_OFFSET(log, name) \ if (p2i(name##_end()) - p2i(name##_begin())) \ - log->print(" " XSTR(name) "_offset='" INTX_FORMAT "'" , \ + log->print(" " XSTR(name) "_offset='%zd'" , \ p2i(name##_begin()) - p2i(this)) @@ -1962,7 +1962,7 @@ void nmethod::log_state_change() const { if (LogCompilation) { if (xtty != nullptr) { ttyLocker ttyl; // keep the following output all in one block - xtty->begin_elem("make_not_entrant thread='" UINTX_FORMAT "'", + xtty->begin_elem("make_not_entrant thread='%zu'", os::current_thread_id()); log_identity(xtty); xtty->stamp(); diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index 6a0c52ae828c4..8f7ad91ddc900 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -79,7 +79,7 @@ void* VtableStub::operator new(size_t size, int code_size) throw() { void VtableStub::print_on(outputStream* st) const { - st->print("vtable stub (index = %d, receiver_location = " INTX_FORMAT ", code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "])", + st->print("vtable stub (index = %d, receiver_location = %zd, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "])", index(), p2i(receiver_location()), p2i(code_begin()), p2i(code_end())); } diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 30956b6c793bd..ce942f2c64f2a 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -1917,7 +1917,7 @@ void CompileBroker::compiler_thread_loop() { // Open a log. CompileLog* log = get_log(thread); if (log != nullptr) { - log->begin_elem("start_compile_thread name='%s' thread='" UINTX_FORMAT "' process='%d'", + log->begin_elem("start_compile_thread name='%s' thread='%zu' process='%d'", thread->name(), os::current_thread_id(), os::current_process_id()); @@ -2008,11 +2008,11 @@ void CompileBroker::init_compiler_thread_log() { for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) { const char* dir = (try_temp_dir ? os::get_temp_directory() : nullptr); if (dir == nullptr) { - jio_snprintf(file_name, sizeof(file_name), "hs_c" UINTX_FORMAT "_pid%u.log", + jio_snprintf(file_name, sizeof(file_name), "hs_c%zu_pid%u.log", thread_id, os::current_process_id()); } else { jio_snprintf(file_name, sizeof(file_name), - "%s%shs_c" UINTX_FORMAT "_pid%u.log", dir, + "%s%shs_c%zu_pid%u.log", dir, os::file_separator(), thread_id, os::current_process_id()); } @@ -2031,7 +2031,7 @@ void CompileBroker::init_compiler_thread_log() { if (xtty != nullptr) { ttyLocker ttyl; // Record any per thread log files - xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name); + xtty->elem("thread_logfile thread='%zd' filename='%s'", thread_id, file_name); } return; } diff --git a/src/hotspot/share/compiler/compileLog.cpp b/src/hotspot/share/compiler/compileLog.cpp index 7b780fec492f9..d38ab0ca490b7 100644 --- a/src/hotspot/share/compiler/compileLog.cpp +++ b/src/hotspot/share/compiler/compileLog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -212,7 +212,7 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen) // print/print_cr may need to allocate large stack buffer to format // strings, here we use snprintf() and print_raw() instead. file->print_raw(""); diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index 620874508f483..74e3d8b9b38e7 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -218,8 +218,8 @@ void set_##name(void* value) { \ return _trace_merge_stores_tags; }; - void print_intx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:" INTX_FORMAT " ", n, v); } } - void print_uintx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:" UINTX_FORMAT " ", n, v); } } + void print_intx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:%zd ", n, v); } } + void print_uintx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:%zu ", n, v); } } void print_bool(outputStream* st, ccstr n, bool v, bool mod) { if (mod) { st->print("%s:%s ", n, v ? "true" : "false"); } } void print_double(outputStream* st, ccstr n, double v, bool mod) { if (mod) { st->print("%s:%f ", n, v); } } void print_ccstr(outputStream* st, ccstr n, ccstr v, bool mod) { if (mod) { st->print("%s:%s ", n, v); } } diff --git a/src/hotspot/share/compiler/compilerOracle.cpp b/src/hotspot/share/compiler/compilerOracle.cpp index 107350794a02d..6ef8b28148fa5 100644 --- a/src/hotspot/share/compiler/compilerOracle.cpp +++ b/src/hotspot/share/compiler/compilerOracle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -236,10 +236,10 @@ void TypedMethodOptionMatcher::print() { enum OptionType type = option2type(_option); switch (type) { case OptionType::Intx: - tty->print_cr(" intx %s = " INTX_FORMAT, name, value()); + tty->print_cr(" intx %s = %zd", name, value()); break; case OptionType::Uintx: - tty->print_cr(" uintx %s = " UINTX_FORMAT, name, value()); + tty->print_cr(" uintx %s = %zu", name, value()); break; case OptionType::Bool: tty->print_cr(" bool %s = %s", name, value() ? "true" : "false"); @@ -736,7 +736,7 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read, success = parseMemLimit(line, value, bytes_read, errorbuf, buf_size); } else { // Is it a raw number? - success = sscanf(line, "" INTX_FORMAT "%n", &value, &bytes_read) == 1; + success = sscanf(line, "%zd%n", &value, &bytes_read) == 1; } if (success) { total_bytes_read += bytes_read; @@ -754,7 +754,7 @@ static void scan_value(enum OptionType type, char* line, int& total_bytes_read, success = parseMemStat(line, value, bytes_read, errorbuf, buf_size); } else { // parse as raw number - success = sscanf(line, "" UINTX_FORMAT "%n", &value, &bytes_read) == 1; + success = sscanf(line, "%zu%n", &value, &bytes_read) == 1; } if (success) { total_bytes_read += bytes_read; diff --git a/src/hotspot/share/compiler/disassembler.cpp b/src/hotspot/share/compiler/disassembler.cpp index 6556ce4ae1df2..0393b67cfd963 100644 --- a/src/hotspot/share/compiler/disassembler.cpp +++ b/src/hotspot/share/compiler/disassembler.cpp @@ -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 @@ -597,7 +597,7 @@ void decode_env::print_address(address adr) { if (desc != nullptr) { st->print("Stub::%s", desc->name()); if (desc->begin() != adr) { - st->print(INTX_FORMAT_W(+) " " PTR_FORMAT, adr - desc->begin(), p2i(adr)); + st->print("%+zd " PTR_FORMAT, adr - desc->begin(), p2i(adr)); } else if (WizardMode) { st->print(" " PTR_FORMAT, p2i(adr)); } diff --git a/src/hotspot/share/compiler/oopMap.cpp b/src/hotspot/share/compiler/oopMap.cpp index 376057aa72e25..f3bf47fb7e4ab 100644 --- a/src/hotspot/share/compiler/oopMap.cpp +++ b/src/hotspot/share/compiler/oopMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -929,7 +929,7 @@ void DerivedPointerTable::add(derived_pointer* derived_loc, derived_base* base_l tty->print_cr( "Add derived pointer@" INTPTR_FORMAT " - Derived: " INTPTR_FORMAT - " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")", + " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %zd)", p2i(derived_loc), derived_pointer_value(*derived_loc), intptr_t(*base_loc), p2i(base_loc), offset ); } @@ -959,7 +959,7 @@ void DerivedPointerTable::update_pointers() { if (TraceDerivedPointers) { tty->print_cr("Updating derived pointer@" INTPTR_FORMAT - " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")", + " - Derived: " INTPTR_FORMAT " Base: " INTPTR_FORMAT " (Offset: %zd)", p2i(derived_loc), derived_pointer_value(*derived_loc), p2i(base), offset); } diff --git a/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp b/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp index e8642e59cb4a4..553ba53c67fca 100644 --- a/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp +++ b/src/hotspot/share/gc/g1/g1HeapSizingPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -259,7 +259,7 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) { log_debug(gc, ergo, heap)("Attempt heap expansion (capacity lower than min desired capacity). " "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B " - "min_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)", + "min_desired_capacity: " SIZE_FORMAT "B (%zu %%)", capacity_after_gc, used_after_gc, _g1h->used(), minimum_desired_capacity, MinHeapFreeRatio); expand = true; @@ -271,7 +271,7 @@ size_t G1HeapSizingPolicy::full_collection_resize_amount(bool& expand) { log_debug(gc, ergo, heap)("Attempt heap shrinking (capacity higher than max desired capacity). " "Capacity: " SIZE_FORMAT "B occupancy: " SIZE_FORMAT "B live: " SIZE_FORMAT "B " - "maximum_desired_capacity: " SIZE_FORMAT "B (" UINTX_FORMAT " %%)", + "maximum_desired_capacity: " SIZE_FORMAT "B (%zu %%)", capacity_after_gc, used_after_gc, _g1h->used(), maximum_desired_capacity, MaxHeapFreeRatio); expand = false; diff --git a/src/hotspot/share/gc/g1/g1InitLogger.cpp b/src/hotspot/share/gc/g1/g1InitLogger.cpp index 2f5753f9ff6a5..04e0a9a0f2bc7 100644 --- a/src/hotspot/share/gc/g1/g1InitLogger.cpp +++ b/src/hotspot/share/gc/g1/g1InitLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -45,7 +45,7 @@ void G1InitLogger::print_gc_specific() { // Print a message about periodic GC configuration. if (G1PeriodicGCInterval != 0) { log_info_p(gc, init)("Periodic GC: Enabled"); - log_info_p(gc, init)("Periodic GC Interval: " UINTX_FORMAT "ms", G1PeriodicGCInterval); + log_info_p(gc, init)("Periodic GC Interval: %zums", G1PeriodicGCInterval); } else { log_info_p(gc, init)("Periodic GC: Disabled"); } diff --git a/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp b/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp index fea7c2f3c8687..dee1c119857d5 100644 --- a/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp +++ b/src/hotspot/share/gc/g1/g1PeriodicGCTask.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -48,7 +48,7 @@ bool G1PeriodicGCTask::should_start_periodic_gc(G1CollectedHeap* g1h, // Check if enough time has passed since the last GC. uintx time_since_last_gc = (uintx)g1h->time_since_last_collection().milliseconds(); if ((time_since_last_gc < G1PeriodicGCInterval)) { - log_debug(gc, periodic)("Last GC occurred " UINTX_FORMAT "ms before which is below threshold " UINTX_FORMAT "ms. Skipping.", + log_debug(gc, periodic)("Last GC occurred %zums before which is below threshold %zums. Skipping.", time_since_last_gc, G1PeriodicGCInterval); return false; } diff --git a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp index 0a29caed8ccd8..0442cac470c52 100644 --- a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp +++ b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.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 @@ -123,8 +123,8 @@ JVMFlag::Error G1MaxNewSizePercentConstraintFunc(uint value, bool verbose) { JVMFlag::Error MaxGCPauseMillisConstraintFuncG1(uintx value, bool verbose) { if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) { JVMFlag::printError(verbose, - "MaxGCPauseMillis (" UINTX_FORMAT ") must be " - "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n", + "MaxGCPauseMillis (%zu) must be " + "less than GCPauseIntervalMillis (%zu)\n", value, GCPauseIntervalMillis); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -137,7 +137,7 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose) if (FLAG_IS_CMDLINE(GCPauseIntervalMillis)) { if (value < 1) { JVMFlag::printError(verbose, - "GCPauseIntervalMillis (" UINTX_FORMAT ") must be " + "GCPauseIntervalMillis (%zu) must be " "greater than or equal to 1\n", value); return JVMFlag::VIOLATES_CONSTRAINT; @@ -152,8 +152,8 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose) if (value <= MaxGCPauseMillis) { JVMFlag::printError(verbose, - "GCPauseIntervalMillis (" UINTX_FORMAT ") must be " - "greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n", + "GCPauseIntervalMillis (%zu) must be " + "greater than MaxGCPauseMillis (%zu)\n", value, MaxGCPauseMillis); return JVMFlag::VIOLATES_CONSTRAINT; } diff --git a/src/hotspot/share/gc/shared/ageTable.cpp b/src/hotspot/share/gc/shared/ageTable.cpp index 28f17a4220b89..17fc19e3b913a 100644 --- a/src/hotspot/share/gc/shared/ageTable.cpp +++ b/src/hotspot/share/gc/shared/ageTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -35,7 +35,7 @@ #include "utilities/copy.hpp" #include "logging/logStream.hpp" -/* Copyright (c) 1992, 2024, Oracle and/or its affiliates, and Stanford University. +/* Copyright (c) 1992, 2025, Oracle and/or its affiliates, and Stanford University. See the LICENSE file for license information. */ AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) { @@ -108,7 +108,7 @@ uint AgeTable::compute_tenuring_threshold(size_t desired_survivor_size) { } - log_debug(gc, age)("Desired survivor size %zu bytes, new threshold " UINTX_FORMAT " (max threshold %u)", + log_debug(gc, age)("Desired survivor size %zu bytes, new threshold %zu (max threshold %u)", desired_survivor_size * oopSize, (uintx) result, MaxTenuringThreshold); return result; diff --git a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp index cb36962e61e58..2ab5f330e734c 100644 --- a/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp +++ b/src/hotspot/share/gc/shared/jvmFlagConstraintsGC.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 @@ -99,8 +99,8 @@ JVMFlag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) { JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) { if (value > MaxHeapFreeRatio) { JVMFlag::printError(verbose, - "MinHeapFreeRatio (" UINTX_FORMAT ") must be " - "less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n", + "MinHeapFreeRatio (%zu) must be " + "less than or equal to MaxHeapFreeRatio (%zu)\n", value, MaxHeapFreeRatio); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -111,8 +111,8 @@ JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) { JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) { if (value < MinHeapFreeRatio) { JVMFlag::printError(verbose, - "MaxHeapFreeRatio (" UINTX_FORMAT ") must be " - "greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n", + "MaxHeapFreeRatio (%zu) must be " + "greater than or equal to MinHeapFreeRatio (%zu)\n", value, MinHeapFreeRatio); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -125,7 +125,7 @@ static JVMFlag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, JVMFlag::printError(verbose, "Desired lifetime of SoftReferences cannot be expressed correctly. " "MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB " - "(" INTX_FORMAT ") is too large\n", + "(%zd) is too large\n", maxHeap, softRef); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -357,7 +357,7 @@ JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) { // Compare with 'max_uintx' as ThreadLocalAllocBuffer::_refill_waste_limit is 'size_t'. if (refill_waste_limit > (max_uintx - value)) { JVMFlag::printError(verbose, - "TLABWasteIncrement (" UINTX_FORMAT ") must be " + "TLABWasteIncrement (%zu) must be " "less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n", value, (max_uintx - refill_waste_limit)); return JVMFlag::VIOLATES_CONSTRAINT; @@ -370,7 +370,7 @@ JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) { if (FLAG_IS_CMDLINE(SurvivorRatio) && (value > (MaxHeapSize / SpaceAlignment))) { JVMFlag::printError(verbose, - "SurvivorRatio (" UINTX_FORMAT ") must be " + "SurvivorRatio (%zu) must be " "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n", value, (MaxHeapSize / SpaceAlignment)); diff --git a/src/hotspot/share/gc/shared/oopStorage.cpp b/src/hotspot/share/gc/shared/oopStorage.cpp index 2373d6b1d93a8..15ae2cf863254 100644 --- a/src/hotspot/share/gc/shared/oopStorage.cpp +++ b/src/hotspot/share/gc/shared/oopStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -323,7 +323,7 @@ void OopStorage::Block::atomic_add_allocated(uintx add) { // facto verifies the precondition held; if there were any set bits in // common, then after the add at least one of them will be zero. uintx sum = Atomic::add(&_allocated_bitmask, add); - assert((sum & add) == add, "some already present: " UINTX_FORMAT ":" UINTX_FORMAT, + assert((sum & add) == add, "some already present: %zu:%zu", sum, add); } diff --git a/src/hotspot/share/gc/shared/workerPolicy.cpp b/src/hotspot/share/gc/shared/workerPolicy.cpp index 4ab178dd6a70f..a2b33e42f071a 100644 --- a/src/hotspot/share/gc/shared/workerPolicy.cpp +++ b/src/hotspot/share/gc/shared/workerPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -130,9 +130,9 @@ uint WorkerPolicy::calc_default_active_workers(uintx total_workers, assert(new_active_workers <= total_workers, "Total workers not observed"); log_trace(gc, task)("WorkerPolicy::calc_default_active_workers() : " - "active_workers(): " UINTX_FORMAT " new_active_workers: " UINTX_FORMAT " " - "prev_active_workers: " UINTX_FORMAT "\n" - " active_workers_by_JT: " UINTX_FORMAT " active_workers_by_heap_size: " UINTX_FORMAT, + "active_workers(): %zu new_active_workers: %zu " + "prev_active_workers: %zu\n" + " active_workers_by_JT: %zu active_workers_by_heap_size: %zu", active_workers, new_active_workers, prev_active_workers, active_workers_by_JT, active_workers_by_heap_size); assert(new_active_workers > 0, "Always need at least 1"); diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp index c2ad809f43a2f..9ea07ee650dfc 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp @@ -194,7 +194,7 @@ bool ShenandoahHeuristics::should_start_gc() { if (_guaranteed_gc_interval > 0) { double last_time_ms = (os::elapsedTime() - _last_cycle_end) * 1000; if (last_time_ms > _guaranteed_gc_interval) { - log_trigger("Time since last GC (%.0f ms) is larger than guaranteed interval (" UINTX_FORMAT " ms)", + log_trigger("Time since last GC (%.0f ms) is larger than guaranteed interval (%zu ms)", last_time_ms, _guaranteed_gc_interval); return true; } @@ -209,7 +209,7 @@ bool ShenandoahHeuristics::should_degenerate_cycle() { void ShenandoahHeuristics::adjust_penalty(intx step) { assert(0 <= _gc_time_penalties && _gc_time_penalties <= 100, - "In range before adjustment: " INTX_FORMAT, _gc_time_penalties); + "In range before adjustment: %zd", _gc_time_penalties); intx new_val = _gc_time_penalties + step; if (new_val < 0) { @@ -221,7 +221,7 @@ void ShenandoahHeuristics::adjust_penalty(intx step) { _gc_time_penalties = new_val; assert(0 <= _gc_time_penalties && _gc_time_penalties <= 100, - "In range after adjustment: " INTX_FORMAT, _gc_time_penalties); + "In range after adjustment: %zd", _gc_time_penalties); } void ShenandoahHeuristics::log_trigger(const char* fmt, ...) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp index 7c574a9d0dd7e..2d3b1935657f1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp @@ -247,7 +247,7 @@ void ShenandoahAgeCensus::update_tenuring_threshold() { _tenuring_threshold[_epoch] = tt; } print(); - log_trace(gc, age)("New tenuring threshold " UINTX_FORMAT " (min " UINTX_FORMAT ", max " UINTX_FORMAT")", + log_trace(gc, age)("New tenuring threshold %zu (min %zu, max %zu)", (uintx) _tenuring_threshold[_epoch], ShenandoahGenerationalMinTenuringAge, ShenandoahGenerationalMaxTenuringAge); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp index d9cec36e6c9c7..b8fb6a34c0168 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp @@ -48,7 +48,7 @@ class ThreadTimeAccumulator : public ThreadClosure { size_t total_time; ThreadTimeAccumulator() : total_time(0) {} void do_thread(Thread* thread) override { - assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: " UINTX_FORMAT, thread->osthread()->thread_id_for_printing()); + assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: %zu", thread->osthread()->thread_id_for_printing()); total_time += os::thread_cpu_time(thread); } }; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index bde8638140b52..7f08e0c3067d5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -801,7 +801,7 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, // Avoid side-effect of changing workers' active thread count, but bypass concurrent/parallel protocol check ShenandoahPushWorkerScope verify_worker_scope(_heap->workers(), _heap->max_workers(), false /*bypass check*/); - log_info(gc,start)("Verify %s, Level " INTX_FORMAT, label, ShenandoahVerifyLevel); + log_info(gc,start)("Verify %s, Level %zd", label, ShenandoahVerifyLevel); // GC state checks { @@ -1034,7 +1034,7 @@ void ShenandoahVerifier::verify_at_safepoint(const char* label, log_debug(gc)("Safepoint verification finished accumulation of liveness data"); - log_info(gc)("Verify %s, Level " INTX_FORMAT " (" SIZE_FORMAT " reachable, " SIZE_FORMAT " marked)", + log_info(gc)("Verify %s, Level %zd (" SIZE_FORMAT " reachable, " SIZE_FORMAT " marked)", label, ShenandoahVerifyLevel, count_reachable, count_marked); FREE_C_HEAP_ARRAY(ShenandoahLivenessData, ld); diff --git a/src/hotspot/share/gc/z/zPhysicalMemory.cpp b/src/hotspot/share/gc/z/zPhysicalMemory.cpp index a04fce2d9a9d8..497d6af9af53a 100644 --- a/src/hotspot/share/gc/z/zPhysicalMemory.cpp +++ b/src/hotspot/share/gc/z/zPhysicalMemory.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 @@ -277,7 +277,7 @@ void ZPhysicalMemoryManager::try_enable_uncommit(size_t min_capacity, size_t max } log_info_p(gc, init)("Uncommit: Enabled"); - log_info_p(gc, init)("Uncommit Delay: " UINTX_FORMAT "s", ZUncommitDelay); + log_info_p(gc, init)("Uncommit Delay: %zus", ZUncommitDelay); } void ZPhysicalMemoryManager::alloc(ZPhysicalMemory& pmem, size_t size) { diff --git a/src/hotspot/share/gc/z/zVerify.cpp b/src/hotspot/share/gc/z/zVerify.cpp index 03b50e110e4c4..791d897608c8d 100644 --- a/src/hotspot/share/gc/z/zVerify.cpp +++ b/src/hotspot/share/gc/z/zVerify.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 @@ -515,7 +515,7 @@ static ZStoreBarrierBufferTable* z_verify_store_barrier_buffer_table = nullptr; #define BAD_REMSET_ARG(p, ptr, addr) \ "Missing remembered set at " PTR_FORMAT " pointing at " PTR_FORMAT \ - " (" PTR_FORMAT " + " INTX_FORMAT ")" \ + " (" PTR_FORMAT " + %zd)" \ , p2i(p), untype(ptr), untype(addr), p2i(p) - untype(addr) class ZVerifyRemsetBeforeOopClosure : public BasicOopIterateClosure { diff --git a/src/hotspot/share/interpreter/bytecodeTracer.cpp b/src/hotspot/share/interpreter/bytecodeTracer.cpp index cdb53b62f8c40..ba8230719a971 100644 --- a/src/hotspot/share/interpreter/bytecodeTracer.cpp +++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -105,7 +105,7 @@ class BytecodePrinter { // the incoming method. We could lose a line of trace output. // This is acceptable in a debug-only feature. st->cr(); - st->print("[" UINTX_FORMAT "] ", Thread::current()->osthread()->thread_id_for_printing()); + st->print("[%zu] ", Thread::current()->osthread()->thread_id_for_printing()); method->print_name(st); st->cr(); _current_method = method(); @@ -128,7 +128,7 @@ class BytecodePrinter { code == Bytecodes::_return_register_finalizer || (code >= Bytecodes::_ireturn && code <= Bytecodes::_return)) { int bci = (int)(bcp - method->code_base()); - st->print("[" UINTX_FORMAT "] ", Thread::current()->osthread()->thread_id_for_printing()); + st->print("[%zu] ", Thread::current()->osthread()->thread_id_for_printing()); if (Verbose) { st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s", BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code)); diff --git a/src/hotspot/share/interpreter/invocationCounter.cpp b/src/hotspot/share/interpreter/invocationCounter.cpp index 6793ff039e060..4db1576c89f5f 100644 --- a/src/hotspot/share/interpreter/invocationCounter.cpp +++ b/src/hotspot/share/interpreter/invocationCounter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -61,7 +61,7 @@ void InvocationCounter::reset() { void InvocationCounter::print() { uint counter = raw_counter(); - tty->print_cr("invocation count: up = %d, limit = " INTX_FORMAT ", carry = %s", + tty->print_cr("invocation count: up = %d, limit = %zd, carry = %s", extract_count(counter), limit(), extract_carry(counter) ? "true" : "false"); } diff --git a/src/hotspot/share/jvmci/jvmci.cpp b/src/hotspot/share/jvmci/jvmci.cpp index 9442c241e1637..b987d5246ae2b 100644 --- a/src/hotspot/share/jvmci/jvmci.cpp +++ b/src/hotspot/share/jvmci/jvmci.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 @@ -380,7 +380,7 @@ void JVMCI::fatal_log(const char* buf, size_t count) { _fatal_log_fd = log_fd; } else if (_first_error_tid != current_thread_id) { // This is not the first thread reporting a libjvmci error - tty->print_cr("[thread " INTX_FORMAT " also had an error in the JVMCI native library]", + tty->print_cr("[thread %zd also had an error in the JVMCI native library]", current_thread_id); // Fatal error reporting is single threaded so just block this thread. diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index ac972e97b1b6f..6a22e360700b9 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -1008,7 +1008,7 @@ static void _fatal() { } } intx current_thread_id = os::current_thread_id(); - fatal("thread " INTX_FORMAT ": Fatal error in JVMCI shared library", current_thread_id); + fatal("thread %zd: Fatal error in JVMCI shared library", current_thread_id); } JVMCIRuntime::JVMCIRuntime(JVMCIRuntime* next, int id, bool for_compile_broker) : diff --git a/src/hotspot/share/logging/logAsyncWriter.hpp b/src/hotspot/share/logging/logAsyncWriter.hpp index 97bae2a581745..4d18e61211063 100644 --- a/src/hotspot/share/logging/logAsyncWriter.hpp +++ b/src/hotspot/share/logging/logAsyncWriter.hpp @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 @@ -176,7 +176,7 @@ class AsyncLogWriter : public NonJavaThread { void run() override; void pre_run() override { NonJavaThread::pre_run(); - log_debug(logging, thread)("starting AsyncLog Thread tid = " INTX_FORMAT, os::current_thread_id()); + log_debug(logging, thread)("starting AsyncLog Thread tid = %zd", os::current_thread_id()); } const char* type_name() const override { return "AsyncLogWriter"; } void print_on(outputStream* st) const override { diff --git a/src/hotspot/share/logging/logDecorations.cpp b/src/hotspot/share/logging/logDecorations.cpp index 058bd7ab2aad0..6eb0fbde76605 100644 --- a/src/hotspot/share/logging/logDecorations.cpp +++ b/src/hotspot/share/logging/logDecorations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, 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 @@ -127,7 +127,7 @@ void LogDecorations::print_pid_decoration(outputStream* st) const { } void LogDecorations::print_tid_decoration(outputStream* st) const { - st->print(INTX_FORMAT, _tid); + st->print("%zd", _tid); } void LogDecorations::print_level_decoration(outputStream* st) const { diff --git a/src/hotspot/share/memory/heapInspection.cpp b/src/hotspot/share/memory/heapInspection.cpp index bf9deb530f03a..80a27e1fca216 100644 --- a/src/hotspot/share/memory/heapInspection.cpp +++ b/src/hotspot/share/memory/heapInspection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -592,7 +592,7 @@ void HeapInspection::heap_inspection(outputStream* st, WorkerThreads* workers) { // populate table with object allocation info uintx missed_count = populate_table(&cit, nullptr, workers); if (missed_count != 0) { - log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted " UINTX_FORMAT + log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted %zu" " total instances in data below", missed_count); } diff --git a/src/hotspot/share/memory/memoryReserver.cpp b/src/hotspot/share/memory/memoryReserver.cpp index d68736c7f2ab3..7ae767fa9da0d 100644 --- a/src/hotspot/share/memory/memoryReserver.cpp +++ b/src/hotspot/share/memory/memoryReserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -516,7 +516,7 @@ static ReservedSpace establish_noaccess_prefix(const ReservedSpace& reserved, si fatal("cannot protect protection page"); } log_debug(gc, heap, coops)("Protected page at the reserved heap base: " - PTR_FORMAT " / " INTX_FORMAT " bytes", + PTR_FORMAT " / %zd bytes", p2i(reserved.base()), noaccess_prefix); assert(CompressedOops::use_implicit_null_checks() == true, "not initialized?"); diff --git a/src/hotspot/share/memory/metaspace/internalStats.cpp b/src/hotspot/share/memory/metaspace/internalStats.cpp index d7b0e4495051e..54ee04446d0df 100644 --- a/src/hotspot/share/memory/metaspace/internalStats.cpp +++ b/src/hotspot/share/memory/metaspace/internalStats.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -41,7 +41,7 @@ void InternalStats::print_on(outputStream* st) { #define xstr(s) str(s) #define str(s) #s -#define PRINT_COUNTER(name) st->print_cr("%s: " UINTX_FORMAT ".", xstr(name), _##name); +#define PRINT_COUNTER(name) st->print_cr("%s: %zu.", xstr(name), _##name); ALL_MY_COUNTERS(PRINT_COUNTER, PRINT_COUNTER) #undef PRINT_COUNTER diff --git a/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp b/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp index aec656201fe81..c40bdc6bacf9e 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -162,9 +162,9 @@ const char* classes_plural(uintx num) { } void print_number_of_classes(outputStream* out, uintx classes, uintx classes_shared) { - out->print(UINTX_FORMAT " %s", classes, classes_plural(classes)); + out->print("%zu %s", classes, classes_plural(classes)); if (classes_shared > 0) { - out->print(" (" UINTX_FORMAT " shared)", classes_shared); + out->print(" (%zu shared)", classes_shared); } } diff --git a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp index cbd2400444ff0..24c3ad0a65467 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceReporter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -218,7 +218,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) { uintx num_loaders = cl._num_loaders_by_spacetype[space_type]; uintx num_classes = cl._num_classes_by_spacetype[space_type]; - out->print("%s - " UINTX_FORMAT " %s", + out->print("%s - %zu %s", describe_spacetype((Metaspace::MetaspaceType)space_type), num_loaders, loaders_plural(num_loaders)); if (num_classes > 0) { @@ -239,7 +239,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) out->cr(); { uintx num_loaders = cl._num_loaders; - out->print("Total Usage - " UINTX_FORMAT " %s, ", + out->print("Total Usage - %zu %s, ", num_loaders, loaders_plural(num_loaders)); print_number_of_classes(out, cl._num_classes, cl._num_classes_shared); out->print(":"); @@ -360,7 +360,7 @@ void MetaspaceReporter::print_report(outputStream* out, size_t scale, int flags) cl._stats_total._arena_stats_class._free_blocks_word_size; out->print("Deallocated from chunks in use: "); print_scaled_words_and_percentage(out, free_blocks_cap_words, committed_words, scale, 6); - out->print(" (" UINTX_FORMAT " blocks)", free_blocks_num); + out->print(" (%zu blocks)", free_blocks_num); out->cr(); // Print total waste. diff --git a/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp b/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp index 32329831e7cc5..6461579106b1b 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp +++ b/src/hotspot/share/memory/metaspace/metaspaceStatistics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -174,13 +174,13 @@ void ArenaStats::print_on(outputStream* st, size_t scale, bool detailed) const } if (_free_blocks_num > 0) { st->cr_indent(); - st->print("deallocated: " UINTX_FORMAT " blocks with ", _free_blocks_num); + st->print("deallocated: %zu blocks with ", _free_blocks_num); print_scaled_words(st, _free_blocks_word_size, scale); } } else { totals().print_on(st, scale); st->print(", "); - st->print("deallocated: " UINTX_FORMAT " blocks with ", _free_blocks_num); + st->print("deallocated: %zu blocks with ", _free_blocks_num); print_scaled_words(st, _free_blocks_word_size, scale); } } diff --git a/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp b/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp index 100a009ca8738..b3b5ca001d66b 100644 --- a/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp +++ b/src/hotspot/share/memory/metaspace/printCLDMetaspaceInfoClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -106,7 +106,7 @@ void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) { // Optionally, print if (_do_print) { - _out->print(UINTX_FORMAT_W(4) ": ", _num_loaders); + _out->print("%4zu: ", _num_loaders); // Print "CLD for [,] instance of " // or "CLD for , loaded by [,] instance of " diff --git a/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp b/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp index ce975d673f1bc..ae9e928e67f47 100644 --- a/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp +++ b/src/hotspot/share/memory/metaspace/printMetaspaceInfoKlassClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, SAP and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -38,7 +38,7 @@ PrintMetaspaceInfoKlassClosure::PrintMetaspaceInfoKlassClosure(outputStream* out void PrintMetaspaceInfoKlassClosure::do_klass(Klass* k) { _cnt++; _out->cr_indent(); - _out->print(UINTX_FORMAT_W(4) ": ", _cnt); + _out->print("%4zu: ", _cnt); // Print a 's' for shared classes _out->put(k->is_shared() ? 's': ' '); diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index d8a3ff820dbe9..bf702640bd421 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -371,7 +371,7 @@ void Universe::serialize(SerializeClosure* f) { void Universe::check_alignment(uintx size, uintx alignment, const char* name) { if (size < alignment || size % alignment != 0) { vm_exit_during_initialization( - err_msg("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment)); + err_msg("Size of %s (%zu bytes) must be aligned to %zu bytes", name, size, alignment)); } } diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 8f1a4569e222b..8f9eb627fc63c 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -195,7 +195,7 @@ static void print_thread_details(uintx thread_id, const char* name, outputStream // avoid commas and spaces in output to ease post-processing via awk char tmp[64]; stringStream ss(tmp, sizeof(tmp)); - ss.print(":" UINTX_FORMAT "-%s", (uintx)thread_id, name); + ss.print(":%zu-%s", (uintx)thread_id, name); for (int i = 0; tmp[i] != '\0'; i++) { if (!isalnum(tmp[i])) { tmp[i] = '-'; diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index ce46da55f986b..16feac692fd45 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -3654,7 +3654,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(" "); } } - if (n >= MaxSubklassPrintSize) st->print("(" INTX_FORMAT " more klasses...)", n - MaxSubklassPrintSize); + if (n >= MaxSubklassPrintSize) st->print("(%zd more klasses...)", n - MaxSubklassPrintSize); st->cr(); if (is_interface()) { @@ -3692,7 +3692,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"secondary supers: "); secondary_supers()->print_value_on(st); st->cr(); st->print(BULLET"hash_slot: %d", hash_slot()); st->cr(); - st->print(BULLET"secondary bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap); st->cr(); + st->print(BULLET"secondary bitmap: " LP64_ONLY("0x%016zu") NOT_LP64("0x%08zu"), _secondary_supers_bitmap); st->cr(); if (secondary_supers() != nullptr) { if (Verbose) { diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index 884816764a079..9564db6a22df2 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1305,7 +1305,7 @@ static void print_negative_lookup_stats(uintx bitmap, outputStream* st) { void Klass::print_secondary_supers_on(outputStream* st) const { if (secondary_supers() != nullptr) { st->print(" - "); st->print("%d elements;", _secondary_supers->length()); - st->print_cr(" bitmap: " UINTX_FORMAT_X_0 ";", _secondary_supers_bitmap); + st->print_cr(" bitmap: " LP64_ONLY("0x%016zu") NOT_LP64("0x%08zu"), _secondary_supers_bitmap); if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY && _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) { st->print(" - "); print_positive_lookup_stats(secondary_supers(), diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp index d0b29a4a30992..f5170882fe30f 100644 --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1021,7 +1021,7 @@ void Method::print_made_not_compilable(int comp_level, bool is_osr, bool report, } if ((TraceDeoptimization || LogCompilation) && (xtty != nullptr)) { ttyLocker ttyl; - xtty->begin_elem("make_not_compilable thread='" UINTX_FORMAT "' osr='%d' level='%d'", + xtty->begin_elem("make_not_compilable thread='%zu' osr='%d' level='%d'", os::current_thread_id(), is_osr, comp_level); if (reason != nullptr) { xtty->print(" reason=\'%s\'", reason); diff --git a/src/hotspot/share/opto/idealGraphPrinter.cpp b/src/hotspot/share/opto/idealGraphPrinter.cpp index 42726a34d015e..851d9f449fa88 100644 --- a/src/hotspot/share/opto/idealGraphPrinter.cpp +++ b/src/hotspot/share/opto/idealGraphPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -210,7 +210,7 @@ void IdealGraphPrinter::end_head() { void IdealGraphPrinter::print_attr(const char *name, intptr_t val) { stringStream stream; - stream.print(INTX_FORMAT, val); + stream.print("%zd", val); print_attr(name, stream.freeze()); } @@ -945,7 +945,7 @@ void IdealGraphPrinter::init_network_stream() { } else { // It would be nice if we could shut down cleanly but it should // be an error if we can't connect to the visualizer. - fatal("Couldn't connect to visualizer at %s:" INTX_FORMAT, + fatal("Couldn't connect to visualizer at %s:%zd", PrintIdealGraphAddress, PrintIdealGraphPort); } } diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index ad351fb81add7..9f166336ff38c 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -5194,7 +5194,7 @@ bool InitializeNode::stores_are_sane(PhaseValues* phase) { intptr_t st_off = get_store_offset(st, phase); if (st_off < 0) continue; // ignore dead garbage if (last_off > st_off) { - tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off); + tty->print_cr("*** bad store offset at %d: %zd > %zd", i, last_off, st_off); this->dump(2); assert(false, "ascending store offsets"); return false; diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp index c68692a2fa1f9..d53437939183b 100644 --- a/src/hotspot/share/prims/jvmtiExport.cpp +++ b/src/hotspot/share/prims/jvmtiExport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -1250,7 +1250,7 @@ void JvmtiExport::post_raw_breakpoint(JavaThread *thread, Method* method, addres if (!ets->breakpoint_posted() && ets->is_enabled(JVMTI_EVENT_BREAKPOINT)) { ThreadState old_os_state = thread->osthread()->get_state(); thread->osthread()->set_state(BREAKPOINTED); - EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("[%s] Evt Breakpoint sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("[%s] Evt Breakpoint sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -1996,7 +1996,7 @@ void JvmtiExport::post_single_step(JavaThread *thread, Method* method, address l for (JvmtiEnvThreadState* ets = it.first(); ets != nullptr; ets = it.next(ets)) { ets->compare_and_set_current_location(mh(), location, JVMTI_EVENT_SINGLE_STEP); if (!ets->single_stepping_posted() && ets->is_enabled(JVMTI_EVENT_SINGLE_STEP)) { - EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("[%s] Evt Single Step sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("[%s] Evt Single Step sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -2043,7 +2043,7 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre if (ets->is_enabled(JVMTI_EVENT_EXCEPTION) && (exception != nullptr)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION, - ("[%s] Evt Exception thrown sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt Exception thrown sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -2119,7 +2119,7 @@ void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* met return; } EVT_TRIG_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("[%s] Trg unwind_due_to_exception triggered %s.%s @ %s" INTX_FORMAT " - %s", + ("[%s] Trg unwind_due_to_exception triggered %s.%s @ %s%zd - %s", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -2159,7 +2159,7 @@ void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* met for (JvmtiEnvThreadState* ets = it.first(); ets != nullptr; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_EXCEPTION_CATCH) && (exception_handle() != nullptr)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("[%s] Evt ExceptionCatch sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt ExceptionCatch sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -2243,7 +2243,7 @@ void JvmtiExport::post_field_access(JavaThread *thread, Method* method, JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != nullptr; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_ACCESS)) { - EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("[%s] Evt Field Access event sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("[%s] Evt Field Access event sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), @@ -2401,7 +2401,7 @@ void JvmtiExport::post_field_modification(JavaThread *thread, Method* method, for (JvmtiEnvThreadState* ets = it.first(); ets != nullptr; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_MODIFICATION)) { EVT_TRACE(JVMTI_EVENT_FIELD_MODIFICATION, - ("[%s] Evt Field Modification event sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt Field Modification event sent %s.%s @ %zd", JvmtiTrace::safe_get_thread_name(thread), (mh() == nullptr) ? "null" : mh()->klass_name()->as_C_string(), (mh() == nullptr) ? "null" : mh()->name()->as_C_string(), diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index ca4364d1181cd..88e409f2d3ab0 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1731,7 +1731,7 @@ jint Arguments::set_aggressive_opts_flags() { } // Feed the cache size setting into the JDK char buffer[1024]; - jio_snprintf(buffer, 1024, "java.lang.Integer.IntegerCache.high=" INTX_FORMAT, AutoBoxCacheMax); + jio_snprintf(buffer, 1024, "java.lang.Integer.IntegerCache.high=%zd", AutoBoxCacheMax); if (!add_property(buffer)) { return JNI_ENOMEM; } diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 1558f3c9bcece..122f3506082da 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -271,7 +271,7 @@ void Deoptimization::UnrollBlock::print() { st.print_cr(" size_of_deoptimized_frame = %d", _size_of_deoptimized_frame); st.print( " frame_sizes: "); for (int index = 0; index < number_of_frames(); index++) { - st.print(INTX_FORMAT " ", frame_sizes()[index]); + st.print("%zd ", frame_sizes()[index]); } st.cr(); tty->print_raw(st.freeze()); @@ -1768,7 +1768,7 @@ void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deopt assert(nm != nullptr, "only compiled methods can deopt"); ttyLocker ttyl; - xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc())); + xtty->begin_head("deoptimized thread='%zu' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc())); nm->log_identity(xtty); xtty->end_head(); for (ScopeDesc* sd = nm->scope_desc_at(fr.pc()); ; sd = sd->sender()) { @@ -2137,7 +2137,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* current, jint tr char buf[100]; if (xtty != nullptr) { - xtty->begin_head("uncommon_trap thread='" UINTX_FORMAT "' %s", + xtty->begin_head("uncommon_trap thread='%zu' %s", os::current_thread_id(), format_trap_request(buf, sizeof(buf), trap_request)); #if INCLUDE_JVMCI @@ -2201,7 +2201,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* current, jint tr } } #endif - st.print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"), + st.print(" (@" INTPTR_FORMAT ") thread=%zu reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"), p2i(fr.pc()), os::current_thread_id(), trap_reason_name(reason), diff --git a/src/hotspot/share/runtime/flags/jvmFlag.cpp b/src/hotspot/share/runtime/flags/jvmFlag.cpp index c465a942e5c68..29b342881f118 100644 --- a/src/hotspot/share/runtime/flags/jvmFlag.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlag.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -209,9 +209,9 @@ void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) co } else if (is_uint()) { st->print("%u", get_uint()); } else if (is_intx()) { - st->print(INTX_FORMAT, get_intx()); + st->print("%zd", get_intx()); } else if (is_uintx()) { - st->print(UINTX_FORMAT, get_uintx()); + st->print("%zu", get_uintx()); } else if (is_uint64_t()) { st->print(UINT64_FORMAT, get_uint64_t()); } else if (is_size_t()) { @@ -411,9 +411,9 @@ void JVMFlag::print_as_flag(outputStream* st) const { } else if (is_uint()) { st->print("-XX:%s=%u", _name, get_uint()); } else if (is_intx()) { - st->print("-XX:%s=" INTX_FORMAT, _name, get_intx()); + st->print("-XX:%s=%zd", _name, get_intx()); } else if (is_uintx()) { - st->print("-XX:%s=" UINTX_FORMAT, _name, get_uintx()); + st->print("-XX:%s=%zu", _name, get_uintx()); } else if (is_uint64_t()) { st->print("-XX:%s=" UINT64_FORMAT, _name, get_uint64_t()); } else if (is_size_t()) { diff --git a/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp b/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp index 843ee24c90951..fc3250158a457 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagAccess.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -187,18 +187,18 @@ class FlagAccessImpl_intx : public RangedFlagAccessImplprint("[ " INTX_FORMAT_W(-25) " ... " INTX_FORMAT_W(25) " ]", min, max); + st->print("[ %-25zd ... %25zd ]", min, max); } void print_default_range(outputStream* st) const { - st->print("[ " INTX_FORMAT_W(-25) " ... " INTX_FORMAT_W(25) " ]", min_intx, max_intx); + st->print("[ %-25zd ... %25zd ]", min_intx, max_intx); } }; @@ -206,18 +206,18 @@ class FlagAccessImpl_uintx : public RangedFlagAccessImplprint("[ " UINTX_FORMAT_W(-25) " ... " UINTX_FORMAT_W(25) " ]", min, max); + st->print("[ %-25zu ... %25zu ]", min, max); } void print_default_range(outputStream* st) const { - st->print("[ " UINTX_FORMAT_W(-25) " ... " UINTX_FORMAT_W(25) " ]", uintx(0), max_uintx); + st->print("[ %-25zu ... %25zu ]", uintx(0), max_uintx); } }; diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp index ad2e755e69868..65e2f6b946b05 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.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 @@ -50,7 +50,7 @@ JVMFlag::Error CICompilerCountConstraintFunc(intx value, bool verbose) { #else if (value > 0) { JVMFlag::printError(verbose, - "CICompilerCount (" INTX_FORMAT ") cannot be " + "CICompilerCount (%zd) cannot be " "greater than 0 because there are no compilers\n", value); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -58,7 +58,7 @@ JVMFlag::Error CICompilerCountConstraintFunc(intx value, bool verbose) { if (value < (intx)min_number_of_compiler_threads) { JVMFlag::printError(verbose, - "CICompilerCount (" INTX_FORMAT ") must be " + "CICompilerCount (%zd) must be " "at least %d \n", value, min_number_of_compiler_threads); return JVMFlag::VIOLATES_CONSTRAINT; @@ -86,8 +86,8 @@ JVMFlag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) { #endif if (value < 0 || value > max_value) { JVMFlag::printError(verbose, - "AllocatePrefetchInstr (" INTX_FORMAT ") must be " - "between 0 and " INTX_FORMAT "\n", value, max_value); + "AllocatePrefetchInstr (%zd) must be " + "between 0 and %zd\n", value, max_value); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -97,7 +97,7 @@ JVMFlag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) { JVMFlag::Error CompileThresholdConstraintFunc(intx value, bool verbose) { if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) { JVMFlag::printError(verbose, - "CompileThreshold (" INTX_FORMAT ") " + "CompileThreshold (%zd) " "must be between 0 and %d\n", value, INT_MAX >> InvocationCounter::count_shift); @@ -123,8 +123,8 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) if (ProfileInterpreter) { if (value < InterpreterProfilePercentage) { JVMFlag::printError(verbose, - "OnStackReplacePercentage (" INTX_FORMAT ") must be " - "larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n", + "OnStackReplacePercentage (%zd) must be " + "larger than InterpreterProfilePercentage (%zd)\n", value, InterpreterProfilePercentage); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -132,7 +132,7 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) max_percentage_limit += InterpreterProfilePercentage; if (value > max_percentage_limit) { JVMFlag::printError(verbose, - "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", + "OnStackReplacePercentage (%zd) must be between 0 and " INT64_FORMAT "\n", value, max_percentage_limit); return JVMFlag::VIOLATES_CONSTRAINT; @@ -140,14 +140,14 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) } else { if (value < 0) { JVMFlag::printError(verbose, - "OnStackReplacePercentage (" INTX_FORMAT ") must be " + "OnStackReplacePercentage (%zd) must be " "non-negative\n", value); return JVMFlag::VIOLATES_CONSTRAINT; } if (value > max_percentage_limit) { JVMFlag::printError(verbose, - "OnStackReplacePercentage (" INTX_FORMAT ") must be between 0 and " INT64_FORMAT "\n", + "OnStackReplacePercentage (%zd) must be between 0 and " INT64_FORMAT "\n", value, max_percentage_limit); return JVMFlag::VIOLATES_CONSTRAINT; @@ -159,8 +159,8 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) { JVMFlag::printError(verbose, - "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " - "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") " + "CodeCacheSegmentSize (%zu) must be " + "larger than or equal to CodeEntryAlignment (%zd) " "to align entry points\n", CodeCacheSegmentSize, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; @@ -168,7 +168,7 @@ JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { if (CodeCacheSegmentSize < sizeof(jdouble)) { JVMFlag::printError(verbose, - "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " + "CodeCacheSegmentSize (%zu) must be " "at least " SIZE_FORMAT " to align constants\n", CodeCacheSegmentSize, sizeof(jdouble)); return JVMFlag::VIOLATES_CONSTRAINT; @@ -177,8 +177,8 @@ JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { #ifdef COMPILER2 if (CodeCacheSegmentSize < (uintx)OptoLoopAlignment) { JVMFlag::printError(verbose, - "CodeCacheSegmentSize (" UINTX_FORMAT ") must be " - "larger than or equal to OptoLoopAlignment (" INTX_FORMAT ") " + "CodeCacheSegmentSize (%zu) must be " + "larger than or equal to OptoLoopAlignment (%zd) " "to align inner loops\n", CodeCacheSegmentSize, OptoLoopAlignment); return JVMFlag::VIOLATES_CONSTRAINT; @@ -191,14 +191,14 @@ JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) { JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) { if (!is_power_of_2(value)) { JVMFlag::printError(verbose, - "CodeEntryAlignment (" INTX_FORMAT ") must be " + "CodeEntryAlignment (%zd) must be " "a power of two\n", CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } if (CodeEntryAlignment < 16) { JVMFlag::printError(verbose, - "CodeEntryAlignment (" INTX_FORMAT ") must be " + "CodeEntryAlignment (%zd) must be " "greater than or equal to %d\n", CodeEntryAlignment, 16); return JVMFlag::VIOLATES_CONSTRAINT; @@ -206,8 +206,8 @@ JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) { if ((uintx)CodeEntryAlignment > CodeCacheSegmentSize) { JVMFlag::printError(verbose, - "CodeEntryAlignment (" INTX_FORMAT ") must be " - "less than or equal to CodeCacheSegmentSize (" UINTX_FORMAT ") " + "CodeEntryAlignment (%zd) must be " + "less than or equal to CodeCacheSegmentSize (%zu) " "to align entry points\n", CodeEntryAlignment, CodeCacheSegmentSize); return JVMFlag::VIOLATES_CONSTRAINT; @@ -219,7 +219,7 @@ JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) { JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { if (!is_power_of_2(value)) { JVMFlag::printError(verbose, - "OptoLoopAlignment (" INTX_FORMAT ") " + "OptoLoopAlignment (%zd) " "must be a power of two\n", value); return JVMFlag::VIOLATES_CONSTRAINT; @@ -229,7 +229,7 @@ JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { // addr_unit() == 1. if (OptoLoopAlignment % relocInfo::addr_unit() != 0) { JVMFlag::printError(verbose, - "OptoLoopAlignment (" INTX_FORMAT ") must be " + "OptoLoopAlignment (%zd) must be " "multiple of NOP size (%d)\n", value, relocInfo::addr_unit()); return JVMFlag::VIOLATES_CONSTRAINT; @@ -237,8 +237,8 @@ JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { if (OptoLoopAlignment > CodeEntryAlignment) { JVMFlag::printError(verbose, - "OptoLoopAlignment (" INTX_FORMAT ") must be " - "less or equal to CodeEntryAlignment (" INTX_FORMAT ")\n", + "OptoLoopAlignment (%zd) must be " + "less or equal to CodeEntryAlignment (%zd)\n", value, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -249,7 +249,7 @@ JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) { JVMFlag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose) { if (value >= 4032) { JVMFlag::printError(verbose, - "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be" + "ArraycopyDstPrefetchDistance (%zu) must be" "between 0 and 4031\n", value); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -271,7 +271,7 @@ JVMFlag::Error AVX3ThresholdConstraintFunc(int value, bool verbose) { JVMFlag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose) { if (value >= 4032) { JVMFlag::printError(verbose, - "ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be" + "ArraycopySrcPrefetchDistance (%zu) must be" "between 0 and 4031\n", value); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -322,7 +322,7 @@ JVMFlag::Error VerifyIterativeGVNConstraintFunc(uint value, bool verbose) { JVMFlag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose) { if (value % BytesPerLong != 0) { JVMFlag::printError(verbose, - "InitArrayShortSize (" INTX_FORMAT ") must be " + "InitArrayShortSize (%zd) must be " "a multiple of %d\n", value, BytesPerLong); return JVMFlag::VIOLATES_CONSTRAINT; } else { @@ -334,15 +334,15 @@ JVMFlag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose) { JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) { if (InteriorEntryAlignment > CodeEntryAlignment) { JVMFlag::printError(verbose, - "InteriorEntryAlignment (" INTX_FORMAT ") must be " - "less than or equal to CodeEntryAlignment (" INTX_FORMAT ")\n", + "InteriorEntryAlignment (%zd) must be " + "less than or equal to CodeEntryAlignment (%zd)\n", InteriorEntryAlignment, CodeEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } if (!is_power_of_2(value)) { JVMFlag::printError(verbose, - "InteriorEntryAlignment (" INTX_FORMAT ") must be " + "InteriorEntryAlignment (%zd) must be " "a power of two\n", InteriorEntryAlignment); return JVMFlag::VIOLATES_CONSTRAINT; } @@ -356,7 +356,7 @@ JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) { if (InteriorEntryAlignment < minimum_alignment) { JVMFlag::printError(verbose, - "InteriorEntryAlignment (" INTX_FORMAT ") must be " + "InteriorEntryAlignment (%zd) must be " "greater than or equal to %d\n", InteriorEntryAlignment, minimum_alignment); return JVMFlag::VIOLATES_CONSTRAINT; @@ -369,7 +369,7 @@ JVMFlag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) { if (value < MaxNodeLimit * 2 / 100 || value > MaxNodeLimit * 40 / 100) { JVMFlag::printError(verbose, "NodeLimitFudgeFactor must be between 2%% and 40%% " - "of MaxNodeLimit (" INTX_FORMAT ")\n", + "of MaxNodeLimit (%zd)\n", MaxNodeLimit); return JVMFlag::VIOLATES_CONSTRAINT; } diff --git a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp index 354e828372fe6..a7d8f36dd18e6 100644 --- a/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.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 @@ -96,8 +96,8 @@ JVMFlag::Error VMPageSizeConstraintFunc(uintx value, bool verbose) { uintx min = (uintx)os::vm_page_size(); if (value < min) { JVMFlag::printError(verbose, - "%s %s=" UINTX_FORMAT " is outside the allowed range [ " UINTX_FORMAT - " ... " UINTX_FORMAT " ]\n", + "%s %s=%zu is outside the allowed range [ %zu" + " ... %zu ]\n", JVMFlagLimit::last_checked_flag()->type_string(), JVMFlagLimit::last_checked_flag()->name(), value, min, max_uintx); @@ -113,8 +113,8 @@ JVMFlag::Error NUMAInterleaveGranularityConstraintFunc(size_t value, bool verbos if (value < min || value > max) { JVMFlag::printError(verbose, - "size_t NUMAInterleaveGranularity=" UINTX_FORMAT " is outside the allowed range [ " UINTX_FORMAT - " ... " UINTX_FORMAT " ]\n", value, min, max); + "size_t NUMAInterleaveGranularity=%zu is outside the allowed range [ %zu" + " ... %zu ]\n", value, min, max); return JVMFlag::VIOLATES_CONSTRAINT; } diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index 61e1e0d20b7e8..26eb9cd25dfc0 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -1090,7 +1090,7 @@ oop frame::retrieve_receiver(RegisterMap* reg_map) { return nullptr; } oop r = *oop_adr; - assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (" INTX_FORMAT ")", p2i(r), p2i(r)); + assert(Universe::heap()->is_in_or_null(r), "bad receiver: " INTPTR_FORMAT " (%zd)", p2i(r), p2i(r)); return r; } diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index c9c7ae8e4c36f..882ec2ae23eb3 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -182,7 +182,7 @@ static void print_method_invocation_histogram() { collected_invoked_methods->sort(&compare_methods); // tty->cr(); - tty->print_cr("Histogram Over Method Invocation Counters (cutoff = " INTX_FORMAT "):", MethodHistogramCutoff); + tty->print_cr("Histogram Over Method Invocation Counters (cutoff = %zd):", MethodHistogramCutoff); tty->cr(); tty->print_cr("____Count_(I+C)____Method________________________Module_________________"); uint64_t total = 0, diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index 86aa62fd3fb69..926b4658dad19 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -932,15 +932,15 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { assert(!this->has_pending_exception(), "release_monitors should have cleared"); // Check for monitor counts being out of sync. assert(held_monitor_count() == jni_monitor_count(), - "held monitor count should be equal to jni: " INTX_FORMAT " != " INTX_FORMAT, + "held monitor count should be equal to jni: %zd != %zd", held_monitor_count(), jni_monitor_count()); // All in-use monitors, including JNI-locked ones, should have been released above. - assert(held_monitor_count() == 0, "Failed to unlock " INTX_FORMAT " object monitors", + assert(held_monitor_count() == 0, "Failed to unlock %zd object monitors", held_monitor_count()); } else { // Check for monitor counts being out of sync. assert(held_monitor_count() == jni_monitor_count(), - "held monitor count should be equal to jni: " INTX_FORMAT " != " INTX_FORMAT, + "held monitor count should be equal to jni: %zd != %zd", held_monitor_count(), jni_monitor_count()); // It is possible that a terminating thread failed to unlock monitors it locked // via JNI so we don't assert the count is zero. @@ -949,7 +949,7 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { if (CheckJNICalls && jni_monitor_count() > 0) { // We would like a fatal here, but due to we never checked this before there // is a lot of tests which breaks, even with an error log. - log_debug(jni)("JavaThread %s (tid: " UINTX_FORMAT ") with Objects still locked by JNI MonitorEnter.", + log_debug(jni)("JavaThread %s (tid: %zu) with Objects still locked by JNI MonitorEnter.", exit_type == JavaThread::normal_exit ? "exiting" : "detaching", os::current_thread_id()); } @@ -990,7 +990,7 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { if (log_is_enabled(Info, os, thread)) { ResourceMark rm(this); - log_info(os, thread)("JavaThread %s (name: \"%s\", tid: " UINTX_FORMAT ").", + log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).", exit_type == JavaThread::normal_exit ? "exiting" : "detaching", name(), os::current_thread_id()); } @@ -2012,14 +2012,14 @@ void JavaThread::inc_held_monitor_count(intx i, bool jni) { return; } - assert(_held_monitor_count >= 0, "Must always be non-negative: " INTX_FORMAT, _held_monitor_count); + assert(_held_monitor_count >= 0, "Must always be non-negative: %zd", _held_monitor_count); _held_monitor_count += i; if (jni) { - assert(_jni_monitor_count >= 0, "Must always be non-negative: " INTX_FORMAT, _jni_monitor_count); + assert(_jni_monitor_count >= 0, "Must always be non-negative: %zd", _jni_monitor_count); _jni_monitor_count += i; } assert(_held_monitor_count >= _jni_monitor_count, "Monitor count discrepancy detected - held count " - INTX_FORMAT " is less than JNI count " INTX_FORMAT, _held_monitor_count, _jni_monitor_count); + "%zd is less than JNI count %zd", _held_monitor_count, _jni_monitor_count); #endif // SUPPORT_MONITOR_COUNT } @@ -2036,17 +2036,17 @@ void JavaThread::dec_held_monitor_count(intx i, bool jni) { } _held_monitor_count -= i; - assert(_held_monitor_count >= 0, "Must always be non-negative: " INTX_FORMAT, _held_monitor_count); + assert(_held_monitor_count >= 0, "Must always be non-negative: %zd", _held_monitor_count); if (jni) { _jni_monitor_count -= i; - assert(_jni_monitor_count >= 0, "Must always be non-negative: " INTX_FORMAT, _jni_monitor_count); + assert(_jni_monitor_count >= 0, "Must always be non-negative: %zd", _jni_monitor_count); } // When a thread is detaching with still owned JNI monitors, the logic that releases // the monitors doesn't know to set the "jni" flag and so the counts can get out of sync. // So we skip this assert if the thread is exiting. Once all monitors are unlocked the // JNI count is directly set to zero. assert(_held_monitor_count >= _jni_monitor_count || is_exiting(), "Monitor count discrepancy detected - held count " - INTX_FORMAT " is less than JNI count " INTX_FORMAT, _held_monitor_count, _jni_monitor_count); + "%zd is less than JNI count %zd", _held_monitor_count, _jni_monitor_count); #endif // SUPPORT_MONITOR_COUNT } @@ -2265,7 +2265,7 @@ void JavaThread::pretouch_stack() { if (is_in_full_stack(here) && here > end) { size_t to_alloc = here - end; char* p2 = (char*) alloca(to_alloc); - log_trace(os, thread)("Pretouching thread stack for " UINTX_FORMAT ": " RANGEFMT ".", + log_trace(os, thread)("Pretouching thread stack for %zu: " RANGEFMT ".", (uintx) osthread()->thread_id(), RANGEFMTARGS(p2, to_alloc)); os::pretouch_memory(p2, p2 + to_alloc, NOT_AIX(os::vm_page_size()) AIX_ONLY(4096)); diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index 0f288baf0dd9b..35a88cf7e9d57 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -440,7 +440,7 @@ bool ObjectMonitor::spin_enter(JavaThread* current) { // we forgo posting JVMTI events and firing DTRACE probes. if (TrySpin(current)) { assert(has_owner(current), "must be current: owner=" INT64_FORMAT, owner_raw()); - assert(_recursions == 0, "must be 0: recursions=" INTX_FORMAT, _recursions); + assert(_recursions == 0, "must be 0: recursions=%zd", _recursions); assert_mark_word_consistency(); return true; } @@ -2497,7 +2497,7 @@ void ObjectMonitor::Initialize2() { void ObjectMonitor::print_on(outputStream* st) const { // The minimal things to print for markWord printing, more can be added for debugging and logging. st->print("{contentions=0x%08x,waiters=0x%08x" - ",recursions=" INTX_FORMAT ",owner=" INT64_FORMAT "}", + ",recursions=%zd,owner=" INT64_FORMAT "}", contentions(), waiters(), recursions(), owner()); } @@ -2550,7 +2550,7 @@ void ObjectMonitor::print_debug_style_on(outputStream* st) const { st->print_cr(" [%d] = '\\0'", (int)sizeof(_pad_buf1) - 1); st->print_cr(" }"); st->print_cr(" _next_om = " INTPTR_FORMAT, p2i(next_om())); - st->print_cr(" _recursions = " INTX_FORMAT, _recursions); + st->print_cr(" _recursions = %zd", _recursions); st->print_cr(" _EntryList = " INTPTR_FORMAT, p2i(_EntryList)); st->print_cr(" _cxq = " INTPTR_FORMAT, p2i(_cxq)); st->print_cr(" _succ = " INT64_FORMAT, successor()); diff --git a/src/hotspot/share/runtime/osThreadBase.cpp b/src/hotspot/share/runtime/osThreadBase.cpp index b3ef34f6508a5..ecce84ba5f295 100644 --- a/src/hotspot/share/runtime/osThreadBase.cpp +++ b/src/hotspot/share/runtime/osThreadBase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -28,7 +28,7 @@ // Printing void OSThreadBase::print_on(outputStream *st) const { - st->print("nid=" UINTX_FORMAT " ", thread_id_for_printing()); + st->print("nid=%zu ", thread_id_for_printing()); switch (_state) { case ALLOCATED: st->print("allocated "); break; case INITIALIZED: st->print("initialized "); break; diff --git a/src/hotspot/share/runtime/stackOverflow.cpp b/src/hotspot/share/runtime/stackOverflow.cpp index 532e91f527fbb..3463457edb8b5 100644 --- a/src/hotspot/share/runtime/stackOverflow.cpp +++ b/src/hotspot/share/runtime/stackOverflow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -81,8 +81,7 @@ void StackOverflow::create_stack_guard_pages() { if (!os::uses_stack_guard_pages() || _stack_guard_state != stack_guard_unused || (DisablePrimordialThreadGuardPages && os::is_primordial_thread())) { - log_info(os, thread)("Stack guard page creation for thread " - UINTX_FORMAT " disabled", os::current_thread_id()); + log_info(os, thread)("Stack guard page creation for thread %zu disabled", os::current_thread_id()); return; } address low_addr = stack_end(); @@ -107,7 +106,7 @@ void StackOverflow::create_stack_guard_pages() { vm_exit_out_of_memory(len, OOM_MPROTECT_ERROR, "memory to guard stack pages"); } - log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages activated: " + log_debug(os, thread)("Thread %zu stack guard pages activated: " PTR_FORMAT "-" PTR_FORMAT ".", os::current_thread_id(), p2i(low_addr), p2i(low_addr + len)); } @@ -136,7 +135,7 @@ void StackOverflow::remove_stack_guard_pages() { } } - log_debug(os, thread)("Thread " UINTX_FORMAT " stack guard pages removed: " + log_debug(os, thread)("Thread %zu stack guard pages removed: " PTR_FORMAT "-" PTR_FORMAT ".", os::current_thread_id(), p2i(low_addr), p2i(low_addr + len)); } diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index 941309ca2acc9..73d836a6546a6 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -1341,7 +1341,7 @@ bool ObjectSynchronizer::is_async_deflation_needed() { // We need to clean up the used monitors even if the threshold is // not reached, to keep the memory utilization at bay when many threads // touched many monitors. - log_info(monitorinflation)("Async deflation needed: guaranteed interval (" INTX_FORMAT " ms) " + log_info(monitorinflation)("Async deflation needed: guaranteed interval (%zd ms) " "is greater than time since last deflation (" JLONG_FORMAT " ms)", GuaranteedAsyncDeflationInterval, time_since_last); diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index b02166ce681b9..da6b9edac9b4a 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -218,7 +218,7 @@ void Thread::call_run() { JFR_ONLY(Jfr::on_thread_start(this);) - log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: " + log_debug(os, thread)("Thread %zu stack dimensions: " PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT "k).", os::current_thread_id(), p2i(stack_end()), p2i(stack_base()), stack_size()/1024); diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index d3676c4442392..716792bc5b9a1 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, 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 @@ -360,7 +360,7 @@ class ScanHazardPtrPrintMatchingThreadsClosure : public ThreadClosure { JavaThreadIterator jti(current_list); for (JavaThread *p = jti.first(); p != nullptr; p = jti.next()) { if (p == _thread) { - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread1=" INTPTR_FORMAT " has a hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::smr_delete: thread1=" INTPTR_FORMAT " has a hazard pointer for thread2=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread), p2i(_thread)); break; } } @@ -514,7 +514,7 @@ void SafeThreadsListPtr::acquire_stable_list_nested_path() { verify_hazard_ptr_scanned(); - log_debug(thread, smr)("tid=" UINTX_FORMAT ": SafeThreadsListPtr::acquire_stable_list: add nested list pointer to ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(_list)); + log_debug(thread, smr)("tid=%zu: SafeThreadsListPtr::acquire_stable_list: add nested list pointer to ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(_list)); } // Release a stable ThreadsList. @@ -547,7 +547,7 @@ void SafeThreadsListPtr::release_stable_list() { // ref count. We no longer need that protection. _list->dec_nested_handle_cnt(); - log_debug(thread, smr)("tid=" UINTX_FORMAT ": SafeThreadsListPtr::release_stable_list: delete nested list pointer to ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(_list)); + log_debug(thread, smr)("tid=%zu: SafeThreadsListPtr::release_stable_list: delete nested list pointer to ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(_list)); } // After releasing the hazard ptr, other threads may go ahead and @@ -860,7 +860,7 @@ void ThreadsSMRSupport::add_thread(JavaThread *thread){ update_java_thread_list_max(new_list->length()); } // Initial _java_thread_list will not generate a "Threads::add" mesg. - log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); + log_debug(thread, smr)("tid=%zu: Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); ThreadsList *old_list = xchg_java_thread_list(new_list); free_list(old_list); @@ -895,7 +895,7 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { if (is_bootstrap_list(threads)) { // The bootstrap list cannot be freed and is empty so // it does not need to be scanned. Nothing to do here. - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: bootstrap ThreadsList=" INTPTR_FORMAT " is no longer in use.", os::current_thread_id(), p2i(threads)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::free_list: bootstrap ThreadsList=" INTPTR_FORMAT " is no longer in use.", os::current_thread_id(), p2i(threads)); return; } @@ -932,7 +932,7 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { _to_delete_list = next; } - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current)); if (current == threads) threads_is_freed = true; delete current; if (EnableThreadSMRStatistics) { @@ -948,7 +948,7 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { if (!threads_is_freed) { // Only report "is not freed" on the original call to // free_list() for this ThreadsList. - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads)); } ValidateHazardPtrsClosure validate_cl; @@ -1012,7 +1012,7 @@ void ThreadsSMRSupport::release_stable_list_wake_up(bool is_nested) { // Notify any exiting JavaThreads that are waiting in smr_delete() // that we've released a ThreadsList. ml.notify_all(); - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list notified %s", os::current_thread_id(), log_str); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::release_stable_list notified %s", os::current_thread_id(), log_str); } } @@ -1024,7 +1024,7 @@ void ThreadsSMRSupport::remove_thread(JavaThread *thread) { } // Final _java_thread_list will not generate a "Threads::remove" mesg. - log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); + log_debug(thread, smr)("tid=%zu: Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list); ThreadsSMRSupport::free_list(old_list); @@ -1056,7 +1056,7 @@ void ThreadsSMRSupport::smr_delete(JavaThread *thread) { ThreadsSMRSupport::update_deleted_thread_time_max(millis); } - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread)); } void ThreadsSMRSupport::wait_until_not_protected(JavaThread *thread) { @@ -1085,14 +1085,14 @@ void ThreadsSMRSupport::wait_until_not_protected(JavaThread *thread) { } if (!has_logged_once) { has_logged_once = true; - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::wait_until_not_protected: thread=" INTPTR_FORMAT " is not deleted.", os::current_thread_id(), p2i(thread)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::wait_until_not_protected: thread=" INTPTR_FORMAT " is not deleted.", os::current_thread_id(), p2i(thread)); if (log_is_enabled(Debug, os, thread)) { ScanHazardPtrPrintMatchingThreadsClosure scan_cl(thread); threads_do(&scan_cl); ThreadsList* current = _to_delete_list; while (current != nullptr) { if (current->_nested_handle_cnt != 0 && current->includes(thread)) { - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::wait_until_not_protected: found nested hazard pointer to thread=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread)); + log_debug(thread, smr)("tid=%zu: ThreadsSMRSupport::wait_until_not_protected: found nested hazard pointer to thread=" INTPTR_FORMAT, os::current_thread_id(), p2i(thread)); } current = current->next_list(); } diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index 7b39161090d46..1cab9bc5d5348 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1167,8 +1167,8 @@ void Threads::change_thread_claim_token() { static void assert_thread_claimed(const char* kind, Thread* t, uintx expected) { const uintx token = t->threads_do_token(); assert(token == expected, - "%s " PTR_FORMAT " has incorrect value " UINTX_FORMAT " != " - UINTX_FORMAT, kind, p2i(t), token, expected); + "%s " PTR_FORMAT " has incorrect value %zu != %zu", + kind, p2i(t), token, expected); } void Threads::assert_all_threads_claimed() { diff --git a/src/hotspot/share/runtime/vmThread.cpp b/src/hotspot/share/runtime/vmThread.cpp index 8ed212d515a9c..45ebae1f61e68 100644 --- a/src/hotspot/share/runtime/vmThread.cpp +++ b/src/hotspot/share/runtime/vmThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -61,7 +61,7 @@ void VMOperationTimeoutTask::task() { if (is_armed()) { jlong delay = nanos_to_millis(os::javaTimeNanos() - _arm_time); if (delay > AbortVMOnVMOperationTimeoutDelay) { - fatal("%s VM operation took too long: " JLONG_FORMAT " ms elapsed since VM-op start (timeout: " INTX_FORMAT " ms)", + fatal("%s VM operation took too long: " JLONG_FORMAT " ms elapsed since VM-op start (timeout: %zd ms)", _vm_op_name, delay, AbortVMOnVMOperationTimeoutDelay); } } @@ -88,7 +88,7 @@ void VMOperationTimeoutTask::disarm() { // VMOperationTimeoutTask might miss the arm-disarm window depending on // the scheduling. if (vm_op_duration > AbortVMOnVMOperationTimeoutDelay) { - fatal("%s VM operation took too long: completed in " JLONG_FORMAT " ms (timeout: " INTX_FORMAT " ms)", + fatal("%s VM operation took too long: completed in " JLONG_FORMAT " ms (timeout: %zd ms)", _vm_op_name, vm_op_duration, AbortVMOnVMOperationTimeoutDelay); } _vm_op_name = nullptr; diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index 8b8efc577cb63..2a6a892e97628 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -683,7 +683,7 @@ JVM_ENTRY(jlong, jmm_SetPoolThreshold(JNIEnv* env, jobject obj, jmmThresholdType if ((size_t)threshold > max_uintx) { stringStream st; - st.print("Invalid valid threshold value. Threshold value (" JLONG_FORMAT ") > max value of size_t (" UINTX_FORMAT ")", threshold, max_uintx); + st.print("Invalid valid threshold value. Threshold value (" JLONG_FORMAT ") > max value of size_t (%zu)", threshold, max_uintx); THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), st.as_string(), -1); } diff --git a/src/hotspot/share/services/writeableFlags.cpp b/src/hotspot/share/services/writeableFlags.cpp index d4f601ed839f0..551a99ad26dee 100644 --- a/src/hotspot/share/services/writeableFlags.cpp +++ b/src/hotspot/share/services/writeableFlags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, 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 @@ -142,7 +142,7 @@ JVMFlag::Error WriteableFlags::set_uint_flag(const char* name, const char* arg, JVMFlag::Error WriteableFlags::set_intx_flag(const char* name, const char* arg, JVMFlagOrigin origin, FormatBuffer<80>& err_msg) { intx value; - if (sscanf(arg, INTX_FORMAT, &value) == 1) { + if (sscanf(arg, "%zd", &value) == 1) { return set_flag_impl(name, value, origin, err_msg); } err_msg.print("flag value must be an integer"); @@ -153,7 +153,7 @@ JVMFlag::Error WriteableFlags::set_intx_flag(const char* name, const char* arg, JVMFlag::Error WriteableFlags::set_uintx_flag(const char* name, const char* arg, JVMFlagOrigin origin, FormatBuffer<80>& err_msg) { uintx value; - if (sscanf(arg, UINTX_FORMAT, &value) == 1) { + if (sscanf(arg, "%zu", &value) == 1) { return set_flag_impl(name, value, origin, err_msg); } err_msg.print("flag value must be an unsigned integer"); diff --git a/src/hotspot/share/utilities/fakeRttiSupport.hpp b/src/hotspot/share/utilities/fakeRttiSupport.hpp index 36f998f77fd90..584da814a2483 100644 --- a/src/hotspot/share/utilities/fakeRttiSupport.hpp +++ b/src/hotspot/share/utilities/fakeRttiSupport.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, 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 @@ -77,7 +77,7 @@ class FakeRttiSupport { FakeRttiSupport add_tag(TagType tag) const { uintx tbit = tag_bit(tag); assert((_tag_set & tbit) == 0, - "Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT, + "Tag %zu is already present in tag set: %zu", (uintx)tag, _tag_set); return FakeRttiSupport(_concrete_tag, _tag_set | tbit); } @@ -91,9 +91,9 @@ class FakeRttiSupport { } static TagType validate_tag(TagType tag) { - assert(0 <= tag, "Tag " INTX_FORMAT " is negative", (intx)tag); + assert(0 <= tag, "Tag %zd is negative", (intx)tag); assert(tag < BitsPerWord, - "Tag " UINTX_FORMAT " is too large", (uintx)tag); + "Tag %zu is too large", (uintx)tag); return tag; } }; diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index ce864119d75fd..ec4631a80bbf4 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -145,18 +145,6 @@ class oopDesc; #endif #define SIZE_FORMAT_W(width) "%" #width PRIuPTR -#define INTX_FORMAT "%" PRIdPTR -#define INTX_FORMAT_X "0x%" PRIxPTR -#define INTX_FORMAT_W(width) "%" #width PRIdPTR -#define UINTX_FORMAT "%" PRIuPTR -#define UINTX_FORMAT_X "0x%" PRIxPTR -#ifdef _LP64 -#define UINTX_FORMAT_X_0 "0x%016" PRIxPTR -#else -#define UINTX_FORMAT_X_0 "0x%08" PRIxPTR -#endif -#define UINTX_FORMAT_W(width) "%" #width PRIuPTR - // Format jlong, if necessary #ifndef JLONG_FORMAT #define JLONG_FORMAT INT64_FORMAT diff --git a/src/hotspot/share/utilities/ostream.cpp b/src/hotspot/share/utilities/ostream.cpp index b8f27fbd4130b..81104347e6f1c 100644 --- a/src/hotspot/share/utilities/ostream.cpp +++ b/src/hotspot/share/utilities/ostream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -875,7 +875,7 @@ intx defaultStream::hold(intx writer_id) { if (has_log) { _log_file->bol(); // output a hint where this output is coming from: - _log_file->print_cr("", writer_id); + _log_file->print_cr("", writer_id); } _last_writer = writer_id; } diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index b15d6f5fa735c..c13a2c4230460 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2024 SAP SE. All rights reserved. * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -263,13 +263,13 @@ char* VMError::error_string(char* buf, int buflen) { if (signame) { jio_snprintf(buf, buflen, - "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=" UINTX_FORMAT, + "%s (0x%x) at pc=" PTR_FORMAT ", pid=%d, tid=%zu", signame, _id, _pc, os::current_process_id(), os::current_thread_id()); } else if (_filename != nullptr && _lineno > 0) { // skip directory names int n = jio_snprintf(buf, buflen, - "Internal Error at %s:%d, pid=%d, tid=" UINTX_FORMAT, + "Internal Error at %s:%d, pid=%d, tid=%zu", get_filename_only(), _lineno, os::current_process_id(), os::current_thread_id()); if (n >= 0 && n < buflen && _message) { @@ -283,7 +283,7 @@ char* VMError::error_string(char* buf, int buflen) { } } else { jio_snprintf(buf, buflen, - "Internal Error (0x%x), pid=%d, tid=" UINTX_FORMAT, + "Internal Error (0x%x), pid=%d, tid=%zu", _id, os::current_process_id(), os::current_thread_id()); } @@ -827,7 +827,7 @@ void VMError::report(outputStream* st, bool _verbose) { STEP("printing current thread and pid") // process id, thread id st->print(", pid=%d", os::current_process_id()); - st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); + st->print(", tid=%zu", os::current_thread_id()); st->cr(); STEP_IF("printing error message", should_report_bug(_id)) // already printed the message. @@ -1651,7 +1651,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt if (!SuppressFatalErrorMessage) { char msgbuf[64]; jio_snprintf(msgbuf, sizeof(msgbuf), - "[thread " INTX_FORMAT " also had an error]", + "[thread %zd also had an error]", mytid); out.print_raw_cr(msgbuf); } diff --git a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp index 5dc43fb543f95..c96d3d5365bbd 100644 --- a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp +++ b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp @@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -277,15 +277,15 @@ TEST(globalDefinitions, format_specifiers) { check_format(SIZE_FORMAT_W(5), (size_t)123u, " 123"); check_format(SIZE_FORMAT_W(-5), (size_t)123u, "123 "); - check_format(INTX_FORMAT, (intx)123, "123"); - check_format(INTX_FORMAT_X, (intx)0x123, "0x123"); - check_format(INTX_FORMAT_W(5), (intx)123, " 123"); - check_format(INTX_FORMAT_W(-5), (intx)123, "123 "); + check_format("%zd", (intx)123, "123"); + check_format("0x%zx", (intx)0x123, "0x123"); + check_format("%5zd", (intx)123, " 123"); + check_format("%-5zd", (intx)123, "123 "); - check_format(UINTX_FORMAT, (uintx)123u, "123"); - check_format(UINTX_FORMAT_X, (uintx)0x123u, "0x123"); - check_format(UINTX_FORMAT_W(5), (uintx)123u, " 123"); - check_format(UINTX_FORMAT_W(-5), (uintx)123u, "123 "); + check_format("%zu", (uintx)123u, "123"); + check_format("0x%zx", (uintx)0x123u, "0x123"); + check_format("%5zu", (uintx)123u, " 123"); + check_format("%-5zu", (uintx)123u, "123 "); check_format(INTPTR_FORMAT, (intptr_t)0x123, "0x" LP64_ONLY("00000000") "00000123"); check_format(PTR_FORMAT, (uintptr_t)0x123, "0x" LP64_ONLY("00000000") "00000123"); diff --git a/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp b/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp index 9e8da5e61b75f..119b76f7ad676 100644 --- a/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp +++ b/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ class SingleWriterSynchronizerTestWriter : public JavaTestThread { _synchronizer->synchronize(); { ThreadBlockInVM tbiv(this); } // Safepoint check. } - tty->print_cr("writer iterations: " UINTX_FORMAT, *_synchronized_value); + tty->print_cr("writer iterations: %zu", *_synchronized_value); } }; From 1748797afbd9c4f27ac472b108ef523b43ea3fa4 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 3 Jan 2025 16:20:09 +0000 Subject: [PATCH 2/6] Fix %Ix to %zx. --- src/hotspot/os/windows/os_windows.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index b167355c1eeae..89ab180322f68 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3337,7 +3337,7 @@ char* os::pd_attempt_reserve_memory_at(char* addr, size_t bytes, bool exec) { } if (Verbose && PrintMiscellaneous) { reserveTimer.stop(); - tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes, + tty->print_cr("reserve_memory of %zx bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes, reserveTimer.milliseconds(), reserveTimer.ticks()); } } From 15b1052ad3f4f2d0fe410a7567dbe5e5ce46a3b9 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 6 Jan 2025 15:04:55 +0000 Subject: [PATCH 3/6] Fixed some code review comments. --- src/hotspot/cpu/x86/vm_version_x86.cpp | 2 +- src/hotspot/os/linux/os_linux.cpp | 12 +++--------- src/hotspot/share/ci/ciMethodData.cpp | 2 +- src/hotspot/share/gc/shared/ageTable.cpp | 3 --- .../gtest/utilities/test_globalDefinitions.cpp | 4 ++-- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 5672e4a07f5d6..2e434e019d5da 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -1722,7 +1722,7 @@ void VM_Version::get_processor_features() { if (ArrayOperationPartialInlineSize > MaxVectorSize) { ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0; if (ArrayOperationPartialInlineSize) { - warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize%zd)", MaxVectorSize); + warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize=%zd", MaxVectorSize); } else { warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize); } diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index d5f2889c5ab62..61b1816de2efd 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1366,12 +1366,9 @@ void os::Linux::capture_initial_stack(size_t max_size) { // Skip blank chars do { s++; } while (s && isspace((unsigned char) *s)); -#define _UFM "%zu" -#define _DFM "%zd" - - // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 - // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 - i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld " _UFM _UFM _DFM _UFM _UFM _UFM _UFM, + // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 + // 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 + i = sscanf(s, "%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %zu %zu %zd %zu %zu %zu %zu", &state, // 3 %c &ppid, // 4 %d &pgrp, // 5 %d @@ -1400,9 +1397,6 @@ void os::Linux::capture_initial_stack(size_t max_size) { &stack_start); // 28 %zu } -#undef _UFM -#undef _DFM - if (i != 28 - 2) { assert(false, "Bad conversion from /proc/self/stat"); // product mode - assume we are the primordial thread, good luck in the diff --git a/src/hotspot/share/ci/ciMethodData.cpp b/src/hotspot/share/ci/ciMethodData.cpp index 63b690c87c9b8..1bbb3eafb0e45 100644 --- a/src/hotspot/share/ci/ciMethodData.cpp +++ b/src/hotspot/share/ci/ciMethodData.cpp @@ -785,7 +785,7 @@ void ciMethodData::dump_replay_data(outputStream* out) { // We could use INTPTR_FORMAT here but that's zero justified // which makes comparing it with the SA version of this output // harder. data()'s element type is intptr_t. - out->print(" 0x%zx", data()[i]); + out->print(" %#zx", data()[i]); } // The MDO contained oop references as ciObjects, so scan for those diff --git a/src/hotspot/share/gc/shared/ageTable.cpp b/src/hotspot/share/gc/shared/ageTable.cpp index 17fc19e3b913a..8e86890d0b3a3 100644 --- a/src/hotspot/share/gc/shared/ageTable.cpp +++ b/src/hotspot/share/gc/shared/ageTable.cpp @@ -35,9 +35,6 @@ #include "utilities/copy.hpp" #include "logging/logStream.hpp" -/* Copyright (c) 1992, 2025, Oracle and/or its affiliates, and Stanford University. - See the LICENSE file for license information. */ - AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) { clear(); diff --git a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp index c96d3d5365bbd..10785f9c1fa94 100644 --- a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp +++ b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp @@ -278,12 +278,12 @@ TEST(globalDefinitions, format_specifiers) { check_format(SIZE_FORMAT_W(-5), (size_t)123u, "123 "); check_format("%zd", (intx)123, "123"); - check_format("0x%zx", (intx)0x123, "0x123"); + check_format("%#zx", (intx)0x123, "0x123"); check_format("%5zd", (intx)123, " 123"); check_format("%-5zd", (intx)123, "123 "); check_format("%zu", (uintx)123u, "123"); - check_format("0x%zx", (uintx)0x123u, "0x123"); + check_format("%#zx", (uintx)0x123u, "0x123"); check_format("%5zu", (uintx)123u, " 123"); check_format("%-5zu", (uintx)123u, "123 "); From 6e8b270256da97db83934f4546c4e2567d3b85b7 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 6 Jan 2025 15:21:08 +0000 Subject: [PATCH 4/6] Use INTPTR_FORMAT instead of zu for secondary_supers_bitmap. --- src/hotspot/share/oops/instanceKlass.cpp | 2 +- src/hotspot/share/oops/klass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 16feac692fd45..40d57da858051 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -3692,7 +3692,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"secondary supers: "); secondary_supers()->print_value_on(st); st->cr(); st->print(BULLET"hash_slot: %d", hash_slot()); st->cr(); - st->print(BULLET"secondary bitmap: " LP64_ONLY("0x%016zu") NOT_LP64("0x%08zu"), _secondary_supers_bitmap); st->cr(); + st->print(BULLET"secondary bitmap: " INTPTR_FORMAT, _secondary_supers_bitmap); st->cr(); if (secondary_supers() != nullptr) { if (Verbose) { diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index 9564db6a22df2..dc11d805a5bc2 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -1305,7 +1305,7 @@ static void print_negative_lookup_stats(uintx bitmap, outputStream* st) { void Klass::print_secondary_supers_on(outputStream* st) const { if (secondary_supers() != nullptr) { st->print(" - "); st->print("%d elements;", _secondary_supers->length()); - st->print_cr(" bitmap: " LP64_ONLY("0x%016zu") NOT_LP64("0x%08zu"), _secondary_supers_bitmap); + st->print_cr(" bitmap: " INTPTR_FORMAT, _secondary_supers_bitmap); if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY && _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) { st->print(" - "); print_positive_lookup_stats(secondary_supers(), From ae9d9f6f13460fd5f531ff11840f1b27baa1d9c5 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 7 Jan 2025 12:47:24 +0000 Subject: [PATCH 5/6] Restore copyright and macro. --- src/hotspot/share/gc/shared/ageTable.cpp | 3 +++ src/hotspot/share/oops/instanceKlass.cpp | 2 +- src/hotspot/share/oops/klass.cpp | 2 +- src/hotspot/share/utilities/globalDefinitions.hpp | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/shared/ageTable.cpp b/src/hotspot/share/gc/shared/ageTable.cpp index 8e86890d0b3a3..17fc19e3b913a 100644 --- a/src/hotspot/share/gc/shared/ageTable.cpp +++ b/src/hotspot/share/gc/shared/ageTable.cpp @@ -35,6 +35,9 @@ #include "utilities/copy.hpp" #include "logging/logStream.hpp" +/* Copyright (c) 1992, 2025, Oracle and/or its affiliates, and Stanford University. + See the LICENSE file for license information. */ + AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) { clear(); diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 40d57da858051..8427a0b7c2664 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -3692,7 +3692,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"secondary supers: "); secondary_supers()->print_value_on(st); st->cr(); st->print(BULLET"hash_slot: %d", hash_slot()); st->cr(); - st->print(BULLET"secondary bitmap: " INTPTR_FORMAT, _secondary_supers_bitmap); st->cr(); + st->print(BULLET"secondary bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap); st->cr(); if (secondary_supers() != nullptr) { if (Verbose) { diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index dc11d805a5bc2..1b55c92b28c83 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -1305,7 +1305,7 @@ static void print_negative_lookup_stats(uintx bitmap, outputStream* st) { void Klass::print_secondary_supers_on(outputStream* st) const { if (secondary_supers() != nullptr) { st->print(" - "); st->print("%d elements;", _secondary_supers->length()); - st->print_cr(" bitmap: " INTPTR_FORMAT, _secondary_supers_bitmap); + st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap); if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY && _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) { st->print(" - "); print_positive_lookup_stats(secondary_supers(), diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index ec4631a80bbf4..3b06ce62debcc 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -159,13 +159,15 @@ class oopDesc; #define JULONG_FORMAT_X UINT64_FORMAT_X #endif -// Format pointers which change size between 32- and 64-bit. +// Format pointers and padded integral values which change size between 32- and 64-bit. #ifdef _LP64 #define INTPTR_FORMAT "0x%016" PRIxPTR #define PTR_FORMAT "0x%016" PRIxPTR +#define UINTX_FORMAT_X_0 "0x%016" PRIxPTR #else // !_LP64 #define INTPTR_FORMAT "0x%08" PRIxPTR #define PTR_FORMAT "0x%08" PRIxPTR +#define UINTX_FORMAT_X_0 "0x%08" PRIxPTR #endif // _LP64 // Convert pointer to intptr_t, for use in printing pointers. From 763c3908093103d57c67ebd344c95d061ba20087 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 13 Jan 2025 15:44:41 +0000 Subject: [PATCH 6/6] Add Oracle copyright to shenandoah files for this change. --- .../share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp | 1 + src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp | 1 + src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp | 1 + src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp index 9ea07ee650dfc..4aac8263bc54e 100644 --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahHeuristics.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018, 2020, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 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 diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp index 2d3b1935657f1..a4c78c637d958 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAgeCensus.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 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 diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp index b8fb6a34c0168..5f5c9dcd49ca4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp @@ -1,5 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 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 diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index 7f08e0c3067d5..81f1dd1ae97b0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * Copyright (c) 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