Integrated: 8323610: G1: HeapRegion pin count should be size_t to avoid overflows

Thomas Schatzl tschatzl at openjdk.org
Mon Jan 15 09:38:31 UTC 2024


On Fri, 12 Jan 2024 08:45:30 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   please review this change to extend the heap region's pin count to 64 bits (`size_t`) to avoid potential overflows; with uint, only 2^32 pins per regions are possible before overflow, which can be reached fairly quickly using modern computers. Extending the refcount to 64 bits makes it fairly impossible to achieve that in reasonable time.
> 
> Obviously this only happens if you do not unpin objects in the meantime.
> 
> There is no known failure because of that.
> 
> Testing: tier1-5 which is mostly about "it compiles", but some benchmarks do ~7M pins/s, extending the refcount to 64 bits would make overflow take something in the range of 10^9 years instead of a few minutes if I calculated correctly.
> 
> Thanks,
>   Thomas

This pull request has now been integrated.

Changeset: 8643cc21
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8643cc21333c6b51242ed3b9295b25f372244755
Stats:     12 lines in 5 files changed: 0 ins; 0 del; 12 mod

8323610: G1: HeapRegion pin count should be size_t to avoid overflows

Reviewed-by: kbarrett, ayang

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

PR: https://git.openjdk.org/jdk/pull/17390


More information about the hotspot-gc-dev mailing list