RFR: 8367413: Refactor types in Arguments::set_heap_size() [v5]

Leo Korinth lkorinth at openjdk.org
Wed Oct 8 09:49:29 UTC 2025


On Wed, 8 Oct 2025 09:00:39 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:

>> Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename ram_limit_set to has_ram_limit
>
> src/hotspot/share/utilities/globalDefinitions.hpp line 1112:
> 
>> 1110:   return (size_t)MIN2(value, (T)std::numeric_limits<size_t>::max());
>> 1111: }
>> 1112: 
> 
> Maybe something more generic like this:
> 
> // return the value of B clamped by the numeric limits of S, casted to S
> template<class S, class B>
> S clamp_into_from(B value) {
>   static_assert(std::numeric_limits<B>::min() <= std::numeric_limits<S>::min(), "make sure the big type min can hold the small type min");
>   static_assert(std::numeric_limits<B>::max() >= std::numeric_limits<S>::max(), "make sure the big type max can hold the small type max");
>   B v = clamp<B>(value, std::numeric_limits<S>::min(), std::numeric_limits<S>::max());
>   return static_cast<S>(v);
> }
> 
> and place it after clamp?

I think my proposal is not optimal, please instead specialize your method to uint64_t and place it in arguments.cpp.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27224#discussion_r2413258617


More information about the hotspot-gc-dev mailing list