Skip to content

Commit 8369250

Browse files
coleenppull[bot]
authored andcommitted
8347730: Replace SIZE_FORMAT in g1
Reviewed-by: kbarrett, tschatzl
1 parent 240db35 commit 8369250

37 files changed

+177
-177
lines changed

src/hotspot/share/gc/g1/g1AllocRegion.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 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
@@ -225,10 +225,10 @@ void G1AllocRegion::trace(const char* str, size_t min_word_size, size_t desired_
225225

226226
if (detailed_info) {
227227
if (result != nullptr) {
228-
out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT " actual " SIZE_FORMAT " " PTR_FORMAT,
228+
out->print(" min %zu desired %zu actual %zu " PTR_FORMAT,
229229
min_word_size, desired_word_size, actual_word_size, p2i(result));
230230
} else if (min_word_size != 0) {
231-
out->print(" min " SIZE_FORMAT " desired " SIZE_FORMAT, min_word_size, desired_word_size);
231+
out->print(" min %zu desired %zu", min_word_size, desired_word_size);
232232
}
233233
}
234234
out->cr();
@@ -319,7 +319,7 @@ G1HeapRegion* MutatorAllocRegion::release() {
319319
_wasted_bytes += retire_internal(_retained_alloc_region, false);
320320
_retained_alloc_region = nullptr;
321321
}
322-
log_debug(gc, alloc, region)("Mutator Allocation stats, regions: %u, wasted size: " SIZE_FORMAT "%s (%4.1f%%)",
322+
log_debug(gc, alloc, region)("Mutator Allocation stats, regions: %u, wasted size: %zu%s (%4.1f%%)",
323323
count(),
324324
byte_size_in_proper_unit(_wasted_bytes),
325325
proper_unit_for_byte_size(_wasted_bytes),

src/hotspot/share/gc/g1/g1Allocator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 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
@@ -218,7 +218,7 @@ HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,
218218
size_t temp = 0;
219219
HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, node_index);
220220
assert(result == nullptr || temp == word_size,
221-
"Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,
221+
"Requested %zu words, but got %zu at " PTR_FORMAT,
222222
word_size, temp, p2i(result));
223223
return result;
224224
}

src/hotspot/share/gc/g1/g1BiasedArray.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 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
@@ -48,20 +48,20 @@ address G1BiasedMappedArrayBase::create_new_base_array(size_t length, size_t ele
4848
#ifndef PRODUCT
4949
void G1BiasedMappedArrayBase::verify_index(idx_t index) const {
5050
guarantee(_base != nullptr, "Array not initialized");
51-
guarantee(index < length(), "Index out of bounds index: " SIZE_FORMAT " length: " SIZE_FORMAT, index, length());
51+
guarantee(index < length(), "Index out of bounds index: %zu length: %zu", index, length());
5252
}
5353

5454
void G1BiasedMappedArrayBase::verify_biased_index(idx_t biased_index) const {
5555
guarantee(_biased_base != nullptr, "Array not initialized");
5656
guarantee(biased_index >= bias() && biased_index < (bias() + length()),
57-
"Biased index out of bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT,
57+
"Biased index out of bounds, index: %zu bias: %zu length: %zu",
5858
biased_index, bias(), length());
5959
}
6060

6161
void G1BiasedMappedArrayBase::verify_biased_index_inclusive_end(idx_t biased_index) const {
6262
guarantee(_biased_base != nullptr, "Array not initialized");
6363
guarantee(biased_index >= bias() && biased_index <= (bias() + length()),
64-
"Biased index out of inclusive bounds, index: " SIZE_FORMAT " bias: " SIZE_FORMAT " length: " SIZE_FORMAT,
64+
"Biased index out of inclusive bounds, index: %zu bias: %zu length: %zu",
6565
biased_index, bias(), length());
6666
}
6767

src/hotspot/share/gc/g1/g1BiasedArray.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 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
@@ -72,12 +72,12 @@ class G1BiasedMappedArrayBase : public CHeapObj<mtGC> {
7272
void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) {
7373
assert(mapping_granularity_in_bytes > 0, "just checking");
7474
assert(is_power_of_2(mapping_granularity_in_bytes),
75-
"mapping granularity must be power of 2, is " SIZE_FORMAT, mapping_granularity_in_bytes);
75+
"mapping granularity must be power of 2, is %zu", mapping_granularity_in_bytes);
7676
assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
77-
"bottom mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT,
77+
"bottom mapping area address must be a multiple of mapping granularity %zu, is " PTR_FORMAT,
7878
mapping_granularity_in_bytes, p2i(bottom));
7979
assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
80-
"end mapping area address must be a multiple of mapping granularity " SIZE_FORMAT ", is " PTR_FORMAT,
80+
"end mapping area address must be a multiple of mapping granularity %zu, is " PTR_FORMAT,
8181
mapping_granularity_in_bytes, p2i(end));
8282
size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes);
8383
idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;

src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 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
@@ -44,7 +44,7 @@ G1BlockOffsetTable::G1BlockOffsetTable(MemRegion heap, G1RegionToSpaceMapper* st
4444
_offset_base = ((uint8_t*)bot_reserved.start() - (uintptr_t(_reserved.start()) >> CardTable::card_shift()));
4545

4646
log_trace(gc, bot)("G1BlockOffsetTable::G1BlockOffsetTable: ");
47-
log_trace(gc, bot)(" rs.base(): " PTR_FORMAT " rs.size(): " SIZE_FORMAT " rs end(): " PTR_FORMAT,
47+
log_trace(gc, bot)(" rs.base(): " PTR_FORMAT " rs.size(): %zu rs end(): " PTR_FORMAT,
4848
p2i(bot_reserved.start()), bot_reserved.byte_size(), p2i(bot_reserved.end()));
4949
}
5050

src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 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
@@ -47,7 +47,7 @@ class G1BlockOffsetTable: public CHeapObj<mtGC> {
4747

4848
void check_offset(size_t offset, const char* msg) const {
4949
assert(offset < CardTable::card_size_in_words(),
50-
"%s - offset: " SIZE_FORMAT ", N_words: %u",
50+
"%s - offset: %zu, N_words: %u",
5151
msg, offset, CardTable::card_size_in_words());
5252
}
5353

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 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
@@ -179,11 +179,11 @@ G1HeapRegion* G1CollectedHeap::new_region(size_t word_size,
179179
// safepoint.
180180
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
181181

182-
log_debug(gc, ergo, heap)("Attempt heap expansion (region allocation request failed). Allocation request: " SIZE_FORMAT "B",
182+
log_debug(gc, ergo, heap)("Attempt heap expansion (region allocation request failed). Allocation request: %zuB",
183183
word_size * HeapWordSize);
184184

185185
assert(word_size * HeapWordSize < G1HeapRegion::GrainBytes,
186-
"This kind of expansion should never be more than one region. Size: " SIZE_FORMAT,
186+
"This kind of expansion should never be more than one region. Size: %zu",
187187
word_size * HeapWordSize);
188188
if (expand_single_region(node_index)) {
189189
// Given that expand_single_region() succeeded in expanding the heap, and we
@@ -335,7 +335,7 @@ G1CollectedHeap::humongous_obj_allocate_initialize_regions(G1HeapRegion* first_h
335335
}
336336

337337
size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) {
338-
assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size);
338+
assert(is_humongous(word_size), "Object of size %zu must be humongous here", word_size);
339339
return align_up(word_size, G1HeapRegion::GrainWords) / G1HeapRegion::GrainWords;
340340
}
341341

@@ -358,7 +358,7 @@ HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
358358
humongous_start = _hrm.expand_and_allocate_humongous(obj_regions);
359359
if (humongous_start != nullptr) {
360360
// We managed to find a region by expanding the heap.
361-
log_debug(gc, ergo, heap)("Heap expansion (humongous allocation request). Allocation request: " SIZE_FORMAT "B",
361+
log_debug(gc, ergo, heap)("Heap expansion (humongous allocation request). Allocation request: %zuB",
362362
word_size * HeapWordSize);
363363
policy()->record_new_heap_size(num_regions());
364364
} else {
@@ -444,7 +444,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
444444
return result;
445445
}
446446

447-
log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating " SIZE_FORMAT " words",
447+
log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating %zu words",
448448
Thread::current()->name(), word_size);
449449

450450
// We can reach here if we were unsuccessful in scheduling a collection (because
@@ -462,7 +462,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
462462
// Give a warning if we seem to be looping forever.
463463
if ((QueuedAllocationWarningCount > 0) &&
464464
(try_count % QueuedAllocationWarningCount == 0)) {
465-
log_warning(gc, alloc)("%s: Retried allocation %u times for " SIZE_FORMAT " words",
465+
log_warning(gc, alloc)("%s: Retried allocation %u times for %zu words",
466466
Thread::current()->name(), try_count, word_size);
467467
}
468468
}
@@ -495,8 +495,8 @@ HeapWord* G1CollectedHeap::alloc_archive_region(size_t word_size, HeapWord* pref
495495
MemRegion reserved = _hrm.reserved();
496496

497497
if (reserved.word_size() <= word_size) {
498-
log_info(gc, heap)("Unable to allocate regions as archive heap is too large; size requested = " SIZE_FORMAT
499-
" bytes, heap = " SIZE_FORMAT " bytes", word_size, reserved.word_size());
498+
log_info(gc, heap)("Unable to allocate regions as archive heap is too large; size requested = %zu"
499+
" bytes, heap = %zu bytes", word_size, reserved.word_size());
500500
return nullptr;
501501
}
502502

@@ -514,7 +514,7 @@ HeapWord* G1CollectedHeap::alloc_archive_region(size_t word_size, HeapWord* pref
514514
}
515515
increase_used(word_size * HeapWordSize);
516516
if (commits != 0) {
517-
log_debug(gc, ergo, heap)("Attempt heap expansion (allocate archive regions). Total size: " SIZE_FORMAT "B",
517+
log_debug(gc, ergo, heap)("Attempt heap expansion (allocate archive regions). Total size: %zuB",
518518
G1HeapRegion::GrainWords * HeapWordSize * commits);
519519
}
520520

@@ -573,7 +573,7 @@ void G1CollectedHeap::dealloc_archive_regions(MemRegion range) {
573573
iterate_regions_in_range(range, dealloc_archive_region);
574574

575575
if (shrink_count != 0) {
576-
log_debug(gc, ergo, heap)("Attempt heap shrinking (CDS archive regions). Total size: " SIZE_FORMAT "B",
576+
log_debug(gc, ergo, heap)("Attempt heap shrinking (CDS archive regions). Total size: %zuB",
577577
G1HeapRegion::GrainWords * HeapWordSize * shrink_count);
578578
// Explicit uncommit.
579579
uncommit_regions(shrink_count);
@@ -673,7 +673,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) {
673673
return result;
674674
}
675675

676-
log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating " SIZE_FORMAT "",
676+
log_trace(gc, alloc)("%s: Unsuccessfully scheduled collection allocating %zu",
677677
Thread::current()->name(), word_size);
678678

679679
// We can reach here if we were unsuccessful in scheduling a collection (because
@@ -978,7 +978,7 @@ HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
978978
_verifier->verify_region_sets_optional();
979979

980980
size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes);
981-
log_debug(gc, ergo, heap)("Attempt heap expansion (allocation request failed). Allocation request: " SIZE_FORMAT "B",
981+
log_debug(gc, ergo, heap)("Attempt heap expansion (allocation request failed). Allocation request: %zuB",
982982
word_size * HeapWordSize);
983983

984984

@@ -995,7 +995,7 @@ bool G1CollectedHeap::expand(size_t expand_bytes, WorkerThreads* pretouch_worker
995995
size_t aligned_expand_bytes = os::align_up_vm_page_size(expand_bytes);
996996
aligned_expand_bytes = align_up(aligned_expand_bytes, G1HeapRegion::GrainBytes);
997997

998-
log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B",
998+
log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: %zuB expansion amount: %zuB",
999999
expand_bytes, aligned_expand_bytes);
10001000

10011001
if (is_maximal_no_gc()) {
@@ -1042,7 +1042,7 @@ void G1CollectedHeap::shrink_helper(size_t shrink_bytes) {
10421042
uint num_regions_removed = _hrm.shrink_by(num_regions_to_remove);
10431043
size_t shrunk_bytes = num_regions_removed * G1HeapRegion::GrainBytes;
10441044

1045-
log_debug(gc, ergo, heap)("Shrink the heap. requested shrinking amount: " SIZE_FORMAT "B aligned shrinking amount: " SIZE_FORMAT "B actual amount shrunk: " SIZE_FORMAT "B",
1045+
log_debug(gc, ergo, heap)("Shrink the heap. requested shrinking amount: %zuB aligned shrinking amount: %zuB actual amount shrunk: %zuB",
10461046
shrink_bytes, aligned_shrink_bytes, shrunk_bytes);
10471047
if (num_regions_removed > 0) {
10481048
log_debug(gc, heap)("Uncommittable regions after shrink: %u", num_regions_removed);
@@ -2117,12 +2117,12 @@ void G1CollectedHeap::print_on(outputStream* st) const {
21172117
p2i(_hrm.reserved().start()),
21182118
p2i(_hrm.reserved().end()));
21192119
st->cr();
2120-
st->print(" region size " SIZE_FORMAT "K, ", G1HeapRegion::GrainBytes / K);
2120+
st->print(" region size %zuK, ", G1HeapRegion::GrainBytes / K);
21212121
uint young_regions = young_regions_count();
2122-
st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2122+
st->print("%u young (%zuK), ", young_regions,
21232123
(size_t) young_regions * G1HeapRegion::GrainBytes / K);
21242124
uint survivor_regions = survivor_regions_count();
2125-
st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2125+
st->print("%u survivors (%zuK)", survivor_regions,
21262126
(size_t) survivor_regions * G1HeapRegion::GrainBytes / K);
21272127
st->cr();
21282128
if (_numa->is_enabled()) {
@@ -2774,7 +2774,7 @@ void G1CollectedHeap::increase_used(size_t bytes) {
27742774

27752775
void G1CollectedHeap::decrease_used(size_t bytes) {
27762776
assert(_summary_bytes_used >= bytes,
2777-
"invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT,
2777+
"invariant: _summary_bytes_used: %zu should be >= bytes: %zu",
27782778
_summary_bytes_used, bytes);
27792779
_summary_bytes_used -= bytes;
27802780
}

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 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
@@ -361,8 +361,8 @@ class G1CollectedHeap : public CollectedHeap {
361361
do { \
362362
size_t cur_used_bytes = g1h->used(); \
363363
size_t recal_used_bytes = g1h->recalculate_used(); \
364-
assert(cur_used_bytes == recal_used_bytes, "Used(" SIZE_FORMAT ") is not" \
365-
" same as recalculated used(" SIZE_FORMAT ").", \
364+
assert(cur_used_bytes == recal_used_bytes, "Used(%zu) is not" \
365+
" same as recalculated used(%zu).", \
366366
cur_used_bytes, recal_used_bytes); \
367367
} while (0)
368368
#else

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Lines changed: 2 additions & 2 deletions
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
* 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
@@ -284,7 +284,7 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi
284284

285285
size_t pending_cards = _policy->pending_cards_at_gc_start();
286286

287-
log_trace(gc, ergo, cset)("Start choosing CSet. Pending cards: " SIZE_FORMAT " target pause time: %1.2fms",
287+
log_trace(gc, ergo, cset)("Start choosing CSet. Pending cards: %zu target pause time: %1.2fms",
288288
pending_cards, target_pause_time_ms);
289289

290290
// The young list is laid with the survivor regions from the previous

src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 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
@@ -224,7 +224,7 @@ class G1BuildCandidateRegionsTask : public WorkerTask {
224224
num_pruned++;
225225
}
226226

227-
log_debug(gc, ergo, cset)("Pruned %u regions out of %u, leaving " SIZE_FORMAT " bytes waste (allowed " SIZE_FORMAT ")",
227+
log_debug(gc, ergo, cset)("Pruned %u regions out of %u, leaving %zu bytes waste (allowed %zu)",
228228
num_pruned,
229229
num_candidates,
230230
wasted_bytes,

0 commit comments

Comments
 (0)