JDK-8346280 : C2: implement late barrier elision for G1
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-12-16
  • Updated: 2025-02-26
  • Resolved: 2025-02-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b11Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
Currently, C2 can only elide pre-and post-barriers of G1 stores that follow immediately a newly allocated object. This RFE proposes analyzing C2's IR platform-dependent representation right before code emission (at PhaseOutput::perform_mach_node_analysis()) to elide barriers in stores as long as there is no safepoint poll between these and their corresponding allocations. Existing ZGC logic to perform a similar analysis can hopefully by generalized and reused.

The additional optimization would make it possible to remove barriers e.g. in conditional stores:

MyObject o = new MyObject();
if (c) {
    o.myField = ..; // elidable barrier
}

or in array initialization stores in small loops such as this:

Object[] a = new Object[64];
for (int i = 0; i < a.length; i++) {
    a[i] = ..; // elidable barrier (small counted loop without safepoint polls)
}
Comments
Changeset: 8193e0d5 Branch: master Author: Roberto CastaƱeda Lozano <rcastanedalo@openjdk.org> Date: 2025-02-18 10:23:35 +0000 URL: https://git.openjdk.org/jdk/commit/8193e0d53ac806d6974e2aacc7b7476aeb52a5fd
18-02-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23235 Date: 2025-01-22 15:20:19 +0000
22-01-2025