On Wed, 10 Jun 2026 20:26:08 GMT, Chris Plummer <[email protected]> wrote:

> This is a test bug.  The gets the first region, gets top() for the that 
> region, and then uses that top() address to get the region that top() is in. 
> It expects it to be the same region. However, when the region is full, top() 
> is actually the next address beyond the end of the region, so marks the start 
> of the next region. The fix is to simply subtract 1 from top() when it equals 
> end(). Note top() is where the next allocation comes from in the region and 
> end() is the end of region space.
> 
> I improved the test by adding printing of the G1 heap, including all regions. 
> I also improved the test by making it test every region, not just the first 
> one. During local testing the first region was always free, so did not make 
> for a very good test, and would not reproduce the issue. When I started 
> testing every region, it failed every time. All you need is one full region 
> for failures.
> 
> I ran the test 100 times on all supported platforms.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

test/hotspot/jtreg/serviceability/sa/TestG1HeapRegion.java line 52:

> 50:  *          jdk.hotspot.agent/sun.jvm.hotspot.debugger
> 51:  *          jdk.hotspot.agent/sun.jvm.hotspot.gc.g1
> 52:  *          jdk.hotspot.agent/sun.jvm.hotspot.gc.shared

`sun.jvm.hotspot.gc.shared` does not seem to be used, so we can remove this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31469#discussion_r3392472751

Reply via email to