97
98 static inline bool discard_entry(const void* entry, G1CollectedHeap* g1h) {
99 return !requires_marking(entry, g1h) || g1h->is_marked(cast_to_oop(entry));
100 }
101
102 // Workaround for not yet having std::bind.
103 class G1SATBMarkQueueFilterFn {
104 G1CollectedHeap* _g1h;
105
106 public:
107 G1SATBMarkQueueFilterFn() : _g1h(G1CollectedHeap::heap()) {}
108
109 // Return true if entry should be filtered out (removed), false if
110 // it should be retained.
111 bool operator()(const void* entry) const {
112 return discard_entry(entry, _g1h);
113 }
114 };
115
116 void G1SATBMarkQueueSet::filter(SATBMarkQueue& queue) {
117 G1CollectedHeap* g1h = G1CollectedHeap::heap();
118 if (g1h->collector_state()->is_in_marking()) {
119 apply_filter(G1SATBMarkQueueFilterFn(), queue);
120 } else {
121 // is_in_marking() covers both the concurrent marking and the Remark pause. Outside
122 // of that, there can be no entry that requires SATB marking.
123 queue.set_empty();
124 }
125 }
|
97
98 static inline bool discard_entry(const void* entry, G1CollectedHeap* g1h) {
99 return !requires_marking(entry, g1h) || g1h->is_marked(cast_to_oop(entry));
100 }
101
102 // Workaround for not yet having std::bind.
103 class G1SATBMarkQueueFilterFn {
104 G1CollectedHeap* _g1h;
105
106 public:
107 G1SATBMarkQueueFilterFn() : _g1h(G1CollectedHeap::heap()) {}
108
109 // Return true if entry should be filtered out (removed), false if
110 // it should be retained.
111 bool operator()(const void* entry) const {
112 return discard_entry(entry, _g1h);
113 }
114 };
115
116 void G1SATBMarkQueueSet::filter(SATBMarkQueue& queue) {
117 apply_filter(G1SATBMarkQueueFilterFn(), queue);
118 }
|