src/hotspot/share/utilities/globalCounter.inline.hpp
changeset 51511 eb8d5aeabab3
parent 50429 83aec1d357d4
child 51548 35a6956f4243
equal deleted inserted replaced
51510:6b0012622443 51511:eb8d5aeabab3
    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_VM_thread() || thread->is_Java_thread(), "must be VMThread or JavaThread");
    34   assert(thread->is_Named_thread() || thread->is_Java_thread(), "must be NamedThread or JavaThread");
    35   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "nestled critical sections, not supported yet");
    35   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == 0x0, "nested critical sections, not supported yet");
    36   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    36   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    37   OrderAccess::release_store_fence(thread->get_rcu_counter(), gbl_cnt | COUNTER_ACTIVE);
    37   OrderAccess::release_store_fence(thread->get_rcu_counter(), gbl_cnt | COUNTER_ACTIVE);
    38 }
    38 }
    39 
    39 
    40 inline void GlobalCounter::critical_section_end(Thread *thread) {
    40 inline void GlobalCounter::critical_section_end(Thread *thread) {
    41   assert(thread == Thread::current(), "must be current thread");
    41   assert(thread == Thread::current(), "must be current thread");
    42   assert(thread->is_VM_thread() || thread->is_Java_thread(), "must be VMThread or JavaThread");
    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 ctitical section");
    43   assert((*thread->get_rcu_counter() & COUNTER_ACTIVE) == COUNTER_ACTIVE, "must be in critical section");
    44   // Mainly for debugging we set it to 'now'.
    44   // Mainly for debugging we set it to 'now'.
    45   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    45   uintx gbl_cnt = OrderAccess::load_acquire(&_global_counter._counter);
    46   OrderAccess::release_store(thread->get_rcu_counter(), gbl_cnt);
    46   OrderAccess::release_store(thread->get_rcu_counter(), gbl_cnt);
    47 }
    47 }
    48 
    48