JDK-6816756 : Remove useless pre/post barriers when the corresponding store is optimized away
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7,9,10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2009-03-12
  • Updated: 2019-01-15
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
GC needs pre-barrier(G1) and post-barrier(G1 and CMS) for a StoreP. However, the
corresponding StoreP may be optimized away in C2 optimization. This may cause some
assertion failures (JDK-6636138) and performance issue. Here is the sample code
from bug JDK-6636138, which has an assertion failure in superword optimization: 

public class Tester {
    public class Tester {
    static String var_bad = "Anything"; // static is important here

    public static void main(String[] args)
    {
        for (int i=0; i < 1000; var_bad = var_bad, i++);
        System.out.println("var_bad: " + var_bad);
    }
}

"var_bad = var_bad" is useless and will be optimizd away. However, for any concurrent garbage collection, the post barrier (StoreCM, for example) is still
there, and its oop_store is no longer a store node. This cause the assertion failure. 
The assertion failure occur with -XX:+UseConcMarkSweepGC
This is an RFE, not a bug.  The assertion failure mentioned above was fixed (avoided, actually) by JDK-6636138.

Comments
[~sfriberg], something for you?
23-05-2014

This looks like there might be a performance problem, but no measurements, nor anyone complaining of poor performance. Therefore I lowered priority to P4.
16-01-2014