RFR: 8313302: Fix formatting errors on Windows [v3]

Julian Waters jwaters at openjdk.org
Mon Aug 7 02:29:31 UTC 2023


On Fri, 28 Jul 2023 09:33:45 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Julian Waters has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   zPhysicalMemoryBacking_windows.cpp
>
> src/hotspot/share/code/codeHeapState.cpp line 1387:
> 
>> 1385:                     "      occupied space) is used by the blocks in the given size range.\n"
>> 1386:                     "      %ld characters are printed per percentage point.\n", pctFactor/100);
>> 1387:       ast->print_cr("total size   of all blocks: " INT64_FORMAT_W(7) "M", (total_size<<log2_seg_size)/M);
> 
> Wrong for 32-bit platforms.

I don't quite know what to do here, since on platforms where long < size_t (which in practice is probably just 32 bit or Windows) this division will promote to the type of size_t, which is likely 64 bits in size, but unfortunately %zd cannot be used here since the promotion only happens on said platforms where long < size_t, which will trip a compilation breaking warning on platforms where sizeof long is sizeof size_t, which is probably just 64 bit platforms that are not Windows

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15063#discussion_r1285324651


More information about the hotspot-dev mailing list