RFR: 8261859: gc/g1/TestStringDeduplicationTableRehash.java failed with "RuntimeException: 'Rehash Count: 0' found in stdout" [v2]
Kim Barrett
kbarrett at openjdk.java.net
Mon Mar 1 17:31:44 UTC 2021
On Mon, 1 Mar 2021 10:56:07 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:
>> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>>
>> limit shrink, add asserts for new size
>
> src/hotspot/share/gc/shared/stringdedup/stringDedupTable.cpp line 410:
>
>> 408: // Compute new size. We can't shrink by more than a factor of 2,
>> 409: // because the partitioning for parallelization doesn't support more.
>> 410: if (size > _min_size) size /= 2;
>
> I would prefer braces :) But an even nicer solution would be to use `clamp(...)` both for the grow and shrink case. What do you think about that?
I think clamp just confuses things because only one of the bounds matters,
which bound depending on whether growing or shrinking. And on the grow side
the prior test against _max_size is still needed to eliminate any questions
about overflow. That is, I wouldn't want to just use
size = clamp(round_up_power_of_2(needed), _min_size, _max_size);
without the prior check, because the round_up could perhaps overflow (at
least in theory, and maybe only on 32bit platforms). But with the prior
check the clamp is superfluous.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2769
More information about the hotspot-gc-dev
mailing list