RFR: 8367413: Use size_t instead of julong in runtime/arguments.cpp [v2]
Albert Mingkun Yang
ayang at openjdk.org
Thu Sep 11 13:49:37 UTC 2025
On Thu, 11 Sep 2025 13:42:33 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:
>> Hello,
>>
>> There are several unnecessary uses of the julong type in arguments.cpp that could use size_t instead to fit in better with surrounding code. Almost all flags that are read in arguments.cpp are size_t, and the os functions it interacts with were changed from julong to size_t in [JDK-8357086](https://bugs.openjdk.org/browse/JDK-8357086) or are already taking in size_t.
>>
>> The main usage of julong in runtime/arguments.cpp is in Arguments::set_heap_size() and Arguments::set_aggressive_heap_flags(), where there are a lot of casts from julong types to size_t which could be removed with this change.
>>
>> Testing:
>> * Running through Oracle's tier1-3 on all Oracle supported platforms
>
> Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
>
> size_t casts for 32-bit part of test_arguments.cpp
src/hotspot/share/runtime/arguments.cpp line 1526:
> 1524: FLAG_SET_ERGO(MaxRAM, (uint64_t)phys_mem);
> 1525: } else {
> 1526: phys_mem = (size_t)MaxRAM;
Pre-existing: I wonder if this should be `MIN2(MaxRAM, SIZE_MAX)` to handle 32-bit systems.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27224#discussion_r2340949951
More information about the hotspot-runtime-dev
mailing list