src/hotspot/share/utilities/globalCounter.inline.hpp
changeset 59247 56bf71d64d51
parent 53244 9807daeb47c4
child 59290 97d13893ec3c
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
    38   // Otherwise, set the counter to the current version + active bit.
    38   // Otherwise, set the counter to the current version + active bit.
    39   uintx new_cnt = old_cnt;
    39   uintx new_cnt = old_cnt;
    40   if ((new_cnt & COUNTER_ACTIVE) == 0) {
    40   if ((new_cnt & COUNTER_ACTIVE) == 0) {
    41     new_cnt = Atomic::load(&_global_counter._counter) | COUNTER_ACTIVE;
    41     new_cnt = Atomic::load(&_global_counter._counter) | COUNTER_ACTIVE;
    42   }
    42   }
    43   OrderAccess::release_store_fence(thread->get_rcu_counter(), new_cnt);
    43   Atomic::release_store_fence(thread->get_rcu_counter(), new_cnt);
    44   return static_cast<CSContext>(old_cnt);
    44   return static_cast<CSContext>(old_cnt);
    45 }
    45 }
    46 
    46 
    47 inline void
    47 inline void
    48 GlobalCounter::critical_section_end(Thread *thread, CSContext context) {
    48 GlobalCounter::critical_section_end(Thread *thread, CSContext context) {
    49   assert(thread == Thread::current(), "must be current thread");
    49   assert(thread == Thread::current(), "must be current thread");
    50   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == COUNTER_ACTIVE, "must be in critical section");
    50   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == COUNTER_ACTIVE, "must be in critical section");
    51   // Restore the counter value from before the associated begin.
    51   // Restore the counter value from before the associated begin.
    52   OrderAccess::release_store(thread->get_rcu_counter(),
    52   Atomic::release_store(thread->get_rcu_counter(),
    53                              static_cast<uintx>(context));
    53                         static_cast<uintx>(context));
    54 }
    54 }
    55 
    55 
    56 class GlobalCounter::CriticalSection {
    56 class GlobalCounter::CriticalSection {
    57  private:
    57  private:
    58   Thread* _thread;
    58   Thread* _thread;