equal
deleted
inserted
replaced
57 wait_for_no_evac_threads(); |
57 wait_for_no_evac_threads(); |
58 return; |
58 return; |
59 } |
59 } |
60 |
60 |
61 while (true) { |
61 while (true) { |
62 jint other = Atomic::cmpxchg(threads_in_evac + 1, &_threads_in_evac, threads_in_evac); |
62 jint other = Atomic::cmpxchg(&_threads_in_evac, threads_in_evac, threads_in_evac + 1); |
63 if (other == threads_in_evac) { |
63 if (other == threads_in_evac) { |
64 // Success: caller may safely enter evacuation |
64 // Success: caller may safely enter evacuation |
65 DEBUG_ONLY(ShenandoahThreadLocalData::set_evac_allowed(Thread::current(), true)); |
65 DEBUG_ONLY(ShenandoahThreadLocalData::set_evac_allowed(Thread::current(), true)); |
66 return; |
66 return; |
67 } else { |
67 } else { |
96 assert(ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "sanity"); |
96 assert(ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "sanity"); |
97 assert(!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current()), "TL oom-during-evac must not be set"); |
97 assert(!ShenandoahThreadLocalData::is_oom_during_evac(Thread::current()), "TL oom-during-evac must not be set"); |
98 |
98 |
99 jint threads_in_evac = Atomic::load_acquire(&_threads_in_evac); |
99 jint threads_in_evac = Atomic::load_acquire(&_threads_in_evac); |
100 while (true) { |
100 while (true) { |
101 jint other = Atomic::cmpxchg((threads_in_evac - 1) | OOM_MARKER_MASK, |
101 jint other = Atomic::cmpxchg(&_threads_in_evac, threads_in_evac, (threads_in_evac - 1) | OOM_MARKER_MASK); |
102 &_threads_in_evac, threads_in_evac); |
|
103 if (other == threads_in_evac) { |
102 if (other == threads_in_evac) { |
104 // Success: wait for other threads to get out of the protocol and return. |
103 // Success: wait for other threads to get out of the protocol and return. |
105 wait_for_no_evac_threads(); |
104 wait_for_no_evac_threads(); |
106 return; |
105 return; |
107 } else { |
106 } else { |