< prev index next >
src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp
Print this page
rev 14453 : Remove secondary marking bitmap.
*** 76,86 ****
public:
ShenandoahClearRegionStatusClosure() : _heap(ShenandoahHeap::heap()) {}
bool heap_region_do(ShenandoahHeapRegion *r) {
! _heap->set_next_top_at_mark_start(r->bottom(), r->top());
r->clear_live_data();
r->set_concurrent_iteration_safe_limit(r->top());
return false;
}
};
--- 76,86 ----
public:
ShenandoahClearRegionStatusClosure() : _heap(ShenandoahHeap::heap()) {}
bool heap_region_do(ShenandoahHeapRegion *r) {
! _heap->set_top_at_mark_start(r->bottom(), r->top());
r->clear_live_data();
r->set_concurrent_iteration_safe_limit(r->top());
return false;
}
};
*** 145,156 ****
heap->set_evacuation_in_progress_at_safepoint(false);
}
assert(!heap->is_evacuation_in_progress(), "sanity");
// c. Reset the bitmaps for new marking
! heap->reset_next_mark_bitmap(heap->workers());
! assert(heap->is_next_bitmap_clear(), "sanity");
// d. Abandon reference discovery and clear all discovered references.
ReferenceProcessor* rp = heap->ref_processor();
rp->disable_discovery();
rp->abandon_partial_discovery();
--- 145,156 ----
heap->set_evacuation_in_progress_at_safepoint(false);
}
assert(!heap->is_evacuation_in_progress(), "sanity");
// c. Reset the bitmaps for new marking
! heap->reset_mark_bitmap(heap->workers());
! assert(heap->is_bitmap_clear(), "sanity");
// d. Abandon reference discovery and clear all discovered references.
ReferenceProcessor* rp = heap->ref_processor();
rp->disable_discovery();
rp->abandon_partial_discovery();
*** 183,193 ****
{
GCTraceTime(Info, gc) time("Pause Full", _gc_timer, gc_cause, true);
if (UseTLAB) {
! heap->ensure_parsability(true);
}
CodeCache::gc_prologue();
// We should save the marks of the currently locked biased monitors.
--- 183,193 ----
{
GCTraceTime(Info, gc) time("Pause Full", _gc_timer, gc_cause, true);
if (UseTLAB) {
! heap->make_tlabs_parsable(true);
}
CodeCache::gc_prologue();
// We should save the marks of the currently locked biased monitors.
*** 293,304 ****
cm->update_roots(ShenandoahPhaseTimings::full_gc_roots);
cm->mark_roots(ShenandoahPhaseTimings::full_gc_roots);
cm->shared_finish_mark_from_roots(/* full_gc = */ true);
- _heap->swap_mark_bitmaps();
-
if (UseShenandoahMatrix && PrintShenandoahMatrix) {
LogTarget(Info, gc) lt;
LogStream ls(lt);
_heap->connection_matrix()->print_on(&ls);
}
--- 293,302 ----
*** 316,325 ****
--- 314,324 ----
// fail. At the end of the GC, the original mark word values
// (including hash values) are restored to the appropriate
// objects.
_heap->verify(VerifyOption_G1UseMarkWord);
}
+ _heap->set_bitmap_valid(true);
}
class ShenandoahMCReclaimHumongousRegionClosure : public ShenandoahHeapRegionClosure {
private:
ShenandoahHeap* _heap;
*** 328,338 ****
}
bool heap_region_do(ShenandoahHeapRegion* r) {
if (r->is_humongous_start()) {
oop humongous_obj = oop(r->bottom() + BrooksPointer::word_size());
! if (! _heap->is_marked_complete(humongous_obj)) {
_heap->trash_humongous_region_at(r);
}
}
return false;
}
--- 327,337 ----
}
bool heap_region_do(ShenandoahHeapRegion* r) {
if (r->is_humongous_start()) {
oop humongous_obj = oop(r->bottom() + BrooksPointer::word_size());
! if (! _heap->is_marked(humongous_obj)) {
_heap->trash_humongous_region_at(r);
}
}
return false;
}
*** 369,380 ****
HeapWord* compact_point() const {
return _compact_point;
}
void do_object(oop p) {
assert(_from_region != NULL, "must set before work");
! assert(_heap->is_marked_complete(p), "must be marked");
! assert(! _heap->allocated_after_complete_mark_start((HeapWord*) p), "must be truly marked");
size_t obj_size = p->size() + BrooksPointer::word_size();
if (_compact_point + obj_size > _to_region->end()) {
// Object doesn't fit. Pick next to-region and start compacting there.
_to_region->set_new_top(_compact_point);
ShenandoahHeapRegion* new_to_region = _to_regions->current();
--- 368,379 ----
HeapWord* compact_point() const {
return _compact_point;
}
void do_object(oop p) {
assert(_from_region != NULL, "must set before work");
! assert(_heap->is_marked(p), "must be marked");
! assert(! _heap->allocated_after_mark_start((HeapWord*) p), "must be truly marked");
size_t obj_size = p->size() + BrooksPointer::word_size();
if (_compact_point + obj_size > _to_region->end()) {
// Object doesn't fit. Pick next to-region and start compacting there.
_to_region->set_new_top(_compact_point);
ShenandoahHeapRegion* new_to_region = _to_regions->current();
*** 495,505 ****
template <class T>
inline void do_oop_work(T* p) {
T o = oopDesc::load_heap_oop(p);
if (! oopDesc::is_null(o)) {
oop obj = oopDesc::decode_heap_oop_not_null(o);
! assert(_heap->is_marked_complete(obj), "must be marked");
oop forw = oop(BrooksPointer::get_raw(obj));
oopDesc::encode_store_heap_oop(p, forw);
if (UseShenandoahMatrix) {
if (_heap->is_in_reserved(p)) {
assert(_heap->is_in_reserved(forw), "must be in heap");
--- 494,504 ----
template <class T>
inline void do_oop_work(T* p) {
T o = oopDesc::load_heap_oop(p);
if (! oopDesc::is_null(o)) {
oop obj = oopDesc::decode_heap_oop_not_null(o);
! assert(_heap->is_marked(obj), "must be marked");
oop forw = oop(BrooksPointer::get_raw(obj));
oopDesc::encode_store_heap_oop(p, forw);
if (UseShenandoahMatrix) {
if (_heap->is_in_reserved(p)) {
assert(_heap->is_in_reserved(forw), "must be in heap");
*** 534,544 ****
public:
ShenandoahAdjustPointersObjectClosure() :
_heap(ShenandoahHeap::heap()) {
}
void do_object(oop p) {
! assert(_heap->is_marked_complete(p), "must be marked");
HeapWord* forw = BrooksPointer::get_raw(p);
_cl.set_new_obj_offset(pointer_delta((HeapWord*) p, forw));
p->oop_iterate(&_cl);
}
};
--- 533,543 ----
public:
ShenandoahAdjustPointersObjectClosure() :
_heap(ShenandoahHeap::heap()) {
}
void do_object(oop p) {
! assert(_heap->is_marked(p), "must be marked");
HeapWord* forw = BrooksPointer::get_raw(p);
_cl.set_new_obj_offset(pointer_delta((HeapWord*) p, forw));
p->oop_iterate(&_cl);
}
};
*** 625,635 ****
public:
ShenandoahCompactObjectsClosure(uint worker_id) : _heap(ShenandoahHeap::heap()),
_str_dedup(ShenandoahStringDedup::is_enabled()), _worker_id(worker_id) {
}
void do_object(oop p) {
! assert(_heap->is_marked_complete(p), "must be marked");
size_t size = (size_t)p->size();
HeapWord* compact_to = BrooksPointer::get_raw(p);
HeapWord* compact_from = (HeapWord*) p;
if (compact_from != compact_to) {
Copy::aligned_conjoint_words(compact_from, compact_to, size);
--- 624,634 ----
public:
ShenandoahCompactObjectsClosure(uint worker_id) : _heap(ShenandoahHeap::heap()),
_str_dedup(ShenandoahStringDedup::is_enabled()), _worker_id(worker_id) {
}
void do_object(oop p) {
! assert(_heap->is_marked(p), "must be marked");
size_t size = (size_t)p->size();
HeapWord* compact_to = BrooksPointer::get_raw(p);
HeapWord* compact_from = (HeapWord*) p;
if (compact_from != compact_to) {
Copy::aligned_conjoint_words(compact_from, compact_to, size);
*** 680,693 ****
ShenandoahPostCompactClosure() : _live(0), _heap(ShenandoahHeap::heap()) {
_heap->clear_free_regions();
}
bool heap_region_do(ShenandoahHeapRegion* r) {
! // Need to reset the complete-top-at-mark-start pointer here because
! // the complete marking bitmap is no longer valid. This ensures
// size-based iteration in marked_object_iterate().
! _heap->set_complete_top_at_mark_start(r->bottom(), r->bottom());
size_t live = r->used();
// Turn any lingering non-empty cset regions into regular regions.
// This must be the leftover from the cancelled concurrent GC.
--- 679,692 ----
ShenandoahPostCompactClosure() : _live(0), _heap(ShenandoahHeap::heap()) {
_heap->clear_free_regions();
}
bool heap_region_do(ShenandoahHeapRegion* r) {
! // Need to reset the top-at-mark-start pointer here because
! // the marking bitmap is no longer valid. This ensures
// size-based iteration in marked_object_iterate().
! _heap->set_top_at_mark_start(r->bottom(), r->bottom());
size_t live = r->used();
// Turn any lingering non-empty cset regions into regular regions.
// This must be the leftover from the cancelled concurrent GC.
*** 728,740 ****
GCTraceTime(Info, gc, phases) time("Phase 4: Move objects", _gc_timer);
ShenandoahHeap* heap = ShenandoahHeap::heap();
ShenandoahCompactObjectsTask compact_task(copy_queues);
heap->workers()->run_task(&compact_task);
! // Reset complete bitmap. We're about to reset the complete-top-at-mark-start pointer
// and must ensure the bitmap is in sync.
! heap->reset_complete_mark_bitmap(heap->workers());
{
ShenandoahHeapLocker lock(heap->lock());
ShenandoahPostCompactClosure post_compact;
heap->heap_region_iterate(&post_compact);
--- 727,739 ----
GCTraceTime(Info, gc, phases) time("Phase 4: Move objects", _gc_timer);
ShenandoahHeap* heap = ShenandoahHeap::heap();
ShenandoahCompactObjectsTask compact_task(copy_queues);
heap->workers()->run_task(&compact_task);
! // Reset marking bitmap. We're about to reset the top-at-mark-start pointer
// and must ensure the bitmap is in sync.
! heap->reset_mark_bitmap(heap->workers());
{
ShenandoahHeapLocker lock(heap->lock());
ShenandoahPostCompactClosure post_compact;
heap->heap_region_iterate(&post_compact);
*** 743,755 ****
}
heap->collection_set()->clear();
heap->clear_cancelled_concgc();
- // Also clear the next bitmap in preparation for next marking.
- heap->reset_next_mark_bitmap(heap->workers());
-
for (uint i = 0; i < heap->max_workers(); i++) {
delete copy_queues[i];
}
}
--- 742,751 ----
< prev index next >