Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6816756

Remove useless pre/post barriers when the corresponding store is optimized away

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 7, 9, 10
    • hotspot
    • generic
    • generic

      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.

            Unassigned Unassigned
            cfang Changpeng Fang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: