39 class G1AdjustLiveClosure : public StackObj {
40 G1AdjustAndRebuildClosure* _adjust_closure;
41 public:
42 G1AdjustLiveClosure(G1AdjustAndRebuildClosure* cl) :
43 _adjust_closure(cl) { }
44
45 size_t apply(oop object) {
46 _adjust_closure->update_compaction_delta(object);
47 return object->oop_iterate_size(_adjust_closure);
48 }
49 };
50
51 class G1AdjustRegionClosure : public HeapRegionClosure {
52 G1CMBitMap* _bitmap;
53 uint _worker_id;
54 public:
55 G1AdjustRegionClosure(G1CMBitMap* bitmap, uint worker_id) :
56 _bitmap(bitmap),
57 _worker_id(worker_id) { }
58
59 bool doHeapRegion(HeapRegion* r) {
60 G1AdjustAndRebuildClosure cl(_worker_id);
61 if (r->is_humongous()) {
62 oop obj = oop(r->humongous_start_region()->bottom());
63 cl.update_compaction_delta(obj);
64 obj->oop_iterate(&cl, MemRegion(r->bottom(), r->top()));
65 } else if (r->is_open_archive()) {
66 // Only adjust the open archive regions, the closed ones
67 // never change.
68 G1AdjustLiveClosure adjust(&cl);
69 r->apply_to_marked_objects(_bitmap, &adjust);
70 // Open archive regions will not be compacted and the marking information is
71 // no longer needed. Clear it here to avoid having to do it later.
72 _bitmap->clear_region(r);
73 } else {
74 G1AdjustLiveClosure adjust(&cl);
75 r->apply_to_marked_objects(_bitmap, &adjust);
76 }
77 return false;
78 }
79 };
|
39 class G1AdjustLiveClosure : public StackObj {
40 G1AdjustAndRebuildClosure* _adjust_closure;
41 public:
42 G1AdjustLiveClosure(G1AdjustAndRebuildClosure* cl) :
43 _adjust_closure(cl) { }
44
45 size_t apply(oop object) {
46 _adjust_closure->update_compaction_delta(object);
47 return object->oop_iterate_size(_adjust_closure);
48 }
49 };
50
51 class G1AdjustRegionClosure : public HeapRegionClosure {
52 G1CMBitMap* _bitmap;
53 uint _worker_id;
54 public:
55 G1AdjustRegionClosure(G1CMBitMap* bitmap, uint worker_id) :
56 _bitmap(bitmap),
57 _worker_id(worker_id) { }
58
59 bool do_heap_region(HeapRegion* r) {
60 G1AdjustAndRebuildClosure cl(_worker_id);
61 if (r->is_humongous()) {
62 oop obj = oop(r->humongous_start_region()->bottom());
63 cl.update_compaction_delta(obj);
64 obj->oop_iterate(&cl, MemRegion(r->bottom(), r->top()));
65 } else if (r->is_open_archive()) {
66 // Only adjust the open archive regions, the closed ones
67 // never change.
68 G1AdjustLiveClosure adjust(&cl);
69 r->apply_to_marked_objects(_bitmap, &adjust);
70 // Open archive regions will not be compacted and the marking information is
71 // no longer needed. Clear it here to avoid having to do it later.
72 _bitmap->clear_region(r);
73 } else {
74 G1AdjustLiveClosure adjust(&cl);
75 r->apply_to_marked_objects(_bitmap, &adjust);
76 }
77 return false;
78 }
79 };
|