src/hotspot/share/utilities/globalCounter.inline.hpp
changeset 51548 35a6956f4243
parent 51511 eb8d5aeabab3
child 52332 d2a3503c72f7
equal deleted inserted replaced
51547:2b004d807187 51548:35a6956f4243
    29 #include "runtime/thread.inline.hpp"
    29 #include "runtime/thread.inline.hpp"
    30 #include "utilities/globalCounter.hpp"
    30 #include "utilities/globalCounter.hpp"
    31 
    31 
    32 inline void GlobalCounter::critical_section_begin(Thread *thread) {
    32 inline void GlobalCounter::critical_section_begin(Thread *thread) {
    33   assert(thread == Thread::current(), "must be current thread");
    33   assert(thread == Thread::current(), "must be current thread");
    34   assert(thread->is_Named_thread() || thread->is_Java_thread(), "must be NamedThread or JavaThread");
       
    35   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "nested critical sections, not supported yet");
    34   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "nested critical sections, not supported yet");
    36   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    35   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    37   OrderAccess::release_store_fence(thread->get_rcu_counter(), gbl_cnt | COUNTER_ACTIVE);
    36   OrderAccess::release_store_fence(thread->get_rcu_counter(), gbl_cnt | COUNTER_ACTIVE);
    38 }
    37 }
    39 
    38 
    40 inline void GlobalCounter::critical_section_end(Thread *thread) {
    39 inline void GlobalCounter::critical_section_end(Thread *thread) {
    41   assert(thread == Thread::current(), "must be current thread");
    40   assert(thread == Thread::current(), "must be current thread");
    42   assert(thread->is_Named_thread() || thread->is_Java_thread(), "must be NamedThread or JavaThread");
       
    43   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == COUNTER_ACTIVE, "must be in critical section");
    41   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == COUNTER_ACTIVE, "must be in critical section");
    44   // Mainly for debugging we set it to 'now'.
    42   // Mainly for debugging we set it to 'now'.
    45   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    43   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    46   OrderAccess::release_store(thread->get_rcu_counter(), gbl_cnt);
    44   OrderAccess::release_store(thread->get_rcu_counter(), gbl_cnt);
    47 }
    45 }