Does transition_and_fence really assume TSO?

Andrew Haley aph at redhat.com
Wed Aug 3 00:04:22 UTC 2016


Here's an interesting comment:

  static inline void transition_and_fence(JavaThread *thread, JavaThreadState from, JavaThreadState to) {
    assert(thread->thread_state() == from, "coming from wrong thread state");
    assert((from & 1) == 0 && (to & 1) == 0, "odd numbers are transitions states");
    // Change to transition state (assumes total store ordering!  -Urs)
    thread->set_thread_state((JavaThreadState)(from + 1));

The "assumes total store ordering!" comment is rather alarming.  My
processor is not TSO.  But as far as I can see, all this really
requires is single-variable coherency.  Is that right?

Andrew.


More information about the hotspot-dev mailing list