--- old/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-12-15 13:00:12.017551610 +0100 +++ new/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2014-12-15 13:00:11.949549571 +0100 @@ -157,16 +157,16 @@ } while (!_refs->is_empty()); } -HeapWord* G1ParScanThreadState::allocate_in_next_plab(in_cset_state_t const state, - in_cset_state_t* dest, +HeapWord* G1ParScanThreadState::allocate_in_next_plab(InCSetState const state, + InCSetState* dest, size_t word_sz, AllocationContext_t const context) { - assert(state != InCSetState::NotInCSet, err_msg("Unexpected state: %u", state)); - assert(*dest != InCSetState::NotInCSet, err_msg("Unexpected dest: %u", *dest)); + assert(state.is_in_cset_or_humongous(), err_msg("Unexpected state: %u", state.value())); + assert(dest->is_in_cset_or_humongous(), err_msg("Unexpected dest: %u", dest->value())); // Right now we only have two types of regions (young / old) so // let's keep the logic here simple. We can generalize it when necessary. - if (*dest == InCSetState::Young) { + if (dest->is_young()) { HeapWord* const obj_ptr = _g1_par_allocator->allocate(InCSetState::Old, word_sz, context); if (obj_ptr == NULL) { @@ -176,17 +176,17 @@ // of a survivor region (given that apparently we cannot allocate // any new ones) to avoid coming into this slow path. _tenuring_threshold = 0; - *dest = InCSetState::Old; + dest->set_old(); return obj_ptr; } else { - assert(*dest == InCSetState::Old, err_msg("Unexpected dest: %u", *dest)); + assert(dest->is_old(), err_msg("Unexpected dest: %u", dest->value())); // no other space to try. return NULL; } } -in_cset_state_t G1ParScanThreadState::next_state(in_cset_state_t const state, markOop const m, uint& age) { - if (state == InCSetState::Young) { +InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) { + if (state.is_young()) { age = !m->has_displaced_mark_helper() ? m->age() : m->displaced_mark_helper()->age(); if (age < _tenuring_threshold) { @@ -196,7 +196,7 @@ return dest(state); } -oop G1ParScanThreadState::copy_to_survivor_space(in_cset_state_t const state, +oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state, oop const old, markOop const old_mark) { const size_t word_sz = old->size(); @@ -208,7 +208,7 @@ const AllocationContext_t context = from_region->allocation_context(); uint age = 0; - in_cset_state_t dest_state = next_state(state, old_mark, age); + InCSetState dest_state = next_state(state, old_mark, age); HeapWord* obj_ptr = _g1_par_allocator->plab_allocate(dest_state, word_sz, context); // PLAB allocations should succeed most of the time, so we'll @@ -244,7 +244,7 @@ if (forward_ptr == NULL) { Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz); - if (dest_state == InCSetState::Young) { + if (dest_state.is_young()) { if (age < markOopDesc::max_age) { age++; } @@ -264,8 +264,8 @@ } if (G1StringDedup::is_enabled()) { - const bool is_from_young = state == InCSetState::Young; - const bool is_to_young = dest_state == InCSetState::Young; + const bool is_from_young = state.is_young(); + const bool is_to_young = dest_state.is_young(); assert(is_from_young == _g1h->heap_region_containing_raw(old)->is_young(), "sanity"); assert(is_to_young == _g1h->heap_region_containing_raw(obj)->is_young(),