8347566: Replace SSIZE_FORMAT with 'z' length modifier

Reviewed-by: dlong, dholmes, kbarrett
This commit is contained in:
Coleen Phillimore 2025-01-14 12:33:56 +00:00
parent f0af830f85
commit b4cd3b1296
7 changed files with 78 additions and 79 deletions

View File

@ -2306,14 +2306,14 @@ bool os::Linux::query_process_memory_info(os::Linux::meminfo_t* info) {
info->rssanon = info->rssfile = info->rssshmem = -1;
if (f != nullptr) {
while (::fgets(buf, sizeof(buf), f) != nullptr && num_found < num_values) {
if ( (info->vmsize == -1 && sscanf(buf, "VmSize: " SSIZE_FORMAT " kB", &info->vmsize) == 1) ||
(info->vmpeak == -1 && sscanf(buf, "VmPeak: " SSIZE_FORMAT " kB", &info->vmpeak) == 1) ||
(info->vmswap == -1 && sscanf(buf, "VmSwap: " SSIZE_FORMAT " kB", &info->vmswap) == 1) ||
(info->vmhwm == -1 && sscanf(buf, "VmHWM: " SSIZE_FORMAT " kB", &info->vmhwm) == 1) ||
(info->vmrss == -1 && sscanf(buf, "VmRSS: " SSIZE_FORMAT " kB", &info->vmrss) == 1) ||
(info->rssanon == -1 && sscanf(buf, "RssAnon: " SSIZE_FORMAT " kB", &info->rssanon) == 1) || // Needs Linux 4.5
(info->rssfile == -1 && sscanf(buf, "RssFile: " SSIZE_FORMAT " kB", &info->rssfile) == 1) || // Needs Linux 4.5
(info->rssshmem == -1 && sscanf(buf, "RssShmem: " SSIZE_FORMAT " kB", &info->rssshmem) == 1) // Needs Linux 4.5
if ( (info->vmsize == -1 && sscanf(buf, "VmSize: %zd kB", &info->vmsize) == 1) ||
(info->vmpeak == -1 && sscanf(buf, "VmPeak: %zd kB", &info->vmpeak) == 1) ||
(info->vmswap == -1 && sscanf(buf, "VmSwap: %zd kB", &info->vmswap) == 1) ||
(info->vmhwm == -1 && sscanf(buf, "VmHWM: %zd kB", &info->vmhwm) == 1) ||
(info->vmrss == -1 && sscanf(buf, "VmRSS: %zd kB", &info->vmrss) == 1) ||
(info->rssanon == -1 && sscanf(buf, "RssAnon: %zd kB", &info->rssanon) == 1) || // Needs Linux 4.5
(info->rssfile == -1 && sscanf(buf, "RssFile: %zd kB", &info->rssfile) == 1) || // Needs Linux 4.5
(info->rssshmem == -1 && sscanf(buf, "RssShmem: %zd kB", &info->rssshmem) == 1) // Needs Linux 4.5
)
{
num_found ++;
@ -2361,15 +2361,15 @@ void os::Linux::print_process_memory_info(outputStream* st) {
// rss its components if the kernel is recent enough.
meminfo_t info;
if (query_process_memory_info(&info)) {
st->print_cr("Virtual Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", info.vmsize, info.vmpeak);
st->print("Resident Set Size: " SSIZE_FORMAT "K (peak: " SSIZE_FORMAT "K)", info.vmrss, info.vmhwm);
st->print_cr("Virtual Size: %zdK (peak: %zdK)", info.vmsize, info.vmpeak);
st->print("Resident Set Size: %zdK (peak: %zdK)", info.vmrss, info.vmhwm);
if (info.rssanon != -1) { // requires kernel >= 4.5
st->print(" (anon: " SSIZE_FORMAT "K, file: " SSIZE_FORMAT "K, shmem: " SSIZE_FORMAT "K)",
st->print(" (anon: %zdK, file: %zdK, shmem: %zdK)",
info.rssanon, info.rssfile, info.rssshmem);
}
st->cr();
if (info.vmswap != -1) { // requires kernel >= 2.6.34
st->print_cr("Swapped out: " SSIZE_FORMAT "K", info.vmswap);
st->print_cr("Swapped out: %zdK", info.vmswap);
}
} else {
st->print_cr("Could not open /proc/self/status to get process memory related information");

View File

@ -565,7 +565,7 @@ CodeBlob* CodeCache::allocate(uint size, CodeBlobType code_blob_type, bool handl
} else {
tty->print("CodeCache");
}
tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%zd bytes)",
(intptr_t)heap->low_boundary(), (intptr_t)heap->high(),
(address)heap->high() - (address)heap->low_boundary());
}
@ -1491,10 +1491,10 @@ void CodeCache::print_memory_overhead() {
}
// Print bytes that are allocated in the freelist
ttyLocker ttl;
tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT, freelists_length());
tty->print_cr("Allocated in freelist: " SSIZE_FORMAT "kB", bytes_allocated_in_freelists()/K);
tty->print_cr("Unused bytes in CodeBlobs: " SSIZE_FORMAT "kB", (wasted_bytes/K));
tty->print_cr("Segment map size: " SSIZE_FORMAT "kB", allocated_segments()/K); // 1 byte per segment
tty->print_cr("Number of elements in freelist: %zd", freelists_length());
tty->print_cr("Allocated in freelist: %zdkB", bytes_allocated_in_freelists()/K);
tty->print_cr("Unused bytes in CodeBlobs: %zdkB", (wasted_bytes/K));
tty->print_cr("Segment map size: %zdkB", allocated_segments()/K); // 1 byte per segment
}
//------------------------------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
/*
* Copyright (c) 2016, 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
@ -65,7 +66,7 @@ public:
bool has_next() const {
if (_idx <= _end) {
assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, _idx);
assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: %zd", _idx);
return true;
}
return false;
@ -96,7 +97,7 @@ public:
bool has_next() const {
if (_idx >= _end) {
assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, _idx);
assert(_partitions->in_free_set(_partition, _idx), "Boundaries or find_last_set_bit failed: %zd", _idx);
return true;
}
return false;
@ -114,17 +115,17 @@ public:
#ifndef PRODUCT
void ShenandoahRegionPartitions::dump_bitmap() const {
log_debug(gc)("Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "], Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT
"], Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]",
log_debug(gc)("Mutator range [%zd, %zd], Collector range [%zd, %zd"
"], Old Collector range [%zd, %zd]",
_leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)],
_rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)],
_leftmosts[int(ShenandoahFreeSetPartitionId::Collector)],
_rightmosts[int(ShenandoahFreeSetPartitionId::Collector)],
_leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)],
_rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)]);
log_debug(gc)("Empty Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT
"], Empty Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT
"], Empty Old Collecto range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]",
log_debug(gc)("Empty Mutator range [%zd, %zd"
"], Empty Collector range [%zd, %zd"
"], Empty Old Collecto range [%zd, %zd]",
_leftmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)],
_rightmosts_empty[int(ShenandoahFreeSetPartitionId::Mutator)],
_leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)],
@ -156,7 +157,7 @@ void ShenandoahRegionPartitions::dump_bitmap_row(idx_t region_idx) const {
uintx old_collector_bits = _membership[int(ShenandoahFreeSetPartitionId::OldCollector)].bits_at(aligned_idx);
uintx free_bits = mutator_bits | collector_bits | old_collector_bits;
uintx notfree_bits = ~free_bits;
log_debug(gc)(SSIZE_FORMAT_W(6) ": " SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0,
log_debug(gc)("%6zd : " SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0 " 0x" SIZE_FORMAT_X_0,
aligned_idx, mutator_bits, collector_bits, old_collector_bits, notfree_bits);
}
#endif
@ -428,7 +429,7 @@ void ShenandoahRegionPartitions::move_from_partition_to_partition(idx_t idx, She
size_t used = _region_size_bytes - available;
assert (_used[int(orig_partition)] >= used,
"Orig partition used: " SIZE_FORMAT " must exceed moved used: " SIZE_FORMAT " within region " SSIZE_FORMAT,
"Orig partition used: " SIZE_FORMAT " must exceed moved used: " SIZE_FORMAT " within region %zd",
_used[int(orig_partition)], used, idx);
_membership[int(orig_partition)].clear_bit(idx);
@ -543,7 +544,7 @@ idx_t ShenandoahRegionPartitions::leftmost_empty(ShenandoahFreeSetPartitionId wh
}
for (idx_t idx = find_index_of_next_available_region(which_partition, _leftmosts_empty[int(which_partition)]);
idx < max_regions; ) {
assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, idx);
assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: %zd", idx);
if (_free_set->alloc_capacity(idx) == _region_size_bytes) {
_leftmosts_empty[int(which_partition)] = idx;
return idx;
@ -562,7 +563,7 @@ idx_t ShenandoahRegionPartitions::rightmost_empty(ShenandoahFreeSetPartitionId w
}
for (idx_t idx = find_index_of_previous_available_region(which_partition, _rightmosts_empty[int(which_partition)]);
idx >= 0; ) {
assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: " SSIZE_FORMAT, idx);
assert(in_free_set(which_partition, idx), "Boundaries or find_last_set_bit failed: %zd", idx);
if (_free_set->alloc_capacity(idx) == _region_size_bytes) {
_rightmosts_empty[int(which_partition)] = idx;
return idx;
@ -625,103 +626,103 @@ void ShenandoahRegionPartitions::assert_bounds() {
// Performance invariants. Failing these would not break the free partition, but performance would suffer.
assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) <= _max,
"leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Mutator), _max);
"leftmost in bounds: %zd < %zd", leftmost(ShenandoahFreeSetPartitionId::Mutator), _max);
assert (rightmost(ShenandoahFreeSetPartitionId::Mutator) < _max,
"rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Mutator), _max);
"rightmost in bounds: %zd < %zd", rightmost(ShenandoahFreeSetPartitionId::Mutator), _max);
assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) == _max
|| partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::Mutator), ShenandoahFreeSetPartitionId::Mutator),
"leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Mutator));
"leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::Mutator));
assert (leftmost(ShenandoahFreeSetPartitionId::Mutator) == _max
|| partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::Mutator), ShenandoahFreeSetPartitionId::Mutator),
"rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Mutator));
"rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::Mutator));
// If Mutator partition is empty, leftmosts will both equal max, rightmosts will both equal zero.
// Likewise for empty region partitions.
idx_t beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)];
idx_t end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)];
assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Mutator),
"free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions before the leftmost: %zd, bound %zd",
beg_off, leftmost(ShenandoahFreeSetPartitionId::Mutator));
assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Mutator),
"free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions past the rightmost: %zd, bound %zd",
end_off, rightmost(ShenandoahFreeSetPartitionId::Mutator));
beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Mutator)];
end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Mutator)];
assert (beg_off >= leftmost_empty(ShenandoahFreeSetPartitionId::Mutator),
"free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions before the leftmost: %zd, bound %zd",
beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Mutator));
assert (end_off <= rightmost_empty(ShenandoahFreeSetPartitionId::Mutator),
"free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions past the rightmost: %zd, bound %zd",
end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Mutator));
// Performance invariants. Failing these would not break the free partition, but performance would suffer.
assert (leftmost(ShenandoahFreeSetPartitionId::Collector) <= _max, "leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT,
assert (leftmost(ShenandoahFreeSetPartitionId::Collector) <= _max, "leftmost in bounds: %zd < %zd",
leftmost(ShenandoahFreeSetPartitionId::Collector), _max);
assert (rightmost(ShenandoahFreeSetPartitionId::Collector) < _max, "rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT,
assert (rightmost(ShenandoahFreeSetPartitionId::Collector) < _max, "rightmost in bounds: %zd < %zd",
rightmost(ShenandoahFreeSetPartitionId::Collector), _max);
assert (leftmost(ShenandoahFreeSetPartitionId::Collector) == _max
|| partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::Collector), ShenandoahFreeSetPartitionId::Collector),
"leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::Collector));
"leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::Collector));
assert (leftmost(ShenandoahFreeSetPartitionId::Collector) == _max
|| partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::Collector), ShenandoahFreeSetPartitionId::Collector),
"rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::Collector));
"rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::Collector));
// If Collector partition is empty, leftmosts will both equal max, rightmosts will both equal zero.
// Likewise for empty region partitions.
beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::Collector)];
end_off = rightmosts[int(ShenandoahFreeSetPartitionId::Collector)];
assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::Collector),
"free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions before the leftmost: %zd, bound %zd",
beg_off, leftmost(ShenandoahFreeSetPartitionId::Collector));
assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::Collector),
"free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions past the rightmost: %zd, bound %zd",
end_off, rightmost(ShenandoahFreeSetPartitionId::Collector));
beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::Collector)];
end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::Collector)];
assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)],
"free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions before the leftmost: %zd, bound %zd",
beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::Collector));
assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::Collector)],
"free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions past the rightmost: %zd, bound %zd",
end_off, rightmost_empty(ShenandoahFreeSetPartitionId::Collector));
// Performance invariants. Failing these would not break the free partition, but performance would suffer.
assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= _max, "leftmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT,
assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) <= _max, "leftmost in bounds: %zd < %zd",
leftmost(ShenandoahFreeSetPartitionId::OldCollector), _max);
assert (rightmost(ShenandoahFreeSetPartitionId::OldCollector) < _max, "rightmost in bounds: " SSIZE_FORMAT " < " SSIZE_FORMAT,
assert (rightmost(ShenandoahFreeSetPartitionId::OldCollector) < _max, "rightmost in bounds: %zd < %zd",
rightmost(ShenandoahFreeSetPartitionId::OldCollector), _max);
assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) == _max
|| partition_id_matches(leftmost(ShenandoahFreeSetPartitionId::OldCollector),
ShenandoahFreeSetPartitionId::OldCollector),
"leftmost region should be free: " SSIZE_FORMAT, leftmost(ShenandoahFreeSetPartitionId::OldCollector));
"leftmost region should be free: %zd", leftmost(ShenandoahFreeSetPartitionId::OldCollector));
assert (leftmost(ShenandoahFreeSetPartitionId::OldCollector) == _max
|| partition_id_matches(rightmost(ShenandoahFreeSetPartitionId::OldCollector),
ShenandoahFreeSetPartitionId::OldCollector),
"rightmost region should be free: " SSIZE_FORMAT, rightmost(ShenandoahFreeSetPartitionId::OldCollector));
"rightmost region should be free: %zd", rightmost(ShenandoahFreeSetPartitionId::OldCollector));
// If OldCollector partition is empty, leftmosts will both equal max, rightmosts will both equal zero.
// Likewise for empty region partitions.
beg_off = leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)];
end_off = rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)];
assert (beg_off >= leftmost(ShenandoahFreeSetPartitionId::OldCollector),
"free regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions before the leftmost: %zd, bound %zd",
beg_off, leftmost(ShenandoahFreeSetPartitionId::OldCollector));
assert (end_off <= rightmost(ShenandoahFreeSetPartitionId::OldCollector),
"free regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free regions past the rightmost: %zd, bound %zd",
end_off, rightmost(ShenandoahFreeSetPartitionId::OldCollector));
beg_off = empty_leftmosts[int(ShenandoahFreeSetPartitionId::OldCollector)];
end_off = empty_rightmosts[int(ShenandoahFreeSetPartitionId::OldCollector)];
assert (beg_off >= _leftmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)],
"free empty regions before the leftmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions before the leftmost: %zd, bound %zd",
beg_off, leftmost_empty(ShenandoahFreeSetPartitionId::OldCollector));
assert (end_off <= _rightmosts_empty[int(ShenandoahFreeSetPartitionId::OldCollector)],
"free empty regions past the rightmost: " SSIZE_FORMAT ", bound " SSIZE_FORMAT,
"free empty regions past the rightmost: %zd, bound %zd",
end_off, rightmost_empty(ShenandoahFreeSetPartitionId::OldCollector));
}
#endif
@ -1450,8 +1451,8 @@ void ShenandoahFreeSet::find_regions_with_alloc_capacity(size_t &young_cset_regi
rightmost_empty_idx = (old_collector_leftmost_empty == max_regions)? -1: (idx_t) old_collector_rightmost_empty;
_partitions.establish_old_collector_intervals(old_collector_leftmost, rightmost_idx, old_collector_leftmost_empty,
rightmost_empty_idx, old_collector_regions, old_collector_used);
log_debug(gc)(" After find_regions_with_alloc_capacity(), Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "],"
" Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]",
log_debug(gc)(" After find_regions_with_alloc_capacity(), Mutator range [%zd, %zd],"
" Old Collector range [%zd, %zd]",
_partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector),
@ -1713,8 +1714,8 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old
_partitions.move_from_partition_to_partition(idx, ShenandoahFreeSetPartitionId::Mutator,
ShenandoahFreeSetPartitionId::OldCollector, ac);
log_debug(gc)(" Shifting region " SIZE_FORMAT " from mutator_free to old_collector_free", idx);
log_debug(gc)(" Shifted Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "],"
" Old Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]",
log_debug(gc)(" Shifted Mutator range [%zd, %zd],"
" Old Collector range [%zd, %zd]",
_partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.leftmost(ShenandoahFreeSetPartitionId::OldCollector),
@ -1736,8 +1737,8 @@ void ShenandoahFreeSet::reserve_regions(size_t to_reserve, size_t to_reserve_old
_partitions.move_from_partition_to_partition(idx, ShenandoahFreeSetPartitionId::Mutator,
ShenandoahFreeSetPartitionId::Collector, ac);
log_debug(gc)(" Shifting region " SIZE_FORMAT " from mutator_free to collector_free", idx);
log_debug(gc)(" Shifted Mutator range [" SSIZE_FORMAT ", " SSIZE_FORMAT "],"
" Collector range [" SSIZE_FORMAT ", " SSIZE_FORMAT "]",
log_debug(gc)(" Shifted Mutator range [%zd, %zd],"
" Collector range [%zd, %zd]",
_partitions.leftmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.rightmost(ShenandoahFreeSetPartitionId::Mutator),
_partitions.leftmost(ShenandoahFreeSetPartitionId::Collector),

View File

@ -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
@ -95,7 +96,7 @@ size_t ShenandoahSimpleBitMap::count_trailing_ones(idx_t last_idx) const {
bool ShenandoahSimpleBitMap::is_forward_consecutive_ones(idx_t start_idx, idx_t count) const {
while (count > 0) {
assert((start_idx >= 0) && (start_idx < _num_bits), "precondition: start_idx: " SSIZE_FORMAT ", count: " SSIZE_FORMAT,
assert((start_idx >= 0) && (start_idx < _num_bits), "precondition: start_idx: %zd, count: %zd",
start_idx, count);
assert(start_idx + count <= (idx_t) _num_bits, "precondition");
size_t array_idx = start_idx >> LogBitsPerWord;

View File

@ -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
@ -554,7 +554,7 @@ void MemSummaryDiffReporter::print_malloc_diff(size_t current_amount, size_t cur
out->print(" #" SIZE_FORMAT "", current_count);
const ssize_t delta_count = counter_diff(current_count, early_count);
if (delta_count != 0) {
out->print(" " SSIZE_PLUS_FORMAT, delta_count);
out->print(" %+zd", delta_count);
}
}
}
@ -572,7 +572,7 @@ void MemSummaryDiffReporter::print_arena_diff(size_t current_amount, size_t curr
out->print(" #" SIZE_FORMAT "", current_count);
const ssize_t delta_count = counter_diff(current_count, early_count);
if (delta_count != 0) {
out->print(" " SSIZE_PLUS_FORMAT, delta_count);
out->print(" %+zd", delta_count);
}
}
@ -650,7 +650,7 @@ void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag,
const ssize_t class_count_diff =
counter_diff(_current_baseline.class_count(), _early_baseline.class_count());
if (class_count_diff != 0) {
out->print(" " SSIZE_PLUS_FORMAT, class_count_diff);
out->print(" %+zd", class_count_diff);
}
out->print_cr(")");
@ -658,13 +658,13 @@ void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag,
const ssize_t instance_class_count_diff =
counter_diff(_current_baseline.instance_class_count(), _early_baseline.instance_class_count());
if (instance_class_count_diff != 0) {
out->print(" " SSIZE_PLUS_FORMAT, instance_class_count_diff);
out->print(" %+zd", instance_class_count_diff);
}
out->print(", array classes #" SIZE_FORMAT, _current_baseline.array_class_count());
const ssize_t array_class_count_diff =
counter_diff(_current_baseline.array_class_count(), _early_baseline.array_class_count());
if (array_class_count_diff != 0) {
out->print(" " SSIZE_PLUS_FORMAT, array_class_count_diff);
out->print(" %+zd", array_class_count_diff);
}
out->print_cr(")");
@ -673,7 +673,7 @@ void MemSummaryDiffReporter::diff_summary_of_type(MemTag mem_tag,
out->print("(threads #" SIZE_FORMAT, _current_baseline.thread_count());
const ssize_t thread_count_diff = counter_diff(_current_baseline.thread_count(), _early_baseline.thread_count());
if (thread_count_diff != 0) {
out->print(" " SSIZE_PLUS_FORMAT, thread_count_diff);
out->print(" %+zd", thread_count_diff);
}
out->print_cr(")");

View File

@ -136,9 +136,6 @@ class oopDesc;
#define UINT64_FORMAT_0 "%016" PRIx64
// Format integers which change size between 32- and 64-bit.
#define SSIZE_FORMAT "%" PRIdPTR
#define SSIZE_PLUS_FORMAT "%+" PRIdPTR
#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR
#define SIZE_FORMAT "%" PRIuPTR
#define SIZE_FORMAT_X "0x%" PRIxPTR
#ifdef _LP64

View File

@ -261,16 +261,16 @@ TEST(globalDefinitions, format_specifiers) {
check_format(UINT64_FORMAT_W(5), (uint64_t)123, " 123");
check_format(UINT64_FORMAT_W(-5), (uint64_t)123, "123 ");
check_format(SSIZE_FORMAT, (ssize_t)123, "123");
check_format(SSIZE_FORMAT, (ssize_t)-123, "-123");
check_format(SSIZE_FORMAT, (ssize_t)2147483647, "2147483647");
check_format(SSIZE_FORMAT, (ssize_t)-2147483647, "-2147483647");
check_format(SSIZE_PLUS_FORMAT, (ssize_t)123, "+123");
check_format(SSIZE_PLUS_FORMAT, (ssize_t)-123, "-123");
check_format(SSIZE_PLUS_FORMAT, (ssize_t)2147483647, "+2147483647");
check_format(SSIZE_PLUS_FORMAT, (ssize_t)-2147483647, "-2147483647");
check_format(SSIZE_FORMAT_W(5), (ssize_t)123, " 123");
check_format(SSIZE_FORMAT_W(-5), (ssize_t)123, "123 ");
check_format("%zd", (ssize_t)123, "123");
check_format("%zd", (ssize_t)-123, "-123");
check_format("%zd", (ssize_t)2147483647, "2147483647");
check_format("%zd", (ssize_t)-2147483647, "-2147483647");
check_format("%+zd", (ssize_t)123, "+123");
check_format("%+zd", (ssize_t)-123, "-123");
check_format("%+zd", (ssize_t)2147483647, "+2147483647");
check_format("%+zd", (ssize_t)-2147483647, "-2147483647");
check_format("%5zd", (ssize_t)123, " 123");
check_format("%-5zd", (ssize_t)123, "123 ");
check_format(SIZE_FORMAT, (size_t)123u, "123");
check_format(SIZE_FORMAT_X, (size_t)0x123u, "0x123");
check_format(SIZE_FORMAT_X_0, (size_t)0x123u, "0x" LP64_ONLY("00000000") "00000123");