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_HPP
26 #define SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
27
28 #include "gc/g1/g1FullGCTask.hpp"
29 #include "gc/g1/heapRegion.hpp"
30 #include "memory/allocation.hpp"
31
32 class G1CollectedHeap;
33 class G1CMBitMap;
34 class G1FullCollector;
35 class G1FullGCCompactionPoint;
36 class HeapRegion;
37
38 // Determines the regions in the heap that should be part of the compaction and
39 // distributes them among the compaction queues in round-robin fashion.
40 class G1DetermineCompactionQueueClosure : public HeapRegionClosure {
41 G1CollectedHeap* _g1h;
42 G1FullCollector* _collector;
43 uint _cur_worker;
44
45 template<bool is_humongous>
46 inline void free_pinned_region(HeapRegion* hr);
47
48 inline bool should_compact(HeapRegion* hr) const;
49
50 // Returns the current worker id to assign a compaction point to, and selects
51 // the next one round-robin style.
52 inline uint next_worker();
53
54 inline G1FullGCCompactionPoint* next_compaction_point();
91 };
92
93 class G1ResetMetadataClosure : public HeapRegionClosure {
94 G1CollectedHeap* _g1h;
95 G1FullCollector* _collector;
96
97 void reset_region_metadata(HeapRegion* hr);
98 // Scrub all runs of dead objects within the given region by putting filler
99 // objects and updating the corresponding BOT. If update_bot_for_live is true,
100 // also update the BOT for live objects.
101 void scrub_skip_compacting_region(HeapRegion* hr, bool update_bot_for_live);
102
103 public:
104 G1ResetMetadataClosure(G1FullCollector* collector);
105
106 bool do_heap_region(HeapRegion* hr);
107 };
108
109 class G1PrepareCompactLiveClosure : public StackObj {
110 G1FullGCCompactionPoint* _cp;
111
112 public:
113 G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp);
114 size_t apply(oop object);
115 };
116 };
117
118 // Closure to re-prepare objects in the serial compaction point queue regions for
119 // serial compaction.
120 class G1SerialRePrepareClosure : public StackObj {
121 G1FullGCCompactionPoint* _cp;
122 HeapRegion* _current;
123
124 public:
125 G1SerialRePrepareClosure(G1FullGCCompactionPoint* hrcp, HeapRegion* hr) :
126 _cp(hrcp),
127 _current(hr) { }
128
129 inline size_t apply(oop obj);
130 };
131
132 #endif // SHARE_GC_G1_G1FULLGCPREPARETASK_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_HPP
26 #define SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
27
28 #include "gc/g1/g1FullGCTask.hpp"
29 #include "gc/g1/heapRegion.hpp"
30 #include "memory/allocation.hpp"
31
32 class G1CollectedHeap;
33 class G1CMBitMap;
34 class G1FullCollector;
35 class SlidingForwarding;
36 class G1FullGCCompactionPoint;
37 class HeapRegion;
38
39 // Determines the regions in the heap that should be part of the compaction and
40 // distributes them among the compaction queues in round-robin fashion.
41 class G1DetermineCompactionQueueClosure : public HeapRegionClosure {
42 G1CollectedHeap* _g1h;
43 G1FullCollector* _collector;
44 uint _cur_worker;
45
46 template<bool is_humongous>
47 inline void free_pinned_region(HeapRegion* hr);
48
49 inline bool should_compact(HeapRegion* hr) const;
50
51 // Returns the current worker id to assign a compaction point to, and selects
52 // the next one round-robin style.
53 inline uint next_worker();
54
55 inline G1FullGCCompactionPoint* next_compaction_point();
92 };
93
94 class G1ResetMetadataClosure : public HeapRegionClosure {
95 G1CollectedHeap* _g1h;
96 G1FullCollector* _collector;
97
98 void reset_region_metadata(HeapRegion* hr);
99 // Scrub all runs of dead objects within the given region by putting filler
100 // objects and updating the corresponding BOT. If update_bot_for_live is true,
101 // also update the BOT for live objects.
102 void scrub_skip_compacting_region(HeapRegion* hr, bool update_bot_for_live);
103
104 public:
105 G1ResetMetadataClosure(G1FullCollector* collector);
106
107 bool do_heap_region(HeapRegion* hr);
108 };
109
110 class G1PrepareCompactLiveClosure : public StackObj {
111 G1FullGCCompactionPoint* _cp;
112 SlidingForwarding* const _forwarding;
113
114 public:
115 G1PrepareCompactLiveClosure(G1FullGCCompactionPoint* cp);
116 size_t apply(oop object);
117 };
118 };
119
120 // Closure to re-prepare objects in the serial compaction point queue regions for
121 // serial compaction.
122 //class G1SerialRePrepareClosure : public StackObj {
123 // G1FullGCCompactionPoint* _cp;
124 // HeapRegion* _current;
125 //
126 //public:
127 // G1SerialRePrepareClosure(G1FullGCCompactionPoint* hrcp, HeapRegion* hr) :
128 // _cp(hrcp),
129 // _current(hr) { }
130 //
131 // inline size_t apply(oop obj);
132 //};
133
134 #endif // SHARE_GC_G1_G1FULLGCPREPARETASK_HPP
|