RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v6]

Quan Anh Mai qamai at openjdk.org
Fri Dec 12 05:13:11 UTC 2025


> Hi,
> 
> The current escape analysis mechanism is all-or-nothing: either the object does not escape, or it does. If the object escapes, we lose the ability to analyse the values of its fields completely, even if the object only escapes at return.
> 
> This PR tries to find the escape status of an object at a load, and if it is decided that the object has not escaped there, we can try folding the load aggressively, ignoring calls and memory barriers to find a corresponding store that the load observes.
> 
> For the runtime cost, this phase runs very fast, around 5 - 7% the runtime of EA, and about 0.5% the total runtime of C2.
> 
> Please take a look and leave your thoughts, thanks a lot.

Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:

 - Merge branch 'master' into foldmem
 - grammar, safe change
 - more detailed explanations
 - store values need normalizing
 - Just use candidate_set directly
 - Some runtime calls may receive a derived pointer but not the base
 - Aggressively fold loads from objects that have not escaped

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28764/files
  - new: https://git.openjdk.org/jdk/pull/28764/files/2ca6bac7..6331d47c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28764&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28764&range=04-05

  Stats: 25130 lines in 238 files changed: 16968 ins; 7138 del; 1024 mod
  Patch: https://git.openjdk.org/jdk/pull/28764.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28764/head:pull/28764

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


More information about the hotspot-compiler-dev mailing list