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

Misplaced membar in C1 implementation of Unsafe.get/putXXX

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • hs20
    • hs20
    • hotspot
    • None
    • b07
    • generic
    • generic
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: