8076225: Move the thread claim parity from SharedHeap to Thread

Reviewed-by: brutisso, jwilhelm, kbarrett
This commit is contained in:
Mikael Gerdin 2015-03-31 07:54:56 +02:00
parent 0efa369ffb
commit 062cf882e0
6 changed files with 39 additions and 26 deletions

View file

@ -40,7 +40,6 @@ SharedHeap* SharedHeap::_sh;
SharedHeap::SharedHeap(CollectorPolicy* policy_) :
CollectedHeap(),
_collector_policy(policy_),
_strong_roots_parity(0),
_workers(NULL)
{
_sh = this; // ch is static, should be set only once.
@ -68,26 +67,20 @@ void SharedHeap::set_par_threads(uint t) {
_n_par_threads = t;
}
void SharedHeap::change_strong_roots_parity() {
// Also set the new collection parity.
assert(_strong_roots_parity >= 0 && _strong_roots_parity <= 2,
"Not in range.");
_strong_roots_parity++;
if (_strong_roots_parity == 3) _strong_roots_parity = 1;
assert(_strong_roots_parity >= 1 && _strong_roots_parity <= 2,
"Not in range.");
}
SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* heap, bool activate)
: MarkScope(activate), _sh(heap)
{
if (_active) {
_sh->change_strong_roots_parity();
Threads::change_thread_claim_parity();
// Zero the claimed high water mark in the StringTable
StringTable::clear_parallel_claimed_index();
}
}
SharedHeap::StrongRootsScope::~StrongRootsScope() {
Threads::assert_all_threads_claimed();
}
void SharedHeap::set_barrier_set(BarrierSet* bs) {
_barrier_set = bs;
// Cached barrier set for fast access in oops