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

Misplaced membar in C1 implementation of Unsafe.get/putXXX

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: hs20
    • Fix Version/s: hs20
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b07
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Backports

        Description

        The C1 shared code for generating the intrinsics for the Unsafe.getXXX and Unsafe.putXXX is:

        void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) {
          ...
          if (x->is_volatile() && os::is_MP()) __ membar_acquire();
          get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile());
          if (x->is_volatile() && os::is_MP()) __ membar();
        }

        void LIRGenerator::do_UnsafePutObject(UnsafePutObject* x) {
          ...
          if (x->is_volatile() && os::is_MP()) __ membar_release();
          put_Object_unsafe(src.result(), off.result(), data.result(), type, x->is_volatile());
        }

        Note that "get" has a final membar(), but it is the "put" that needs it.

        Also "get" should be "load; acquire" not "acquire; load"

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dholmes David Holmes
                Reporter:
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: