30 // Closures used for standard G1 evacuation.
31 class G1EvacuationClosures : public G1EvacuationRootClosures {
32 G1SharedClosures<G1MarkNone> _closures;
33
34 public:
35 G1EvacuationClosures(G1CollectedHeap* g1h,
36 G1ParScanThreadState* pss,
37 bool in_young_gc) :
38 _closures(g1h, pss, in_young_gc) {}
39
40 OopClosure* weak_oops() { return &_closures._oops; }
41 OopClosure* strong_oops() { return &_closures._oops; }
42
43 CLDClosure* weak_clds() { return &_closures._clds; }
44 CLDClosure* strong_clds() { return &_closures._clds; }
45
46 CodeBlobClosure* strong_codeblobs() { return &_closures._codeblobs; }
47 CodeBlobClosure* weak_codeblobs() { return &_closures._codeblobs; }
48 };
49
50 // Closures used during initial mark.
51 // The treatment of "weak" roots is selectable through the template parameter,
52 // this is usually used to control unloading of classes and interned strings.
53 template <G1Mark MarkWeak>
54 class G1InitialMarkClosures : public G1EvacuationRootClosures {
55 G1SharedClosures<G1MarkFromRoot> _strong;
56 G1SharedClosures<MarkWeak> _weak;
57
58 public:
59 G1InitialMarkClosures(G1CollectedHeap* g1h,
60 G1ParScanThreadState* pss) :
61 _strong(g1h, pss, /* process_only_dirty_klasses */ false),
62 _weak(g1h, pss, /* process_only_dirty_klasses */ false) {}
63
64 OopClosure* weak_oops() { return &_weak._oops; }
65 OopClosure* strong_oops() { return &_strong._oops; }
66
67 CLDClosure* weak_clds() { return &_weak._clds; }
68 CLDClosure* strong_clds() { return &_strong._clds; }
69
70 CodeBlobClosure* strong_codeblobs() { return &_strong._codeblobs; }
71 CodeBlobClosure* weak_codeblobs() { return &_weak._codeblobs; }
72 };
73
74 G1EvacuationRootClosures* G1EvacuationRootClosures::create_root_closures(G1ParScanThreadState* pss, G1CollectedHeap* g1h) {
75 G1EvacuationRootClosures* res = NULL;
76 if (g1h->collector_state()->in_initial_mark_gc()) {
77 if (ClassUnloadingWithConcurrentMark) {
78 res = new G1InitialMarkClosures<G1MarkPromotedFromRoot>(g1h, pss);
79 } else {
80 res = new G1InitialMarkClosures<G1MarkFromRoot>(g1h, pss);
81 }
82 } else {
83 res = new G1EvacuationClosures(g1h, pss, g1h->collector_state()->in_young_only_phase());
84 }
85 return res;
86 }
|
30 // Closures used for standard G1 evacuation.
31 class G1EvacuationClosures : public G1EvacuationRootClosures {
32 G1SharedClosures<G1MarkNone> _closures;
33
34 public:
35 G1EvacuationClosures(G1CollectedHeap* g1h,
36 G1ParScanThreadState* pss,
37 bool in_young_gc) :
38 _closures(g1h, pss, in_young_gc) {}
39
40 OopClosure* weak_oops() { return &_closures._oops; }
41 OopClosure* strong_oops() { return &_closures._oops; }
42
43 CLDClosure* weak_clds() { return &_closures._clds; }
44 CLDClosure* strong_clds() { return &_closures._clds; }
45
46 CodeBlobClosure* strong_codeblobs() { return &_closures._codeblobs; }
47 CodeBlobClosure* weak_codeblobs() { return &_closures._codeblobs; }
48 };
49
50 // Closures used during concurrent start.
51 // The treatment of "weak" roots is selectable through the template parameter,
52 // this is usually used to control unloading of classes and interned strings.
53 template <G1Mark MarkWeak>
54 class G1ConcurrentStartMarkClosures : public G1EvacuationRootClosures {
55 G1SharedClosures<G1MarkFromRoot> _strong;
56 G1SharedClosures<MarkWeak> _weak;
57
58 public:
59 G1ConcurrentStartMarkClosures(G1CollectedHeap* g1h,
60 G1ParScanThreadState* pss) :
61 _strong(g1h, pss, /* process_only_dirty_klasses */ false),
62 _weak(g1h, pss, /* process_only_dirty_klasses */ false) {}
63
64 OopClosure* weak_oops() { return &_weak._oops; }
65 OopClosure* strong_oops() { return &_strong._oops; }
66
67 CLDClosure* weak_clds() { return &_weak._clds; }
68 CLDClosure* strong_clds() { return &_strong._clds; }
69
70 CodeBlobClosure* strong_codeblobs() { return &_strong._codeblobs; }
71 CodeBlobClosure* weak_codeblobs() { return &_weak._codeblobs; }
72 };
73
74 G1EvacuationRootClosures* G1EvacuationRootClosures::create_root_closures(G1ParScanThreadState* pss, G1CollectedHeap* g1h) {
75 G1EvacuationRootClosures* res = NULL;
76 if (g1h->collector_state()->in_concurrent_start_gc()) {
77 if (ClassUnloadingWithConcurrentMark) {
78 res = new G1ConcurrentStartMarkClosures<G1MarkPromotedFromRoot>(g1h, pss);
79 } else {
80 res = new G1ConcurrentStartMarkClosures<G1MarkFromRoot>(g1h, pss);
81 }
82 } else {
83 res = new G1EvacuationClosures(g1h, pss, g1h->collector_state()->in_young_only_phase());
84 }
85 return res;
86 }
|