On Thu, 11 Jun 2026 16:46:16 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). > > Chris Plummer has updated the pull request incrementally with one additional > commit since the last revision: > > get rid of unneeded module Looks good. We're checking "hr.top() == hrTop.top()" which compares top() of the HR we got from the iterator, with hrTop.top() which is a HR we got by address, from hr.top() or possibly from hr.top() - 1. The regions should just be completely the same? But we don't need to add a full comparison for this if we don't have it already. ------------- Marked as reviewed by kevinw (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/31469#pullrequestreview-4480234751
