RFR: 8367754: G1: Add a fast path in heap resize related method [v3]

Guanqiang Han ghan at openjdk.org
Thu Sep 18 03:32:16 UTC 2025


> Please review this change.
> 
> **Description:**
> 
> It's common for some Java application engineers to configure the heap with the same minimum and maximum size in order to avoid the overhead of heap resizing.In such cases no expansion or shrinkage is possible, so i think we can adds a fast path at the beginning of the method to detect when the heap’s min and max capacities are equal and return early, thereby avoiding unnecessary computation.
> I added a check to determine whether MinHeapSize and MaxHeapSize are equal before performing the heap resize calculation. Since both MaxHeapSize and MinHeapSize are aligned to HeapAlignment, so  i think comparing them directly is good.
> 
> **Test:**
> 
> GHA

Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:

  Update TestHeapResizeAfterGC.java
  
  correct format error

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27349/files
  - new: https://git.openjdk.org/jdk/pull/27349/files/0cfec1fe..6786ee96

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27349&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27349&range=01-02

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/27349.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27349/head:pull/27349

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


More information about the hotspot-gc-dev mailing list