< prev index next >
src/share/vm/gc/shenandoah/shenandoahMarkCompact.cpp
Print this page
rev 13068 : [mq]: partial.patch
@@ -225,10 +225,17 @@
policy->record_phase_end(ShenandoahCollectorPolicy::full_gc_heapdumps);
policy->record_phase_end(ShenandoahCollectorPolicy::full_gc);
oopDesc::set_bs(old_bs);
+
+ if (UseShenandoahMatrix) {
+ if (PrintShenandoahMatrix) {
+ outputStream* log = Log(gc)::info_stream();
+ _heap->connection_matrix()->print_on(log);
+ }
+ }
}
#ifdef ASSERT
class VerifyNotForwardedPointersClosure : public MetadataAwareOopClosure {
private:
@@ -492,11 +499,11 @@
}
class ShenandoahAdjustPointersClosure : public MetadataAwareOopClosure {
private:
ShenandoahHeap* _heap;
-
+ uint _from_idx;
public:
ShenandoahAdjustPointersClosure() : _heap(ShenandoahHeap::heap()) {
}
@@ -507,32 +514,45 @@
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");
+ uint to_idx = _heap->heap_region_index_containing(forw);
+ _heap->connection_matrix()->set_connected(_from_idx, to_idx, true);
+ }
+ }
}
}
public:
void do_oop(oop* p) {
do_oop_work(p);
}
void do_oop(narrowOop* p) {
do_oop_work(p);
}
+ void set_from_idx(uint from_idx) {
+ _from_idx = from_idx;
+ }
};
class ShenandoahAdjustPointersObjectClosure : public ObjectClosure {
private:
- ShenandoahAdjustPointersClosure* _cl;
+ ShenandoahAdjustPointersClosure _cl;
ShenandoahHeap* _heap;
public:
- ShenandoahAdjustPointersObjectClosure(ShenandoahAdjustPointersClosure* cl) :
- _cl(cl), _heap(ShenandoahHeap::heap()) {
+ ShenandoahAdjustPointersObjectClosure() :
+ _heap(ShenandoahHeap::heap()) {
}
void do_object(oop p) {
assert(_heap->is_marked_complete(p), "must be marked");
- p->oop_iterate(_cl);
+ oop forw = oop(BrooksPointer::get_raw(p));
+ uint from_idx = _heap->heap_region_index_containing(forw);
+ _cl.set_from_idx(from_idx);
+ p->oop_iterate(&_cl);
}
};
class ShenandoahAdjustPointersTask : public AbstractGangTask {
private:
@@ -545,12 +565,11 @@
}
void work(uint worker_id) {
ShenandoahHeap* heap = ShenandoahHeap::heap();
ShenandoahHeapRegion* r = _regions->claim_next();
- ShenandoahAdjustPointersClosure cl;
- ShenandoahAdjustPointersObjectClosure obj_cl(&cl);
+ ShenandoahAdjustPointersObjectClosure obj_cl;
while (r != NULL) {
if (! r->is_humongous_continuation()) {
heap->marked_object_iterate(r, &obj_cl);
}
r = _regions->claim_next();
@@ -583,10 +602,14 @@
void ShenandoahMarkCompact::phase3_update_references() {
GCTraceTime(Info, gc, phases) time("Phase 2: Adjust pointers", _gc_timer);
ShenandoahHeap* heap = ShenandoahHeap::heap();
+ if (UseShenandoahMatrix) {
+ heap->connection_matrix()->clear_all();
+ }
+
// Need cleared claim bits for the roots processing
ClassLoaderDataGraph::clear_claimed_marks();
WorkGang* workers = heap->workers();
uint nworkers = workers->active_workers();
< prev index next >