Skip to content

Commit 379d05b

Browse files
committed
8346990: Remove INTX_FORMAT and UINTX_FORMAT macros
Reviewed-by: kbarrett, dholmes, matsaave
1 parent d3a7ac2 commit 379d05b

File tree

83 files changed

+325
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+325
-338
lines changed

src/hotspot/cpu/arm/methodHandles_arm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
497497
if (!has_mh) {
498498
mh_reg_name = "R5";
499499
}
500-
log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+" INTX_FORMAT ") stack_size=" INTX_FORMAT " bp=" PTR_FORMAT,
500+
log_info(methodhandles)("MH %s %s=" PTR_FORMAT " sp=(" PTR_FORMAT "+%zd) stack_size=%zd bp=" PTR_FORMAT,
501501
adaptername, mh_reg_name, mh_reg,
502502
(intptr_t)entry_sp, (intptr_t)saved_sp - (intptr_t)entry_sp, (intptr_t)(base_sp - last_sp), (intptr_t)saved_bp);
503503

src/hotspot/cpu/ppc/vm_version_ppc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -90,7 +90,7 @@ void VM_Version::initialize() {
9090
default: break;
9191
}
9292
guarantee(PowerArchitecturePPC64_ok, "PowerArchitecturePPC64 cannot be set to "
93-
UINTX_FORMAT " on this machine", PowerArchitecturePPC64);
93+
"%zu on this machine", PowerArchitecturePPC64);
9494

9595
// Power 8: Configure Data Stream Control Register.
9696
if (PowerArchitecturePPC64 >= 8 && has_mfdscr()) {

src/hotspot/cpu/s390/assembler_s390.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2016, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -140,7 +140,7 @@ class RelAddr {
140140
return 0; // Yet unknown branch destination.
141141
} else {
142142
guarantee(is_in_range_of_RelAddr(target, pc, shortForm),
143-
"target not within reach at " INTPTR_FORMAT ", distance = " INTX_FORMAT, p2i(pc), (target - pc) );
143+
"target not within reach at " INTPTR_FORMAT ", distance = %zd", p2i(pc), (target - pc) );
144144
return (int)((target - pc)>>1);
145145
}
146146
}

src/hotspot/cpu/x86/vm_version_x86.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1722,9 +1722,9 @@ void VM_Version::get_processor_features() {
17221722
if (ArrayOperationPartialInlineSize > MaxVectorSize) {
17231723
ArrayOperationPartialInlineSize = MaxVectorSize >= 16 ? MaxVectorSize : 0;
17241724
if (ArrayOperationPartialInlineSize) {
1725-
warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize" INTX_FORMAT ")", MaxVectorSize);
1725+
warning("Setting ArrayOperationPartialInlineSize as MaxVectorSize=%zd", MaxVectorSize);
17261726
} else {
1727-
warning("Setting ArrayOperationPartialInlineSize as " INTX_FORMAT, ArrayOperationPartialInlineSize);
1727+
warning("Setting ArrayOperationPartialInlineSize as %zd", ArrayOperationPartialInlineSize);
17281728
}
17291729
}
17301730
}

src/hotspot/os/aix/os_aix.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -632,7 +632,7 @@ static void *thread_native_entry(Thread *thread) {
632632
if (lt.is_enabled()) {
633633
address low_address = thread->stack_end();
634634
address high_address = thread->stack_base();
635-
lt.print("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT
635+
lt.print("Thread is alive (tid: %zu, kernel thread id: %zu"
636636
", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %luk pages)).",
637637
os::current_thread_id(), (uintx) kernel_thread_id, p2i(low_address), p2i(high_address),
638638
(high_address - low_address) / K, os::Aix::query_pagesize(low_address) / K);
@@ -682,7 +682,7 @@ static void *thread_native_entry(Thread *thread) {
682682
// Prevent dereferencing it from here on out.
683683
thread = nullptr;
684684

685-
log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
685+
log_info(os, thread)("Thread finished (tid: %zu, kernel thread id: %zu).",
686686
os::current_thread_id(), (uintx) kernel_thread_id);
687687

688688
return 0;
@@ -762,7 +762,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
762762

763763
if (ret == 0) {
764764
char buf[64];
765-
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
765+
log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ",
766766
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
767767
} else {
768768
char buf[64];
@@ -840,7 +840,7 @@ bool os::create_attached_thread(JavaThread* thread) {
840840
// and save the caller's signal mask
841841
PosixSignals::hotspot_sigmask(thread);
842842

843-
log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT
843+
log_info(os, thread)("Thread attached (tid: %zu, kernel thread id: %zu"
844844
", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).",
845845
os::current_thread_id(), (uintx) kernel_thread_id,
846846
p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K);
@@ -1380,7 +1380,7 @@ struct vmembk_t {
13801380
}
13811381

13821382
void print_on(outputStream* os) const {
1383-
os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (" UINTX_FORMAT
1383+
os->print("[" PTR_FORMAT " - " PTR_FORMAT "] (%zu"
13841384
" bytes, %ld %s pages), %s",
13851385
p2i(addr), p2i(addr) + size - 1, size, size / pagesize, describe_pagesize(pagesize),
13861386
(type == VMEM_SHMATED ? "shmat" : "mmap")
@@ -1457,7 +1457,7 @@ static void vmembk_print_on(outputStream* os) {
14571457
// If <requested_addr> is null, function will attach the memory anywhere.
14581458
static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
14591459

1460-
trcVerbose("reserve_shmated_memory " UINTX_FORMAT " bytes, wishaddress "
1460+
trcVerbose("reserve_shmated_memory %zu bytes, wishaddress "
14611461
PTR_FORMAT "...", bytes, p2i(requested_addr));
14621462

14631463
// We must prevent anyone from attaching too close to the
@@ -1478,7 +1478,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
14781478
int shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | S_IRUSR | S_IWUSR);
14791479
if (shmid == -1) {
14801480
ErrnoPreserver ep;
1481-
log_trace(os, map)("shmget(.., " UINTX_FORMAT ", ..) failed (errno=%s).",
1481+
log_trace(os, map)("shmget(.., %zu, ..) failed (errno=%s).",
14821482
size, os::strerror(ep.saved_errno()));
14831483
return nullptr;
14841484
}
@@ -1494,7 +1494,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
14941494
shmbuf.shm_pagesize = 64*K;
14951495
if (shmctl(shmid, SHM_PAGESIZE, &shmbuf) != 0) {
14961496
assert(false,
1497-
"Failed to set page size (need " UINTX_FORMAT
1497+
"Failed to set page size (need %zu"
14981498
" 64K pages) - shmctl failed. (errno=%s).",
14991499
size / (64 * K), os::strerror(os::get_last_error()));
15001500
}
@@ -1537,7 +1537,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
15371537

15381538
if (addr) {
15391539
log_trace(os, map)("shm-allocated succeeded: " RANGEFMT
1540-
" (" UINTX_FORMAT " %s pages)",
1540+
" (%zu %s pages)",
15411541
RANGEFMTARGS(addr, size),
15421542
size / real_pagesize,
15431543
describe_pagesize(real_pagesize));
@@ -1546,7 +1546,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
15461546
log_trace(os, map)("shm-allocate failed: " RANGEFMT,
15471547
RANGEFMTARGS(requested_addr, size));
15481548
} else {
1549-
log_trace(os, map)("failed to shm-allocate " UINTX_FORMAT
1549+
log_trace(os, map)("failed to shm-allocate %zu"
15501550
" bytes at any address.",
15511551
size);
15521552
}
@@ -1588,7 +1588,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) {
15881588

15891589
if (rc != 0) {
15901590
ErrnoPreserver ep;
1591-
log_warning(os)("disclaim64(" PTR_FORMAT ", " UINTX_FORMAT ") failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno()));
1591+
log_warning(os)("disclaim64(" PTR_FORMAT ", %zu) failed, %s\n", p2i(addr), size, os::strerror(ep.saved_errno()));
15921592
return false;
15931593
}
15941594
return true;
@@ -1600,7 +1600,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) {
16001600
// If <requested_addr> is given, an attempt is made to attach at the given address.
16011601
// Failing that, memory is allocated at any address.
16021602
static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) {
1603-
trcVerbose("reserve_mmaped_memory " UINTX_FORMAT " bytes, wishaddress " PTR_FORMAT "...",
1603+
trcVerbose("reserve_mmaped_memory %zu bytes, wishaddress " PTR_FORMAT "...",
16041604
bytes, p2i(requested_addr));
16051605

16061606
if (requested_addr && !is_aligned_to(requested_addr, os::vm_page_size()) != 0) {
@@ -1690,7 +1690,7 @@ static char* reserve_mmaped_memory(size_t bytes, char* requested_addr) {
16901690
}
16911691
addr = addr_aligned;
16921692

1693-
trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (" UINTX_FORMAT " bytes)",
1693+
trcVerbose("mmap-allocated " PTR_FORMAT " .. " PTR_FORMAT " (%zu bytes)",
16941694
p2i(addr), p2i(addr + bytes), bytes);
16951695

16961696
// bookkeeping
@@ -2784,7 +2784,7 @@ bool os::start_debugging(char *buf, int buflen) {
27842784
jio_snprintf(p, buflen -len,
27852785
"\n\n"
27862786
"Do you want to debug the problem?\n\n"
2787-
"To debug, run 'dbx -a %d'; then switch to thread tid " INTX_FORMAT ", k-tid " INTX_FORMAT "\n"
2787+
"To debug, run 'dbx -a %d'; then switch to thread tid %zd, k-tid %zd\n"
27882788
"Enter 'yes' to launch dbx automatically (PATH must include dbx)\n"
27892789
"Otherwise, press RETURN to abort...",
27902790
os::current_process_id(),

src/hotspot/os/bsd/os_bsd.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -605,7 +605,7 @@ static void *thread_native_entry(Thread *thread) {
605605
}
606606
}
607607

608-
log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
608+
log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).",
609609
os::current_thread_id(), (uintx) pthread_self());
610610

611611
// call one more level start routine
@@ -615,7 +615,7 @@ static void *thread_native_entry(Thread *thread) {
615615
// Prevent dereferencing it from here on out.
616616
thread = nullptr;
617617

618-
log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
618+
log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).",
619619
os::current_thread_id(), (uintx) pthread_self());
620620

621621
return 0;
@@ -660,7 +660,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
660660

661661
char buf[64];
662662
if (ret == 0) {
663-
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
663+
log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ",
664664
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
665665
} else {
666666
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) {
744744
// and save the caller's signal mask
745745
PosixSignals::hotspot_sigmask(thread);
746746

747-
log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT
747+
log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu"
748748
", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).",
749749
os::current_thread_id(), (uintx) pthread_self(),
750750
p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K);
@@ -2524,7 +2524,7 @@ bool os::start_debugging(char *buf, int buflen) {
25242524
jio_snprintf(p, buflen-len,
25252525
"\n\n"
25262526
"Do you want to debug the problem?\n\n"
2527-
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
2527+
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zd (" INTPTR_FORMAT ")\n"
25282528
"Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
25292529
"Otherwise, press RETURN to abort...",
25302530
os::current_process_id(), os::current_process_id(),

src/hotspot/os/linux/os_linux.cpp

+17-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2015, 2024 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -847,7 +847,7 @@ static void *thread_native_entry(Thread *thread) {
847847
}
848848
}
849849

850-
log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
850+
log_info(os, thread)("Thread is alive (tid: %zu, pthread id: %zu).",
851851
os::current_thread_id(), (uintx) pthread_self());
852852

853853
assert(osthread->pthread_id() != 0, "pthread_id was not set as expected");
@@ -863,7 +863,7 @@ static void *thread_native_entry(Thread *thread) {
863863
// Prevent dereferencing it from here on out.
864864
thread = nullptr;
865865

866-
log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").",
866+
log_info(os, thread)("Thread finished (tid: %zu, pthread id: %zu).",
867867
os::current_thread_id(), (uintx) pthread_self());
868868

869869
return nullptr;
@@ -1054,15 +1054,15 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
10541054

10551055
char buf[64];
10561056
if (ret == 0) {
1057-
log_info(os, thread)("Thread \"%s\" started (pthread id: " UINTX_FORMAT ", attributes: %s). ",
1057+
log_info(os, thread)("Thread \"%s\" started (pthread id: %zu, attributes: %s). ",
10581058
thread->name(), (uintx) tid, os::Posix::describe_pthread_attr(buf, sizeof(buf), &attr));
10591059

10601060
// Print current timer slack if override is enabled and timer slack value is available.
10611061
// Avoid calling prctl otherwise for extra safety.
10621062
if (TimerSlack >= 0) {
10631063
int slack = prctl(PR_GET_TIMERSLACK);
10641064
if (slack >= 0) {
1065-
log_info(os, thread)("Thread \"%s\" (pthread id: " UINTX_FORMAT ") timer slack: %dns",
1065+
log_info(os, thread)("Thread \"%s\" (pthread id: %zu) timer slack: %dns",
10661066
thread->name(), (uintx) tid, slack);
10671067
}
10681068
}
@@ -1170,7 +1170,7 @@ bool os::create_attached_thread(JavaThread* thread) {
11701170
// and save the caller's signal mask
11711171
PosixSignals::hotspot_sigmask(thread);
11721172

1173-
log_info(os, thread)("Thread attached (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT
1173+
log_info(os, thread)("Thread attached (tid: %zu, pthread id: %zu"
11741174
", stack: " PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "K) ).",
11751175
os::current_thread_id(), (uintx) pthread_self(),
11761176
p2i(thread->stack_base()), p2i(thread->stack_end()), thread->stack_size() / K);
@@ -1366,12 +1366,9 @@ void os::Linux::capture_initial_stack(size_t max_size) {
13661366
// Skip blank chars
13671367
do { s++; } while (s && isspace((unsigned char) *s));
13681368

1369-
#define _UFM UINTX_FORMAT
1370-
#define _DFM INTX_FORMAT
1371-
1372-
// 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
1373-
// 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
1374-
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,
1369+
// 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
1370+
// 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
1371+
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",
13751372
&state, // 3 %c
13761373
&ppid, // 4 %d
13771374
&pgrp, // 5 %d
@@ -1391,18 +1388,15 @@ void os::Linux::capture_initial_stack(size_t max_size) {
13911388
&nice, // 19 %ld
13921389
&junk, // 20 %ld
13931390
&it_real, // 21 %ld
1394-
&start, // 22 UINTX_FORMAT
1395-
&vsize, // 23 UINTX_FORMAT
1396-
&rss, // 24 INTX_FORMAT
1397-
&rsslim, // 25 UINTX_FORMAT
1398-
&scodes, // 26 UINTX_FORMAT
1399-
&ecode, // 27 UINTX_FORMAT
1400-
&stack_start); // 28 UINTX_FORMAT
1391+
&start, // 22 %zu
1392+
&vsize, // 23 %zu
1393+
&rss, // 24 %zd
1394+
&rsslim, // 25 %zu
1395+
&scodes, // 26 %zu
1396+
&ecode, // 27 %zu
1397+
&stack_start); // 28 %zu
14011398
}
14021399

1403-
#undef _UFM
1404-
#undef _DFM
1405-
14061400
if (i != 28 - 2) {
14071401
assert(false, "Bad conversion from /proc/self/stat");
14081402
// product mode - assume we are the primordial thread, good luck in the
@@ -5279,7 +5273,7 @@ bool os::start_debugging(char *buf, int buflen) {
52795273
jio_snprintf(p, buflen-len,
52805274
"\n\n"
52815275
"Do you want to debug the problem?\n\n"
5282-
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
5276+
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread %zu (" INTPTR_FORMAT ")\n"
52835277
"Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
52845278
"Otherwise, press RETURN to abort...",
52855279
os::current_process_id(), os::current_process_id(),

0 commit comments

Comments
 (0)