< prev index next >

src/hotspot/share/gc/g1/g1FullGCPrepareTask.inline.hpp

Print this page

 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP
 26 #define SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP
 27 
 28 #include "gc/g1/g1FullGCPrepareTask.hpp"
 29 
 30 #include "gc/g1/g1CollectedHeap.inline.hpp"
 31 #include "gc/g1/g1FullCollector.hpp"
 32 #include "gc/g1/g1FullGCCompactionPoint.hpp"
 33 #include "gc/g1/g1FullGCScope.hpp"
 34 #include "gc/g1/heapRegion.inline.hpp"

 35 
 36 void G1DetermineCompactionQueueClosure::free_empty_humongous_region(HeapRegion* hr) {
 37   _g1h->free_humongous_region(hr, nullptr);
 38   _collector->set_free(hr->hrm_index());
 39   add_to_compaction_queue(hr);
 40 }
 41 
 42 inline bool G1DetermineCompactionQueueClosure::should_compact(HeapRegion* hr) const {
 43   // There is no need to iterate and forward objects in non-movable regions ie.
 44   // prepare them for compaction.
 45   if (hr->is_humongous()) {
 46     return false;
 47   }
 48   size_t live_words = _collector->live_words(hr->hrm_index());
 49   size_t live_words_threshold = _collector->scope()->region_compaction_threshold();
 50   // High live ratio region will not be compacted.
 51   return live_words <= live_words_threshold;
 52 }
 53 
 54 inline uint G1DetermineCompactionQueueClosure::next_worker() {

 84       bool is_empty = !_collector->mark_bitmap()->is_marked(obj);
 85       if (is_empty) {
 86         free_empty_humongous_region(hr);
 87       } else {
 88         _collector->set_has_humongous();
 89       }
 90     } else {
 91       assert(MarkSweepDeadRatio > 0,
 92              "only skip compaction for other regions when MarkSweepDeadRatio > 0");
 93 
 94       // Too many live objects in the region; skip compacting it.
 95       _collector->update_from_compacting_to_skip_compacting(hr->hrm_index());
 96       log_trace(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT,
 97                             hr->hrm_index(), _collector->live_words(hr->hrm_index()));
 98     }
 99   }
100 
101   return false;
102 }
103 
104 inline size_t G1SerialRePrepareClosure::apply(oop obj) {
105   if (obj->is_forwarded()) {

106     // We skip objects compiled into the first region or
107     // into regions not part of the serial compaction point.
108     if (cast_from_oop<HeapWord*>(obj->forwardee()) < _dense_prefix_top) {
109       return obj->size();
110     }
111   }
112 
113   // Get size and forward.
114   size_t size = obj->size();
115   _cp->forward(obj, size);
116 
117   return size;
118 }
119 
120 #endif // SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP

 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP
 26 #define SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP
 27 
 28 #include "gc/g1/g1FullGCPrepareTask.hpp"
 29 
 30 #include "gc/g1/g1CollectedHeap.inline.hpp"
 31 #include "gc/g1/g1FullCollector.hpp"
 32 #include "gc/g1/g1FullGCCompactionPoint.hpp"
 33 #include "gc/g1/g1FullGCScope.hpp"
 34 #include "gc/g1/heapRegion.inline.hpp"
 35 #include "gc/shared/slidingForwarding.inline.hpp"
 36 
 37 void G1DetermineCompactionQueueClosure::free_empty_humongous_region(HeapRegion* hr) {
 38   _g1h->free_humongous_region(hr, nullptr);
 39   _collector->set_free(hr->hrm_index());
 40   add_to_compaction_queue(hr);
 41 }
 42 
 43 inline bool G1DetermineCompactionQueueClosure::should_compact(HeapRegion* hr) const {
 44   // There is no need to iterate and forward objects in non-movable regions ie.
 45   // prepare them for compaction.
 46   if (hr->is_humongous()) {
 47     return false;
 48   }
 49   size_t live_words = _collector->live_words(hr->hrm_index());
 50   size_t live_words_threshold = _collector->scope()->region_compaction_threshold();
 51   // High live ratio region will not be compacted.
 52   return live_words <= live_words_threshold;
 53 }
 54 
 55 inline uint G1DetermineCompactionQueueClosure::next_worker() {

 85       bool is_empty = !_collector->mark_bitmap()->is_marked(obj);
 86       if (is_empty) {
 87         free_empty_humongous_region(hr);
 88       } else {
 89         _collector->set_has_humongous();
 90       }
 91     } else {
 92       assert(MarkSweepDeadRatio > 0,
 93              "only skip compaction for other regions when MarkSweepDeadRatio > 0");
 94 
 95       // Too many live objects in the region; skip compacting it.
 96       _collector->update_from_compacting_to_skip_compacting(hr->hrm_index());
 97       log_trace(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT,
 98                             hr->hrm_index(), _collector->live_words(hr->hrm_index()));
 99     }
100   }
101 
102   return false;
103 }
104 
105 template <bool ALT_FWD>
106 inline size_t G1SerialRePrepareClosure<ALT_FWD>::apply(oop obj) {
107   if (SlidingForwarding::is_forwarded(obj)) {
108     // We skip objects compiled into the first region or
109     // into regions not part of the serial compaction point.
110     if (cast_from_oop<HeapWord*>(SlidingForwarding::forwardee<ALT_FWD>(obj)) < _dense_prefix_top) {
111       return obj->size();
112     }
113   }
114 
115   // Get size and forward.
116   size_t size = obj->size();
117   _cp->forward<ALT_FWD>(obj, size);
118 
119   return size;
120 }
121 
122 #endif // SHARE_GC_G1_G1FULLGCPREPARETASK_INLINE_HPP
< prev index next >