Misplaced membar in C1 implementation of Unsafe.get/putXXX

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • hs20
    • Affects Version/s: hs20
    • Component/s: hotspot
    • None
    • b07
    • generic
    • generic
    • Not verified

        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"

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: