RFR(M): 8155949: Support relaxed semantics in cmpxchg

Andrew Haley aph at redhat.com
Fri May 20 08:31:27 UTC 2016


[Sorry, this is a resend of a messge to get to the right groups.]

There is one significant problem with this approach.

Atomic::cmpxchg(jint) is defined like this in atomic.cpp:

  unsigned Atomic::cmpxchg(unsigned int exchange_value,
                           volatile unsigned int* dest, unsigned int compare_value,
                           cmpxchg_memory_order order) {
    assert(sizeof(unsigned int) == sizeof(jint), "more work to do");
    return (unsigned int)Atomic::cmpxchg((jint)exchange_value, (volatile jint*)dest,
                                         (jint)compare_value, order);
  }

Because this is in atomic.cpp, there is a *runtime* test on the memory
order: the compiler can't constant propagate it.  If we're adding the
cmpxchg_memory_order I think we should move Atomic::cmpxchg(jint) to
atomic.inline.hpp.

Andrew.




More information about the hotspot-gc-dev mailing list