From c36200b09801d8a96a3d3239c15fef91010c3bbf Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 15 Jan 2025 12:16:58 +0000 Subject: [PATCH] 8347721: Replace SIZE_FORMAT in compiler directories Reviewed-by: kvn, dlong --- src/hotspot/share/code/codeCache.cpp | 32 ++++++++++++------------ src/hotspot/share/code/codeHeapState.cpp | 20 +++++++-------- src/hotspot/share/code/nmethod.cpp | 2 +- src/hotspot/share/code/vtableStubs.cpp | 2 +- src/hotspot/share/opto/parse1.cpp | 4 +-- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index 7407caf741a..ed8147a95a8 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -178,10 +178,10 @@ GrowableArray* CodeCache::_allocable_heaps = new(mtCode) GrowableArra static void check_min_size(const char* codeheap, size_t size, size_t required_size) { if (size < required_size) { - log_debug(codecache)("Code heap (%s) size " SIZE_FORMAT "K below required minimal size " SIZE_FORMAT "K", + log_debug(codecache)("Code heap (%s) size %zuK below required minimal size %zuK", codeheap, size/K, required_size/K); err_msg title("Not enough space in %s to run VM", codeheap); - err_msg message(SIZE_FORMAT "K < " SIZE_FORMAT "K", size/K, required_size/K); + err_msg message(SIZE_FORMAT "K < %zuK", size/K, required_size/K); vm_exit_during_initialization(title, message); } } @@ -256,15 +256,15 @@ void CodeCache::initialize_heaps() { size_t total = non_nmethod.size + profiled.size + non_profiled.size; if (total != cache_size && !cache_size_set) { - log_info(codecache)("ReservedCodeCache size " SIZE_FORMAT "K changed to total segments size NonNMethod " - SIZE_FORMAT "K NonProfiled " SIZE_FORMAT "K Profiled " SIZE_FORMAT "K = " SIZE_FORMAT "K", + log_info(codecache)("ReservedCodeCache size %zuK changed to total segments size NonNMethod " + "%zuK NonProfiled %zuK Profiled %zuK = %zuK", cache_size/K, non_nmethod.size/K, non_profiled.size/K, profiled.size/K, total/K); // Adjust ReservedCodeCacheSize as necessary because it was not set explicitly cache_size = total; } - log_debug(codecache)("Initializing code heaps ReservedCodeCache " SIZE_FORMAT "K NonNMethod " SIZE_FORMAT "K" - " NonProfiled " SIZE_FORMAT "K Profiled " SIZE_FORMAT "K", + log_debug(codecache)("Initializing code heaps ReservedCodeCache %zuK NonNMethod %zuK" + " NonProfiled %zuK Profiled %zuK", cache_size/K, non_nmethod.size/K, non_profiled.size/K, profiled.size/K); // Validation @@ -282,16 +282,16 @@ void CodeCache::initialize_heaps() { // ReservedCodeCacheSize was set explicitly, so report an error and abort if it doesn't match the segment sizes if (total != cache_size && cache_size_set) { - err_msg message("NonNMethodCodeHeapSize (" SIZE_FORMAT "K)", non_nmethod.size/K); + err_msg message("NonNMethodCodeHeapSize (%zuK)", non_nmethod.size/K); if (profiled.enabled) { - message.append(" + ProfiledCodeHeapSize (" SIZE_FORMAT "K)", profiled.size/K); + message.append(" + ProfiledCodeHeapSize (%zuK)", profiled.size/K); } if (non_profiled.enabled) { - message.append(" + NonProfiledCodeHeapSize (" SIZE_FORMAT "K)", non_profiled.size/K); + message.append(" + NonProfiledCodeHeapSize (%zuK)", non_profiled.size/K); } - message.append(" = " SIZE_FORMAT "K", total/K); + message.append(" = %zuK", total/K); message.append((total > cache_size) ? " is greater than " : " is less than "); - message.append("ReservedCodeCacheSize (" SIZE_FORMAT "K).", cache_size/K); + message.append("ReservedCodeCacheSize (%zuK).", cache_size/K); vm_exit_during_initialization("Invalid code heap sizes", message); } @@ -356,7 +356,7 @@ ReservedSpace CodeCache::reserve_heap_memory(size_t size, size_t rs_ps) { ReservedSpace rs = CodeMemoryReserver::reserve(rs_size, rs_align, rs_ps); if (!rs.is_reserved()) { - vm_exit_during_initialization(err_msg("Could not reserve enough space for code cache (" SIZE_FORMAT "K)", + vm_exit_during_initialization(err_msg("Could not reserve enough space for code cache (%zuK)", rs_size/K)); } @@ -437,7 +437,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, CodeBlobType code_b size_t size_initial = MIN2((size_t)InitialCodeCacheSize, rs.size()); size_initial = align_up(size_initial, rs.page_size()); if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) { - vm_exit_during_initialization(err_msg("Could not reserve enough space in %s (" SIZE_FORMAT "K)", + vm_exit_during_initialization(err_msg("Could not reserve enough space in %s (%zuK)", heap->name(), size_initial/K)); } @@ -1727,8 +1727,8 @@ void CodeCache::print_summary(outputStream* st, bool detailed) { total_used += used; total_max_used += max_used; total_free += free; - st->print_cr(" size=" SIZE_FORMAT "Kb used=" SIZE_FORMAT - "Kb max_used=" SIZE_FORMAT "Kb free=" SIZE_FORMAT "Kb", + st->print_cr(" size=%zuKb used=%zu" + "Kb max_used=%zuKb free=%zuKb", size, used, max_used, free); if (detailed) { @@ -1788,7 +1788,7 @@ void CodeCache::print_layout(outputStream* st) { void CodeCache::log_state(outputStream* st) { st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'" - " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'", + " adapters='" UINT32_FORMAT "' free_code_cache='%zu'", blob_count(), nmethod_count(), adapter_count(), unallocated_capacity()); } diff --git a/src/hotspot/share/code/codeHeapState.cpp b/src/hotspot/share/code/codeHeapState.cpp index 0fa7c7386c7..c577f86a3c3 100644 --- a/src/hotspot/share/code/codeHeapState.cpp +++ b/src/hotspot/share/code/codeHeapState.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, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -370,7 +370,7 @@ void CodeHeapState::prepare_StatArray(outputStream* out, size_t nElem, size_t gr if (StatArray == nullptr) { //---< just do nothing if allocation failed >--- out->print_cr("Statistics could not be collected for %s, probably out of memory.", heapName); - out->print_cr("Current granularity is " SIZE_FORMAT " bytes. Try a coarser granularity.", granularity); + out->print_cr("Current granularity is %zu bytes. Try a coarser granularity.", granularity); alloc_granules = 0; granule_size = 0; } else { @@ -621,11 +621,11 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular " collected data to be consistent. Only the method names and signatures\n" " are retrieved at print time. That may lead to rare cases where the\n" " name of a method is no longer available, e.g. because it was unloaded.\n"); - ast->print_cr(" CodeHeap committed size " SIZE_FORMAT "K (" SIZE_FORMAT "M), reserved size " SIZE_FORMAT "K (" SIZE_FORMAT "M), %d%% occupied.", + ast->print_cr(" CodeHeap committed size %zuK (%zuM), reserved size %zuK (%zuM), %d%% occupied.", size/(size_t)K, size/(size_t)M, res_size/(size_t)K, res_size/(size_t)M, (unsigned int)(100.0*size/res_size)); - ast->print_cr(" CodeHeap allocation segment size is " SIZE_FORMAT " bytes. This is the smallest possible granularity.", seg_size); - ast->print_cr(" CodeHeap (committed part) is mapped to " SIZE_FORMAT " granules of size " SIZE_FORMAT " bytes.", granules, granularity); - ast->print_cr(" Each granule takes " SIZE_FORMAT " bytes of C heap, that is " SIZE_FORMAT "K in total for statistics data.", sizeof(StatElement), (sizeof(StatElement)*granules)/(size_t)K); + ast->print_cr(" CodeHeap allocation segment size is %zu bytes. This is the smallest possible granularity.", seg_size); + ast->print_cr(" CodeHeap (committed part) is mapped to %zu granules of size %zu bytes.", granules, granularity); + ast->print_cr(" Each granule takes %zu bytes of C heap, that is %zuK in total for statistics data.", sizeof(StatElement), (sizeof(StatElement)*granules)/(size_t)K); ast->print_cr(" The number of granules is limited to %dk, requiring a granules size of at least %d bytes for a 1GB heap.", (unsigned int)(max_granules/K), (unsigned int)(G/max_granules)); BUFFEREDSTREAM_FLUSH("\n") @@ -697,10 +697,10 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular insane = true; ast->print_cr("Sanity check: HeapBlock @%p outside used range (%p)", (char*)h, low_bound + size); } if (ix_end >= granules) { - insane = true; ast->print_cr("Sanity check: end index (%d) out of bounds (" SIZE_FORMAT ")", ix_end, granules); + insane = true; ast->print_cr("Sanity check: end index (%d) out of bounds (%zu)", ix_end, granules); } if (size != heap->capacity()) { - insane = true; ast->print_cr("Sanity check: code heap capacity has changed (" SIZE_FORMAT "K to " SIZE_FORMAT "K)", size/(size_t)K, heap->capacity()/(size_t)K); + insane = true; ast->print_cr("Sanity check: code heap capacity has changed (%zuK to %zuK)", size/(size_t)K, heap->capacity()/(size_t)K); } if (ix_beg > ix_end) { insane = true; ast->print_cr("Sanity check: end index (%d) lower than begin index (%d)", ix_end, ix_beg); @@ -1134,7 +1134,7 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular ast->print_cr(" The aggregate step collects information about all free blocks in CodeHeap.\n" " Subsequent print functions create their output based on this snapshot.\n"); ast->print_cr(" Free space in %s is distributed over %d free blocks.", heapName, nBlocks_free); - ast->print_cr(" Each free block takes " SIZE_FORMAT " bytes of C heap for statistics data, that is " SIZE_FORMAT "K in total.", sizeof(FreeBlk), (sizeof(FreeBlk)*nBlocks_free)/K); + ast->print_cr(" Each free block takes %zu bytes of C heap for statistics data, that is %zuK in total.", sizeof(FreeBlk), (sizeof(FreeBlk)*nBlocks_free)/K); BUFFEREDSTREAM_FLUSH("\n") //---------------------------------------- @@ -2101,7 +2101,7 @@ void CodeHeapState::print_names(outputStream* out, CodeHeap* heap) { size_t end_ix = (ix+granules_per_line <= alloc_granules) ? ix+granules_per_line : alloc_granules; ast->cr(); ast->print_cr("--------------------------------------------------------------------"); - ast->print_cr("Address range [" INTPTR_FORMAT "," INTPTR_FORMAT "), " SIZE_FORMAT "k", p2i(low_bound+ix*granule_size), p2i(low_bound + end_ix*granule_size), (end_ix - ix)*granule_size/(size_t)K); + ast->print_cr("Address range [" INTPTR_FORMAT "," INTPTR_FORMAT "), %zuk", p2i(low_bound+ix*granule_size), p2i(low_bound + end_ix*granule_size), (end_ix - ix)*granule_size/(size_t)K); ast->print_cr("--------------------------------------------------------------------"); BUFFEREDSTREAM_FLUSH_AUTO("") } diff --git a/src/hotspot/share/code/nmethod.cpp b/src/hotspot/share/code/nmethod.cpp index 0d44c4f2e6d..1686090c634 100644 --- a/src/hotspot/share/code/nmethod.cpp +++ b/src/hotspot/share/code/nmethod.cpp @@ -2110,7 +2110,7 @@ void nmethod::purge(bool unregister_nmethod) { // completely deallocate this method Events::log_nmethod_flush(Thread::current(), "flushing %s nmethod " INTPTR_FORMAT, is_osr_method() ? "osr" : "", p2i(this)); log_debug(codecache)("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT - "/Free CodeCache:" SIZE_FORMAT "Kb", + "/Free CodeCache:%zuKb", is_osr_method() ? "osr" : "",_compile_id, p2i(this), CodeCache::blob_count(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index 8f7ad91ddc9..379605fed53 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -226,7 +226,7 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { enter(is_vtable_stub, vtable_index, s); if (PrintAdapterHandlers) { - tty->print_cr("Decoding VtableStub %s[%d]@" PTR_FORMAT " [" PTR_FORMAT ", " PTR_FORMAT "] (" SIZE_FORMAT " bytes)", + tty->print_cr("Decoding VtableStub %s[%d]@" PTR_FORMAT " [" PTR_FORMAT ", " PTR_FORMAT "] (%zu bytes)", is_vtable_stub? "vtbl": "itbl", vtable_index, p2i(VtableStub::receiver_location()), p2i(s->code_begin()), p2i(s->code_end()), pointer_delta(s->code_end(), s->code_begin(), 1)); Disassembler::decode(s->code_begin(), s->code_end()); diff --git a/src/hotspot/share/opto/parse1.cpp b/src/hotspot/share/opto/parse1.cpp index 68b87d858a5..5bd7c41daf0 100644 --- a/src/hotspot/share/opto/parse1.cpp +++ b/src/hotspot/share/opto/parse1.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 @@ -642,7 +642,7 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) // for exiting control flow still refers to the inlined method. C->set_default_node_notes(caller_nn); - if (log) log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'", + if (log) log->done("parse nodes='%d' live='%d' memory='%zu'", C->unique(), C->live_nodes(), C->node_arena()->used()); }