From ca59548658136c2e17b1fa82f8e4b9a0e0b5fa89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 20:41:15 +0000 Subject: [PATCH 1/7] Initial plan From a1364033026d5ec7609658bf419f2a3ad15afd58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 21:07:47 +0000 Subject: [PATCH 2/7] Fix I64x format specifiers to use standard PRIx64 macros Replace non-standard I64x/I64X format specifiers with C99 standard PRIx64/PRIX64 macros from in ildasm and metainfo tools. This fixes incorrect output on Linux where glibc doesn't recognize I64 prefix. Changes: - Add #include to dasm.cpp and mdinfo.cpp - Replace all I64x format specifiers with PRIx64 - Replace I64X with PRIX64 for uppercase hex - Cast ULONGLONG to uint64_t for consistency with PRIx64 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/ildasm/dasm.cpp | 21 +++++++++++---------- src/coreclr/tools/metainfo/mdinfo.cpp | 7 ++++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/coreclr/ildasm/dasm.cpp b/src/coreclr/ildasm/dasm.cpp index 2a151638dfa180..539c3787379699 100644 --- a/src/coreclr/ildasm/dasm.cpp +++ b/src/coreclr/ildasm/dasm.cpp @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#include #include "ildasmpch.h" #include #include @@ -5460,9 +5461,9 @@ void DumpMetadataHeader(const char *szName, IMAGE_DATA_DIRECTORY *pDir, void* GU printLine(GUICookie,szStr); sprintf_s(szString,SZSTRING_SIZE,"// 0x%02x Rid", pMDSH->Rid); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// 0x%016I64x MaskValid", (ULONGLONG)GET_UNALIGNED_VAL64(&(pMDSH->MaskValid))); + sprintf_s(szString,SZSTRING_SIZE,"// 0x%016" PRIx64 " MaskValid", (uint64_t)GET_UNALIGNED_VAL64(&(pMDSH->MaskValid))); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// 0x%016I64x Sorted", (ULONGLONG)GET_UNALIGNED_VAL64(&(pMDSH->Sorted))); + sprintf_s(szString,SZSTRING_SIZE,"// 0x%016" PRIx64 " Sorted", (uint64_t)GET_UNALIGNED_VAL64(&(pMDSH->Sorted))); printLine(GUICookie,szStr); } } @@ -5680,7 +5681,7 @@ void DumpHeader(IMAGE_COR20_HEADER *CORHeader, void* GUICookie) dwEntryPointSize = 12; sprintf_s(szString,SZSTRING_SIZE,"// Base of code: 0x%08x", VAL32(pOptHeader->BaseOfCode)); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// Image base: 0x%016I64x", VAL64(pOptHeader->ImageBase)); + sprintf_s(szString,SZSTRING_SIZE,"// Image base: 0x%016" PRIx64, (uint64_t)VAL64(pOptHeader->ImageBase)); printLine(GUICookie,szStr); sprintf_s(szString,SZSTRING_SIZE,"// Section alignment: 0x%08x", VAL32(pOptHeader->SectionAlignment)); printLine(GUICookie,szStr); @@ -5708,13 +5709,13 @@ void DumpHeader(IMAGE_COR20_HEADER *CORHeader, void* GUICookie) printLine(GUICookie,szStr); sprintf_s(szString,SZSTRING_SIZE,"// DLL characteristics: 0x%04x", VAL16(pOptHeader->DllCharacteristics)); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// Size of stack reserve: 0x%016I64x", VAL64(pOptHeader->SizeOfStackReserve)); + sprintf_s(szString,SZSTRING_SIZE,"// Size of stack reserve: 0x%016" PRIx64, (uint64_t)VAL64(pOptHeader->SizeOfStackReserve)); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// Size of stack commit: 0x%016I64x", VAL64(pOptHeader->SizeOfStackCommit)); + sprintf_s(szString,SZSTRING_SIZE,"// Size of stack commit: 0x%016" PRIx64, (uint64_t)VAL64(pOptHeader->SizeOfStackCommit)); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// Size of heap reserve: 0x%016I64x", VAL64(pOptHeader->SizeOfHeapReserve)); + sprintf_s(szString,SZSTRING_SIZE,"// Size of heap reserve: 0x%016" PRIx64, (uint64_t)VAL64(pOptHeader->SizeOfHeapReserve)); printLine(GUICookie,szStr); - sprintf_s(szString,SZSTRING_SIZE,"// Size of heap commit: 0x%016I64x", VAL64(pOptHeader->SizeOfHeapCommit)); + sprintf_s(szString,SZSTRING_SIZE,"// Size of heap commit: 0x%016" PRIx64, (uint64_t)VAL64(pOptHeader->SizeOfHeapCommit)); printLine(GUICookie,szStr); sprintf_s(szString,SZSTRING_SIZE,"// Loader flags: 0x%08x", VAL32(pOptHeader->LoaderFlags)); printLine(GUICookie,szStr); @@ -6747,12 +6748,12 @@ void DumpVtable(void* GUICookie) pNTHeader64 = g_pPELoader->ntHeaders64(); pOptHeader64 = &pNTHeader64->OptionalHeader; - sprintf_s(szString,SZSTRING_SIZE,"%s%s 0x%016I64x", g_szAsmCodeIndent,KEYWORD(".imagebase"),VAL64(pOptHeader64->ImageBase)); + sprintf_s(szString,SZSTRING_SIZE,"%s%s 0x%016" PRIx64, g_szAsmCodeIndent,KEYWORD(".imagebase"),(uint64_t)VAL64(pOptHeader64->ImageBase)); printLine(GUICookie,szString); j = VAL16(pOptHeader64->Subsystem); sprintf_s(szString,SZSTRING_SIZE,"%s%s 0x%08x", g_szAsmCodeIndent,KEYWORD(".file alignment"),VAL32(pOptHeader64->FileAlignment)); printLine(GUICookie,szString); - sprintf_s(szString,SZSTRING_SIZE,"%s%s 0x%016I64x", g_szAsmCodeIndent,KEYWORD(".stackreserve"),VAL64(pOptHeader64->SizeOfStackReserve)); + sprintf_s(szString,SZSTRING_SIZE,"%s%s 0x%016" PRIx64, g_szAsmCodeIndent,KEYWORD(".stackreserve"),(uint64_t)VAL64(pOptHeader64->SizeOfStackReserve)); printLine(GUICookie,szString); } szptr = &szString[0]; @@ -6867,7 +6868,7 @@ void DumpVtable(void* GUICookie) } else { - szptr+=sprintf_s(szptr,SZSTRING_REMAINING_SIZE(szptr)," %016I64X", VAL64(*(uint64_t *)pSlot)); + szptr+=sprintf_s(szptr,SZSTRING_REMAINING_SIZE(szptr)," %016" PRIX64, (uint64_t)VAL64(*(uint64_t *)pSlot)); pSlot += sizeof(uint64_t); } if (g_prVTableRef == NULL) diff --git a/src/coreclr/tools/metainfo/mdinfo.cpp b/src/coreclr/tools/metainfo/mdinfo.cpp index ced1b33e0903b7..a5014fbd4ab4ba 100644 --- a/src/coreclr/tools/metainfo/mdinfo.cpp +++ b/src/coreclr/tools/metainfo/mdinfo.cpp @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +#include #include #include #include @@ -3948,10 +3949,10 @@ void MDInfo::DumpRaw(int iDump, bool bunused) const MD *pMd; pMd = (const MD *)pbMd; - VWriteLine("Metadata header: %d.%d, heaps: 0x%02x, rid: 0x%02x, valid: 0x%016I64x, sorted: 0x%016I64x", + VWriteLine("Metadata header: %d.%d, heaps: 0x%02x, rid: 0x%02x, valid: 0x%016" PRIx64 ", sorted: 0x%016" PRIx64, pMd->m_major, pMd->m_minor, pMd->m_heaps, pMd->m_rid, - (ULONGLONG)GET_UNALIGNED_VAL64(&(pMd->m_maskvalid)), - (ULONGLONG)GET_UNALIGNED_VAL64(&(pMd->m_sorted))); + (uint64_t)GET_UNALIGNED_VAL64(&(pMd->m_maskvalid)), + (uint64_t)GET_UNALIGNED_VAL64(&(pMd->m_sorted))); if (m_DumpFilter & dumpMoreHex) { From ff01ff50d9ee785d3e1156ed1357d312be846651 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 23:15:45 +0000 Subject: [PATCH 3/7] Remove cinttypes include to fix Windows build The PRIx64/PRIX64 macros are already defined in src/native/minipal/types.h which gets included through the build system. Including causes macro redefinition errors on Windows where both headers define these macros. The fix still works correctly on Linux without the explicit include. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/ildasm/dasm.cpp | 1 - src/coreclr/tools/metainfo/mdinfo.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/coreclr/ildasm/dasm.cpp b/src/coreclr/ildasm/dasm.cpp index 539c3787379699..697ae524bb1a84 100644 --- a/src/coreclr/ildasm/dasm.cpp +++ b/src/coreclr/ildasm/dasm.cpp @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#include #include "ildasmpch.h" #include #include diff --git a/src/coreclr/tools/metainfo/mdinfo.cpp b/src/coreclr/tools/metainfo/mdinfo.cpp index a5014fbd4ab4ba..738e5123d18cca 100644 --- a/src/coreclr/tools/metainfo/mdinfo.cpp +++ b/src/coreclr/tools/metainfo/mdinfo.cpp @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#include #include #include #include From 9f3189a5e0afee179ed781225ddec8b1a595b550 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 00:36:35 +0000 Subject: [PATCH 4/7] Fix I64 format specifiers in debug logging, JIT diagnostics, and tests Replace Microsoft-specific I64x/I64X/I64d/I64u format specifiers with standard C99 PRIx64/PRIX64/PRId64/PRIu64 macros in: - Debug logging (gc.cpp dprintf statements - 15 instances) - JIT diagnostics (jit/compiler.cpp, jit/disasm.cpp, jit/gentree.cpp - 7 instances) - Debug interface (debug/di/rsmain.cpp - 1 instance) - JIT methodical tests (tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp - 2 instances) Also replaced pointer-sized %IX with PRIxPTR for cross-platform compatibility. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/debug/di/rsmain.cpp | 2 +- src/coreclr/gc/gc.cpp | 52 +++++++++---------- src/coreclr/jit/compiler.cpp | 10 ++-- src/coreclr/jit/disasm.cpp | 12 ++--- src/coreclr/jit/gentree.cpp | 2 +- .../structs/systemvbringup/structinregs.cpp | 4 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp index 9a2de7bf42009f..bd4d6d74d64c37 100644 --- a/src/coreclr/debug/di/rsmain.cpp +++ b/src/coreclr/debug/di/rsmain.cpp @@ -1692,7 +1692,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget, debuggingFlags ); - LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %.I64x\n", lpProcessInformation->hProcess)); + LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %." PRIx64 "\n", (uint64_t)lpProcessInformation->hProcess)); if (SUCCEEDED(hr)) { diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 9da125a1cde4e2..467a6fceaef1e9 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -7140,13 +7140,13 @@ void gc_heap::gc_thread_function () wait_time = min (wait_time, (uint32_t)(sample.elapsed_between_gcs / 1000 / 3)); wait_time = max (wait_time, 1u); - dprintf (6666, ("gc#0 thread waiting for %d ms (betwen GCs %I64d)", wait_time, sample.elapsed_between_gcs)); + dprintf (6666, ("gc#0 thread waiting for %d ms (betwen GCs %" PRId64 ")", wait_time, (int64_t)sample.elapsed_between_gcs)); } #endif //DYNAMIC_HEAP_COUNT uint32_t wait_result = gc_heap::ee_suspend_event.Wait(wait_on_time_out_p ? wait_time : INFINITE, FALSE); #ifdef DYNAMIC_HEAP_COUNT - dprintf (9999, ("waiting for ee done res %d (timeout %d, %I64d ms since last suspend end)(should_change_heap_count is %d) (gradual_decommit_in_progress_p %d)", - wait_result, wait_time, ((GetHighPrecisionTimeStamp() - last_suspended_end_time) / 1000), + dprintf (9999, ("waiting for ee done res %d (timeout %d, %" PRId64 " ms since last suspend end)(should_change_heap_count is %d) (gradual_decommit_in_progress_p %d)", + wait_result, wait_time, (int64_t)((GetHighPrecisionTimeStamp() - last_suspended_end_time) / 1000), dynamic_heap_count_data.should_change_heap_count, gradual_decommit_in_progress_p)); #endif //DYNAMIC_HEAP_COUNT if (wait_result == WAIT_TIMEOUT) @@ -16324,8 +16324,8 @@ void allocator::count_items (gc_heap* this_hp, size_t* fl_items_count, size_t* f } end_us = GetHighPrecisionTimeStamp(); - dprintf (3, ("total - %Id items out of %Id items are from a different heap in %I64d us", - num_fl_items_for_oh, num_fl_items, (end_us - start_us))); + dprintf (3, ("total - %Id items out of %Id items are from a different heap in %" PRId64 " us", + num_fl_items_for_oh, num_fl_items, (int64_t)(end_us - start_us))); *fl_items_count = num_fl_items; *fl_items_for_oh_count = num_fl_items_for_oh; @@ -16444,8 +16444,8 @@ void allocator::rethread_items (size_t* num_total_fl_items, size_t* num_total_fl } end_us = GetHighPrecisionTimeStamp(); - dprintf (8888, ("h%d total %Id items rethreaded out of %Id items in %I64d us (%I64dms)", - current_heap->heap_number, num_fl_items_rethreaded, num_fl_items, (end_us - start_us), ((end_us - start_us) / 1000))); + dprintf (8888, ("h%d total %Id items rethreaded out of %Id items in %" PRId64 " us (%" PRId64 "ms)", + current_heap->heap_number, num_fl_items_rethreaded, num_fl_items, (int64_t)(end_us - start_us), (int64_t)((end_us - start_us) / 1000))); (*num_total_fl_items) += num_fl_items; (*num_total_fl_items_rethreaded) += num_fl_items_rethreaded; @@ -19728,7 +19728,7 @@ BOOL gc_heap::allocate_more_space(alloc_context* acontext, size_t size, { if (alloced_on_retry) { - dprintf (5555, ("UOH h%d allocated %Id on retry (%I64dus)", alloc_heap->heap_number, size, (end_us - start_us))); + dprintf (5555, ("UOH h%d allocated %Id on retry (%" PRId64 "us)", alloc_heap->heap_number, size, (int64_t)(end_us - start_us))); } } } @@ -22496,15 +22496,15 @@ void gc_heap::update_end_gc_time_per_heap() if (heap_number == 0) { - dprintf (3, ("prev gen%d GC end time: prev start %I64d + prev gc elapsed %Id = %I64d", - gen_number, dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)))); + dprintf (3, ("prev gen%d GC end time: prev start %" PRId64 " + prev gc elapsed %Id = %" PRId64, + gen_number, (int64_t)dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (int64_t)(dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)))); } dd_gc_elapsed_time (dd) = (size_t)(end_gc_time - dd_time_clock (dd)); if (heap_number == 0) { - dprintf (3, ("updated NGC%d %Id elapsed time to %I64d - %I64d = %I64d", gen_number, dd_gc_clock (dd), end_gc_time, dd_time_clock (dd), dd_gc_elapsed_time (dd))); + dprintf (3, ("updated NGC%d %Id elapsed time to %" PRId64 " - %" PRId64 " = %" PRId64, gen_number, dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_time_clock (dd), (int64_t)dd_gc_elapsed_time (dd))); } } } @@ -22661,8 +22661,8 @@ void gc_heap::gc1() if ((heap_number == 0) && (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)) { time_since_last_gen2 = (size_t)(end_gc_time - (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd))); - dprintf (6666, ("BGC %Id end %I64d - (prev gen2 start %I64d + elapsed %Id = %I64d) = time inbewteen gen2 %Id", - dd_gc_clock (dd), end_gc_time, dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)), time_since_last_gen2)); + dprintf (6666, ("BGC %Id end %" PRId64 " - (prev gen2 start %" PRId64 " + elapsed %Id = %" PRId64 ") = time inbewteen gen2 %Id", + dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (int64_t)(dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)), time_since_last_gen2)); } #endif //DYNAMIC_HEAP_COUNT @@ -22670,7 +22670,7 @@ void gc_heap::gc1() #ifdef DYNAMIC_HEAP_COUNT if ((heap_number == 0) && (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)) { - dprintf (6666, ("updating BGC %Id elapsed time to %I64d - %I64d = %I64d", dd_gc_clock (dd), end_gc_time, dd_time_clock (dd), dd_gc_elapsed_time (dd))); + dprintf (6666, ("updating BGC %Id elapsed time to %" PRId64 " - %" PRId64 " = %" PRId64, dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_time_clock (dd), (int64_t)dd_gc_elapsed_time (dd))); float bgc_percent = (float)dd_gc_elapsed_time (dd) * 100.0f / (float)time_since_last_gen2; dynamic_heap_count_data_t::gen2_sample& g2_sample = dynamic_heap_count_data.gen2_samples[dynamic_heap_count_data.gen2_sample_index]; @@ -23328,8 +23328,8 @@ void gc_heap::merge_fl_from_other_heaps (int gen_idx, int to_n_heaps, int from_n uint64_t elapsed = GetHighPrecisionTimeStamp () - start_us; - dprintf (8888, ("rethreaded %Id items, merging took %I64dus (%I64dms)", - total_num_fl_items_rethreaded_stage2, elapsed, (elapsed / 1000))); + dprintf (8888, ("rethreaded %Id items, merging took %" PRId64 "us (%" PRId64 "ms)", + total_num_fl_items_rethreaded_stage2, (int64_t)elapsed, (int64_t)(elapsed / 1000))); #endif //_DEBUG for (int hn = 0; hn < to_n_heaps; hn++) @@ -25855,8 +25855,8 @@ void gc_heap::calculate_new_heap_count () assert (throughput_cost_percents[i] >= 0.0); if (throughput_cost_percents[i] > 100.0) throughput_cost_percents[i] = 100.0; - dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i, - sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i], + dprintf (6666, ("sample %d in GC#%Id msl %" PRId64 " / %d + pause %" PRId64 " / elapsed %" PRId64 " = tcp: %.3f, surv %zd, gc speed %zd/ms", i, + sample.gc_index, (int64_t)sample.msl_wait_time, n_heaps, (int64_t)sample.gc_pause_time, (int64_t)sample.elapsed_between_gcs, throughput_cost_percents[i], sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0))); } } @@ -25875,9 +25875,9 @@ void gc_heap::calculate_new_heap_count () min_pause = min (dynamic_heap_count_data.samples[i].gc_pause_time, min_pause); } - dprintf (6666, ("checking if samples are stable %Id %Id %Id, min tcp %.3f, min pause %I64d", + dprintf (6666, ("checking if samples are stable %Id %Id %Id, min tcp %.3f, min pause %" PRId64, dynamic_heap_count_data.samples[0].gc_survived_size, dynamic_heap_count_data.samples[1].gc_survived_size, dynamic_heap_count_data.samples[2].gc_survived_size, - min_tcp, min_pause)); + min_tcp, (int64_t)min_pause)); bool survived_stable_p = true; if (min_survived > 0) @@ -26743,7 +26743,7 @@ bool gc_heap::change_heap_count (int new_n_heaps) change_heap_count_time = GetHighPrecisionTimeStamp() - start_time; total_change_heap_count_time += change_heap_count_time; total_change_heap_count++; - dprintf (6666, ("changing HC took %I64dus", change_heap_count_time)); + dprintf (6666, ("changing HC took %" PRId64 "us", (int64_t)change_heap_count_time)); } return true; @@ -26808,9 +26808,9 @@ void gc_heap::process_datas_sample() assign_new_budget (0, desired_per_heap_datas); } - dprintf (6666, ("sample#%d: %d heaps, this GC end %I64d - last sus end %I64d = %I64d, this GC pause %.3fms, msl wait %I64dus, tcp %.3f, surv %zd, gc speed %.3fmb/ms (%.3fkb/ms/heap)", - dynamic_heap_count_data.sample_index, n_heaps, before_distribute_free_regions_time, last_suspended_end_time, sample.elapsed_between_gcs, - (sample.gc_pause_time / 1000.0), sample.msl_wait_time, tcp, sample.gc_survived_size, + dprintf (6666, ("sample#%d: %d heaps, this GC end %" PRId64 " - last sus end %" PRId64 " = %" PRId64 ", this GC pause %.3fms, msl wait %" PRId64 "us, tcp %.3f, surv %zd, gc speed %.3fmb/ms (%.3fkb/ms/heap)", + dynamic_heap_count_data.sample_index, n_heaps, (int64_t)before_distribute_free_regions_time, (int64_t)last_suspended_end_time, (int64_t)sample.elapsed_between_gcs, + (sample.gc_pause_time / 1000.0), (int64_t)sample.msl_wait_time, tcp, sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size / 1000.0 / sample.gc_pause_time) : 0), (sample.gc_pause_time ? ((float)sample.gc_survived_size / sample.gc_pause_time / n_heaps) : 0))); @@ -26839,8 +26839,8 @@ void gc_heap::process_datas_sample() g2_sample.gc_percent = (float)gen2_elapsed_time * 100.0f / elapsed_between_gen2_gcs; (dynamic_heap_count_data.current_gen2_samples_count)++; - dprintf (6666, ("gen2 sample#%d: this GC end %I64d - last gen2 end %I64d = %I64d, GC elapsed %I64d, percent %.3f", - dynamic_heap_count_data.gen2_sample_index, before_distribute_free_regions_time, prev_gen2_end_time, elapsed_between_gen2_gcs, gen2_elapsed_time, g2_sample.gc_percent)); + dprintf (6666, ("gen2 sample#%d: this GC end %" PRId64 " - last gen2 end %" PRId64 " = %" PRId64 ", GC elapsed %" PRId64 ", percent %.3f", + dynamic_heap_count_data.gen2_sample_index, (int64_t)before_distribute_free_regions_time, (int64_t)prev_gen2_end_time, (int64_t)elapsed_between_gen2_gcs, (int64_t)gen2_elapsed_time, g2_sample.gc_percent)); dynamic_heap_count_data.gen2_sample_index = (dynamic_heap_count_data.gen2_sample_index + 1) % dynamic_heap_count_data_t::sample_size; } diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 998a7d7717d12d..c14ad6c21a209e 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -1497,12 +1497,12 @@ void Compiler::compShutdown() jitprintf("GenTree node allocation stats\n"); jitprintf("---------------------------------------------------\n"); - jitprintf("Allocated %6I64u tree nodes (%7I64u bytes total, avg %4I64u bytes per method)\n", - genNodeSizeStats.genTreeNodeCnt, genNodeSizeStats.genTreeNodeSize, - genNodeSizeStats.genTreeNodeSize / genMethodCnt); + jitprintf("Allocated %6" PRIu64 " tree nodes (%7" PRIu64 " bytes total, avg %4" PRIu64 " bytes per method)\n", + (uint64_t)genNodeSizeStats.genTreeNodeCnt, (uint64_t)genNodeSizeStats.genTreeNodeSize, + (uint64_t)(genNodeSizeStats.genTreeNodeSize / genMethodCnt)); - jitprintf("Allocated %7I64u bytes of unused tree node space (%3.2f%%)\n", - genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize, + jitprintf("Allocated %7" PRIu64 " bytes of unused tree node space (%3.2f%%)\n", + (uint64_t)(genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize), (float)(100 * (genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize)) / genNodeSizeStats.genTreeNodeSize); diff --git a/src/coreclr/jit/disasm.cpp b/src/coreclr/jit/disasm.cpp index 8f6c8d1cfd1a9c..08ada0548b8eb7 100644 --- a/src/coreclr/jit/disasm.cpp +++ b/src/coreclr/jit/disasm.cpp @@ -371,7 +371,7 @@ size_t DisAssembler::disCchFixupMember( DISX86::TRMTA terminationType = DISX86::TRMTA(pdis->Trmta()); // DIS::ADDR disIndAddr; - DISASM_DUMP("FixupMember %016I64X (%08IX), size %d, termType %u\n", addr, disGetLinearAddr((size_t)addr), size, + DISASM_DUMP("FixupMember %016" PRIX64 " (%08" PRIxPTR "), size %d, termType %u\n", (uint64_t)addr, (uintptr_t)disGetLinearAddr((size_t)addr), size, terminationType); // Is there a relocation registered for the address? @@ -473,7 +473,7 @@ size_t DisAssembler::disCchFixupMember( DISARM64::TRMTA terminationType = DISARM64::TRMTA(pdis->Trmta()); // DIS::ADDR disIndAddr; - DISASM_DUMP("FixupMember %016I64X (%08IX), size %d, termType %u\n", addr, disGetLinearAddr((size_t)addr), size, + DISASM_DUMP("FixupMember %016" PRIX64 " (%08" PRIxPTR "), size %d, termType %u\n", (uint64_t)addr, (uintptr_t)disGetLinearAddr((size_t)addr), size, terminationType); // Is there a relocation registered for the address? @@ -1509,16 +1509,16 @@ void DisAssembler::disAsmCode(BYTE* hotCodePtr, assert(hotCodeSize > 0); if (coldCodeSize == 0) { - fprintf(disAsmFile, "************************** %hs:%hs size 0x%04IX **************************\n\n", - disCurClassName, disCurMethodName, hotCodeSize); + fprintf(disAsmFile, "************************** %hs:%hs size 0x%04" PRIxPTR " **************************\n\n", + disCurClassName, disCurMethodName, (uintptr_t)hotCodeSize); fprintf(disAsmFile, "Base address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); } else { fprintf(disAsmFile, - "************************** %hs:%hs hot size 0x%04IX cold size 0x%04IX **************************\n\n", - disCurClassName, disCurMethodName, hotCodeSize, coldCodeSize); + "************************** %hs:%hs hot size 0x%04" PRIxPTR " cold size 0x%04" PRIxPTR " **************************\n\n", + disCurClassName, disCurMethodName, (uintptr_t)hotCodeSize, (uintptr_t)coldCodeSize); fprintf(disAsmFile, "Hot address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); fprintf(disAsmFile, "Cold address : %ph (RW: %ph)\n", dspAddr(coldCodePtr), dspAddr(coldCodePtrRW)); diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 8c00356c330415..243e29b0f186b7 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -12274,7 +12274,7 @@ void Compiler::gtDispConst(GenTree* tree) break; case GT_CNS_LNG: - printf(" 0x%016I64x", tree->AsLngCon()->gtLconVal); + printf(" 0x%016" PRIx64, (uint64_t)tree->AsLngCon()->gtLconVal); break; case GT_CNS_DBL: diff --git a/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp b/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp index 65794f3f62f0d9..58a87fcbd30d60 100644 --- a/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp +++ b/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp @@ -327,7 +327,7 @@ EXPORT(void) NATIVEAPI InvokeCallback20(PFNACTION20 callback, S20 s) #ifdef __GNUC__ printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w); #else - printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w); + printf("Native S20: %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 "\n", (int64_t)s.x, (int64_t)s.y, (int64_t)s.z, (int64_t)s.w); #endif callback(s); @@ -471,7 +471,7 @@ EXPORT(S20) NATIVEAPI InvokeCallback20R(PFNACTION20 callback, S20 s) #ifdef __GNUC__ printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w); #else - printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w); + printf("Native S20: %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 "\n", (int64_t)s.x, (int64_t)s.y, (int64_t)s.z, (int64_t)s.w); #endif callback(s); return s; From 4666e3fa878ac1022b99c0070098e61602a5244f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 01:16:29 +0000 Subject: [PATCH 5/7] Use %p format specifier for HANDLE in debug logging Replace PRIx64 format with %p for printing HANDLE (pointer type) in rsmain.cpp debug logging, removing unnecessary uint64_t cast. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/debug/di/rsmain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp index bd4d6d74d64c37..12a52627a931e4 100644 --- a/src/coreclr/debug/di/rsmain.cpp +++ b/src/coreclr/debug/di/rsmain.cpp @@ -1692,7 +1692,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget, debuggingFlags ); - LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %." PRIx64 "\n", (uint64_t)lpProcessInformation->hProcess)); + LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %p\n", lpProcessInformation->hProcess)); if (SUCCEEDED(hr)) { From a21cfb40a46a5f88002689fd42aca1c358d2cf18 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 06:49:26 +0000 Subject: [PATCH 6/7] Fix linux-musl build by using %zx for size_t values Replace PRIxPTR with %zx format specifier for size_t values (hotCodeSize, coldCodeSize) in disasm.cpp. The %zx format specifier is the standard and portable way to print size_t in hexadecimal, avoiding issues with PRIxPTR macro expansion on linux-musl. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/jit/disasm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/disasm.cpp b/src/coreclr/jit/disasm.cpp index 08ada0548b8eb7..24503662adda89 100644 --- a/src/coreclr/jit/disasm.cpp +++ b/src/coreclr/jit/disasm.cpp @@ -1509,16 +1509,16 @@ void DisAssembler::disAsmCode(BYTE* hotCodePtr, assert(hotCodeSize > 0); if (coldCodeSize == 0) { - fprintf(disAsmFile, "************************** %hs:%hs size 0x%04" PRIxPTR " **************************\n\n", - disCurClassName, disCurMethodName, (uintptr_t)hotCodeSize); + fprintf(disAsmFile, "************************** %hs:%hs size 0x%04zx **************************\n\n", + disCurClassName, disCurMethodName, hotCodeSize); fprintf(disAsmFile, "Base address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); } else { fprintf(disAsmFile, - "************************** %hs:%hs hot size 0x%04" PRIxPTR " cold size 0x%04" PRIxPTR " **************************\n\n", - disCurClassName, disCurMethodName, (uintptr_t)hotCodeSize, (uintptr_t)coldCodeSize); + "************************** %hs:%hs hot size 0x%04zx cold size 0x%04zx **************************\n\n", + disCurClassName, disCurMethodName, hotCodeSize, coldCodeSize); fprintf(disAsmFile, "Hot address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); fprintf(disAsmFile, "Cold address : %ph (RW: %ph)\n", dspAddr(coldCodePtr), dspAddr(coldCodePtrRW)); From e0c181ca582bd5043dd47a728ab3981a4bc2141c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:05:40 +0000 Subject: [PATCH 7/7] Revert changes to all files except dasm.cpp and mdinfo.cpp As requested, reverting changes to: - src/coreclr/debug/di/rsmain.cpp - src/coreclr/gc/gc.cpp - src/coreclr/jit/compiler.cpp - src/coreclr/jit/disasm.cpp - src/coreclr/jit/gentree.cpp - src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp Keeping only the changes to dasm.cpp and mdinfo.cpp to fix the ildasm output issue on Linux. We'll address other files one step at a time. Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/debug/di/rsmain.cpp | 2 +- src/coreclr/gc/gc.cpp | 52 +++++++++---------- src/coreclr/jit/compiler.cpp | 10 ++-- src/coreclr/jit/disasm.cpp | 8 +-- src/coreclr/jit/gentree.cpp | 2 +- .../structs/systemvbringup/structinregs.cpp | 4 +- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp index 12a52627a931e4..9a2de7bf42009f 100644 --- a/src/coreclr/debug/di/rsmain.cpp +++ b/src/coreclr/debug/di/rsmain.cpp @@ -1692,7 +1692,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget, debuggingFlags ); - LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %p\n", lpProcessInformation->hProcess)); + LOG((LF_CORDB, LL_EVERYTHING, "Handle in Cordb::CreateProcess is: %.I64x\n", lpProcessInformation->hProcess)); if (SUCCEEDED(hr)) { diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 467a6fceaef1e9..9da125a1cde4e2 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -7140,13 +7140,13 @@ void gc_heap::gc_thread_function () wait_time = min (wait_time, (uint32_t)(sample.elapsed_between_gcs / 1000 / 3)); wait_time = max (wait_time, 1u); - dprintf (6666, ("gc#0 thread waiting for %d ms (betwen GCs %" PRId64 ")", wait_time, (int64_t)sample.elapsed_between_gcs)); + dprintf (6666, ("gc#0 thread waiting for %d ms (betwen GCs %I64d)", wait_time, sample.elapsed_between_gcs)); } #endif //DYNAMIC_HEAP_COUNT uint32_t wait_result = gc_heap::ee_suspend_event.Wait(wait_on_time_out_p ? wait_time : INFINITE, FALSE); #ifdef DYNAMIC_HEAP_COUNT - dprintf (9999, ("waiting for ee done res %d (timeout %d, %" PRId64 " ms since last suspend end)(should_change_heap_count is %d) (gradual_decommit_in_progress_p %d)", - wait_result, wait_time, (int64_t)((GetHighPrecisionTimeStamp() - last_suspended_end_time) / 1000), + dprintf (9999, ("waiting for ee done res %d (timeout %d, %I64d ms since last suspend end)(should_change_heap_count is %d) (gradual_decommit_in_progress_p %d)", + wait_result, wait_time, ((GetHighPrecisionTimeStamp() - last_suspended_end_time) / 1000), dynamic_heap_count_data.should_change_heap_count, gradual_decommit_in_progress_p)); #endif //DYNAMIC_HEAP_COUNT if (wait_result == WAIT_TIMEOUT) @@ -16324,8 +16324,8 @@ void allocator::count_items (gc_heap* this_hp, size_t* fl_items_count, size_t* f } end_us = GetHighPrecisionTimeStamp(); - dprintf (3, ("total - %Id items out of %Id items are from a different heap in %" PRId64 " us", - num_fl_items_for_oh, num_fl_items, (int64_t)(end_us - start_us))); + dprintf (3, ("total - %Id items out of %Id items are from a different heap in %I64d us", + num_fl_items_for_oh, num_fl_items, (end_us - start_us))); *fl_items_count = num_fl_items; *fl_items_for_oh_count = num_fl_items_for_oh; @@ -16444,8 +16444,8 @@ void allocator::rethread_items (size_t* num_total_fl_items, size_t* num_total_fl } end_us = GetHighPrecisionTimeStamp(); - dprintf (8888, ("h%d total %Id items rethreaded out of %Id items in %" PRId64 " us (%" PRId64 "ms)", - current_heap->heap_number, num_fl_items_rethreaded, num_fl_items, (int64_t)(end_us - start_us), (int64_t)((end_us - start_us) / 1000))); + dprintf (8888, ("h%d total %Id items rethreaded out of %Id items in %I64d us (%I64dms)", + current_heap->heap_number, num_fl_items_rethreaded, num_fl_items, (end_us - start_us), ((end_us - start_us) / 1000))); (*num_total_fl_items) += num_fl_items; (*num_total_fl_items_rethreaded) += num_fl_items_rethreaded; @@ -19728,7 +19728,7 @@ BOOL gc_heap::allocate_more_space(alloc_context* acontext, size_t size, { if (alloced_on_retry) { - dprintf (5555, ("UOH h%d allocated %Id on retry (%" PRId64 "us)", alloc_heap->heap_number, size, (int64_t)(end_us - start_us))); + dprintf (5555, ("UOH h%d allocated %Id on retry (%I64dus)", alloc_heap->heap_number, size, (end_us - start_us))); } } } @@ -22496,15 +22496,15 @@ void gc_heap::update_end_gc_time_per_heap() if (heap_number == 0) { - dprintf (3, ("prev gen%d GC end time: prev start %" PRId64 " + prev gc elapsed %Id = %" PRId64, - gen_number, (int64_t)dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (int64_t)(dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)))); + dprintf (3, ("prev gen%d GC end time: prev start %I64d + prev gc elapsed %Id = %I64d", + gen_number, dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)))); } dd_gc_elapsed_time (dd) = (size_t)(end_gc_time - dd_time_clock (dd)); if (heap_number == 0) { - dprintf (3, ("updated NGC%d %Id elapsed time to %" PRId64 " - %" PRId64 " = %" PRId64, gen_number, dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_time_clock (dd), (int64_t)dd_gc_elapsed_time (dd))); + dprintf (3, ("updated NGC%d %Id elapsed time to %I64d - %I64d = %I64d", gen_number, dd_gc_clock (dd), end_gc_time, dd_time_clock (dd), dd_gc_elapsed_time (dd))); } } } @@ -22661,8 +22661,8 @@ void gc_heap::gc1() if ((heap_number == 0) && (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)) { time_since_last_gen2 = (size_t)(end_gc_time - (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd))); - dprintf (6666, ("BGC %Id end %" PRId64 " - (prev gen2 start %" PRId64 " + elapsed %Id = %" PRId64 ") = time inbewteen gen2 %Id", - dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (int64_t)(dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)), time_since_last_gen2)); + dprintf (6666, ("BGC %Id end %I64d - (prev gen2 start %I64d + elapsed %Id = %I64d) = time inbewteen gen2 %Id", + dd_gc_clock (dd), end_gc_time, dd_previous_time_clock (dd), dd_gc_elapsed_time (dd), (dd_previous_time_clock (dd) + dd_gc_elapsed_time (dd)), time_since_last_gen2)); } #endif //DYNAMIC_HEAP_COUNT @@ -22670,7 +22670,7 @@ void gc_heap::gc1() #ifdef DYNAMIC_HEAP_COUNT if ((heap_number == 0) && (dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes)) { - dprintf (6666, ("updating BGC %Id elapsed time to %" PRId64 " - %" PRId64 " = %" PRId64, dd_gc_clock (dd), (int64_t)end_gc_time, (int64_t)dd_time_clock (dd), (int64_t)dd_gc_elapsed_time (dd))); + dprintf (6666, ("updating BGC %Id elapsed time to %I64d - %I64d = %I64d", dd_gc_clock (dd), end_gc_time, dd_time_clock (dd), dd_gc_elapsed_time (dd))); float bgc_percent = (float)dd_gc_elapsed_time (dd) * 100.0f / (float)time_since_last_gen2; dynamic_heap_count_data_t::gen2_sample& g2_sample = dynamic_heap_count_data.gen2_samples[dynamic_heap_count_data.gen2_sample_index]; @@ -23328,8 +23328,8 @@ void gc_heap::merge_fl_from_other_heaps (int gen_idx, int to_n_heaps, int from_n uint64_t elapsed = GetHighPrecisionTimeStamp () - start_us; - dprintf (8888, ("rethreaded %Id items, merging took %" PRId64 "us (%" PRId64 "ms)", - total_num_fl_items_rethreaded_stage2, (int64_t)elapsed, (int64_t)(elapsed / 1000))); + dprintf (8888, ("rethreaded %Id items, merging took %I64dus (%I64dms)", + total_num_fl_items_rethreaded_stage2, elapsed, (elapsed / 1000))); #endif //_DEBUG for (int hn = 0; hn < to_n_heaps; hn++) @@ -25855,8 +25855,8 @@ void gc_heap::calculate_new_heap_count () assert (throughput_cost_percents[i] >= 0.0); if (throughput_cost_percents[i] > 100.0) throughput_cost_percents[i] = 100.0; - dprintf (6666, ("sample %d in GC#%Id msl %" PRId64 " / %d + pause %" PRId64 " / elapsed %" PRId64 " = tcp: %.3f, surv %zd, gc speed %zd/ms", i, - sample.gc_index, (int64_t)sample.msl_wait_time, n_heaps, (int64_t)sample.gc_pause_time, (int64_t)sample.elapsed_between_gcs, throughput_cost_percents[i], + dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i, + sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i], sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0))); } } @@ -25875,9 +25875,9 @@ void gc_heap::calculate_new_heap_count () min_pause = min (dynamic_heap_count_data.samples[i].gc_pause_time, min_pause); } - dprintf (6666, ("checking if samples are stable %Id %Id %Id, min tcp %.3f, min pause %" PRId64, + dprintf (6666, ("checking if samples are stable %Id %Id %Id, min tcp %.3f, min pause %I64d", dynamic_heap_count_data.samples[0].gc_survived_size, dynamic_heap_count_data.samples[1].gc_survived_size, dynamic_heap_count_data.samples[2].gc_survived_size, - min_tcp, (int64_t)min_pause)); + min_tcp, min_pause)); bool survived_stable_p = true; if (min_survived > 0) @@ -26743,7 +26743,7 @@ bool gc_heap::change_heap_count (int new_n_heaps) change_heap_count_time = GetHighPrecisionTimeStamp() - start_time; total_change_heap_count_time += change_heap_count_time; total_change_heap_count++; - dprintf (6666, ("changing HC took %" PRId64 "us", (int64_t)change_heap_count_time)); + dprintf (6666, ("changing HC took %I64dus", change_heap_count_time)); } return true; @@ -26808,9 +26808,9 @@ void gc_heap::process_datas_sample() assign_new_budget (0, desired_per_heap_datas); } - dprintf (6666, ("sample#%d: %d heaps, this GC end %" PRId64 " - last sus end %" PRId64 " = %" PRId64 ", this GC pause %.3fms, msl wait %" PRId64 "us, tcp %.3f, surv %zd, gc speed %.3fmb/ms (%.3fkb/ms/heap)", - dynamic_heap_count_data.sample_index, n_heaps, (int64_t)before_distribute_free_regions_time, (int64_t)last_suspended_end_time, (int64_t)sample.elapsed_between_gcs, - (sample.gc_pause_time / 1000.0), (int64_t)sample.msl_wait_time, tcp, sample.gc_survived_size, + dprintf (6666, ("sample#%d: %d heaps, this GC end %I64d - last sus end %I64d = %I64d, this GC pause %.3fms, msl wait %I64dus, tcp %.3f, surv %zd, gc speed %.3fmb/ms (%.3fkb/ms/heap)", + dynamic_heap_count_data.sample_index, n_heaps, before_distribute_free_regions_time, last_suspended_end_time, sample.elapsed_between_gcs, + (sample.gc_pause_time / 1000.0), sample.msl_wait_time, tcp, sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size / 1000.0 / sample.gc_pause_time) : 0), (sample.gc_pause_time ? ((float)sample.gc_survived_size / sample.gc_pause_time / n_heaps) : 0))); @@ -26839,8 +26839,8 @@ void gc_heap::process_datas_sample() g2_sample.gc_percent = (float)gen2_elapsed_time * 100.0f / elapsed_between_gen2_gcs; (dynamic_heap_count_data.current_gen2_samples_count)++; - dprintf (6666, ("gen2 sample#%d: this GC end %" PRId64 " - last gen2 end %" PRId64 " = %" PRId64 ", GC elapsed %" PRId64 ", percent %.3f", - dynamic_heap_count_data.gen2_sample_index, (int64_t)before_distribute_free_regions_time, (int64_t)prev_gen2_end_time, (int64_t)elapsed_between_gen2_gcs, (int64_t)gen2_elapsed_time, g2_sample.gc_percent)); + dprintf (6666, ("gen2 sample#%d: this GC end %I64d - last gen2 end %I64d = %I64d, GC elapsed %I64d, percent %.3f", + dynamic_heap_count_data.gen2_sample_index, before_distribute_free_regions_time, prev_gen2_end_time, elapsed_between_gen2_gcs, gen2_elapsed_time, g2_sample.gc_percent)); dynamic_heap_count_data.gen2_sample_index = (dynamic_heap_count_data.gen2_sample_index + 1) % dynamic_heap_count_data_t::sample_size; } diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index c14ad6c21a209e..998a7d7717d12d 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -1497,12 +1497,12 @@ void Compiler::compShutdown() jitprintf("GenTree node allocation stats\n"); jitprintf("---------------------------------------------------\n"); - jitprintf("Allocated %6" PRIu64 " tree nodes (%7" PRIu64 " bytes total, avg %4" PRIu64 " bytes per method)\n", - (uint64_t)genNodeSizeStats.genTreeNodeCnt, (uint64_t)genNodeSizeStats.genTreeNodeSize, - (uint64_t)(genNodeSizeStats.genTreeNodeSize / genMethodCnt)); + jitprintf("Allocated %6I64u tree nodes (%7I64u bytes total, avg %4I64u bytes per method)\n", + genNodeSizeStats.genTreeNodeCnt, genNodeSizeStats.genTreeNodeSize, + genNodeSizeStats.genTreeNodeSize / genMethodCnt); - jitprintf("Allocated %7" PRIu64 " bytes of unused tree node space (%3.2f%%)\n", - (uint64_t)(genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize), + jitprintf("Allocated %7I64u bytes of unused tree node space (%3.2f%%)\n", + genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize, (float)(100 * (genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize)) / genNodeSizeStats.genTreeNodeSize); diff --git a/src/coreclr/jit/disasm.cpp b/src/coreclr/jit/disasm.cpp index 24503662adda89..8f6c8d1cfd1a9c 100644 --- a/src/coreclr/jit/disasm.cpp +++ b/src/coreclr/jit/disasm.cpp @@ -371,7 +371,7 @@ size_t DisAssembler::disCchFixupMember( DISX86::TRMTA terminationType = DISX86::TRMTA(pdis->Trmta()); // DIS::ADDR disIndAddr; - DISASM_DUMP("FixupMember %016" PRIX64 " (%08" PRIxPTR "), size %d, termType %u\n", (uint64_t)addr, (uintptr_t)disGetLinearAddr((size_t)addr), size, + DISASM_DUMP("FixupMember %016I64X (%08IX), size %d, termType %u\n", addr, disGetLinearAddr((size_t)addr), size, terminationType); // Is there a relocation registered for the address? @@ -473,7 +473,7 @@ size_t DisAssembler::disCchFixupMember( DISARM64::TRMTA terminationType = DISARM64::TRMTA(pdis->Trmta()); // DIS::ADDR disIndAddr; - DISASM_DUMP("FixupMember %016" PRIX64 " (%08" PRIxPTR "), size %d, termType %u\n", (uint64_t)addr, (uintptr_t)disGetLinearAddr((size_t)addr), size, + DISASM_DUMP("FixupMember %016I64X (%08IX), size %d, termType %u\n", addr, disGetLinearAddr((size_t)addr), size, terminationType); // Is there a relocation registered for the address? @@ -1509,7 +1509,7 @@ void DisAssembler::disAsmCode(BYTE* hotCodePtr, assert(hotCodeSize > 0); if (coldCodeSize == 0) { - fprintf(disAsmFile, "************************** %hs:%hs size 0x%04zx **************************\n\n", + fprintf(disAsmFile, "************************** %hs:%hs size 0x%04IX **************************\n\n", disCurClassName, disCurMethodName, hotCodeSize); fprintf(disAsmFile, "Base address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); @@ -1517,7 +1517,7 @@ void DisAssembler::disAsmCode(BYTE* hotCodePtr, else { fprintf(disAsmFile, - "************************** %hs:%hs hot size 0x%04zx cold size 0x%04zx **************************\n\n", + "************************** %hs:%hs hot size 0x%04IX cold size 0x%04IX **************************\n\n", disCurClassName, disCurMethodName, hotCodeSize, coldCodeSize); fprintf(disAsmFile, "Hot address : %ph (RW: %ph)\n", dspAddr(hotCodePtr), dspAddr(hotCodePtrRW)); diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 243e29b0f186b7..8c00356c330415 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -12274,7 +12274,7 @@ void Compiler::gtDispConst(GenTree* tree) break; case GT_CNS_LNG: - printf(" 0x%016" PRIx64, (uint64_t)tree->AsLngCon()->gtLconVal); + printf(" 0x%016I64x", tree->AsLngCon()->gtLconVal); break; case GT_CNS_DBL: diff --git a/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp b/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp index 58a87fcbd30d60..65794f3f62f0d9 100644 --- a/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp +++ b/src/tests/JIT/Methodical/structs/systemvbringup/structinregs.cpp @@ -327,7 +327,7 @@ EXPORT(void) NATIVEAPI InvokeCallback20(PFNACTION20 callback, S20 s) #ifdef __GNUC__ printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w); #else - printf("Native S20: %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 "\n", (int64_t)s.x, (int64_t)s.y, (int64_t)s.z, (int64_t)s.w); + printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w); #endif callback(s); @@ -471,7 +471,7 @@ EXPORT(S20) NATIVEAPI InvokeCallback20R(PFNACTION20 callback, S20 s) #ifdef __GNUC__ printf("Native S20: %lld, %lld, %lld, %lld\n", s.x, s.y, s.z, s.w); #else - printf("Native S20: %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 "\n", (int64_t)s.x, (int64_t)s.y, (int64_t)s.z, (int64_t)s.w); + printf("Native S20: %I64d, %I64d, %I64d, %I64d\n", s.x, s.y, s.z, s.w); #endif callback(s); return s;