< prev index next >

src/hotspot/share/gc/g1/g1FullGCPrepareTask.cpp

Print this page

 87     // Determine if there are any unused compaction targets. This is only the case if
 88     // there are
 89     // - any regions in queue, so no free ones either.
 90     // - and the current region is not the last one in the list.
 91     if (compaction_point->has_regions() &&
 92         compaction_point->current_region() != compaction_point->regions()->last()) {
 93       set_has_free_compaction_targets();
 94     }
 95   }
 96   log_task("Prepare compaction task", worker_id, start);
 97 }
 98 
 99 G1FullGCPrepareTask::G1CalculatePointersClosure::G1CalculatePointersClosure(G1FullCollector* collector,
100                                                                             G1FullGCCompactionPoint* cp) :
101   _g1h(G1CollectedHeap::heap()),
102   _collector(collector),
103   _bitmap(collector->mark_bitmap()),
104   _cp(cp) { }
105 
106 
107 G1FullGCPrepareTask::G1PrepareCompactLiveClosure::G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp) :

108     _cp(cp) { }
109 
110 size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosure::apply(oop object) {

111   size_t size = object->size();
112   _cp->forward(object, size);
113   return size;
114 }
115 
116 void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction(HeapRegion* hr) {
117   if (!_collector->is_free(hr->hrm_index())) {
118     G1PrepareCompactLiveClosure prepare_compact(_cp);
119     hr->apply_to_marked_objects(_bitmap, &prepare_compact);





120   }
121 }

 87     // Determine if there are any unused compaction targets. This is only the case if
 88     // there are
 89     // - any regions in queue, so no free ones either.
 90     // - and the current region is not the last one in the list.
 91     if (compaction_point->has_regions() &&
 92         compaction_point->current_region() != compaction_point->regions()->last()) {
 93       set_has_free_compaction_targets();
 94     }
 95   }
 96   log_task("Prepare compaction task", worker_id, start);
 97 }
 98 
 99 G1FullGCPrepareTask::G1CalculatePointersClosure::G1CalculatePointersClosure(G1FullCollector* collector,
100                                                                             G1FullGCCompactionPoint* cp) :
101   _g1h(G1CollectedHeap::heap()),
102   _collector(collector),
103   _bitmap(collector->mark_bitmap()),
104   _cp(cp) { }
105 
106 
107 template <bool ALT_FWD>
108 G1FullGCPrepareTask::G1PrepareCompactLiveClosure<ALT_FWD>::G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp) :
109     _cp(cp) { }
110 
111 template <bool ALT_FWD>
112 size_t G1FullGCPrepareTask::G1PrepareCompactLiveClosure<ALT_FWD>::apply(oop object) {
113   size_t size = object->size();
114   _cp->forward<ALT_FWD>(object, size);
115   return size;
116 }
117 
118 void G1FullGCPrepareTask::G1CalculatePointersClosure::prepare_for_compaction(HeapRegion* hr) {
119   if (!_collector->is_free(hr->hrm_index())) {
120     if (UseAltGCForwarding) {
121       G1PrepareCompactLiveClosure<true> prepare_compact(_cp);
122       hr->apply_to_marked_objects(_bitmap, &prepare_compact);
123     } else {
124       G1PrepareCompactLiveClosure<false> prepare_compact(_cp);
125       hr->apply_to_marked_objects(_bitmap, &prepare_compact);
126     }
127   }
128 }
< prev index next >