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

C2 doesn't optimize redundant memory operations with G1

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b110

      Description

      This java code:
              object.field = other_object;
              object.field = other_object;
      should be optimized by c2 as:
              object.field = other_object;
      but it's not with G1 enabled because GraphKit::g1_write_barrier_post() has:
      // Use Op_MemBarVolatile to achieve the effect of a StoreLoad barrier.
      insert_mem_bar(Op_MemBarVolatile, oop_store);

      which confuses StoreNode::Ideal()

      With the membar above commented out, the redundant store is optimized out but it seems we leave the pre/post barrier for the second store in.

      The membar seems too coarse grain as all is required is that store load between the write to a field and the load from the card table.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              roland Roland Westrelin
              Reporter:
              roland Roland Westrelin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: