1 /*
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 *
174 };
175
176 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
177 G1CollectedHeap* _g1h;
178 ConcurrentMark* _cm;
179 uint _worker_id;
180 HeapRegionClaimer* _hrclaimer;
181
182 DirtyCardQueue _dcq;
183 UpdateRSetDeferred _update_rset_cl;
184
185 public:
186 RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
187 uint worker_id,
188 HeapRegionClaimer* hrclaimer) :
189 _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
190 _worker_id(worker_id), _cm(_g1h->concurrent_mark()), _hrclaimer(hrclaimer) {
191 }
192
193 bool doHeapRegion(HeapRegion *hr) {
194 bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause();
195 bool during_conc_mark = _g1h->mark_in_progress();
196
197 assert(!hr->is_humongous(), "sanity");
198 assert(hr->in_collection_set(), "bad CS");
199
200 if (_hrclaimer->claim_region(hr->hrm_index())) {
201 if (hr->evacuation_failed()) {
202 RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
203 during_initial_mark,
204 during_conc_mark,
205 _worker_id);
206
207 hr->note_self_forwarding_removal_start(during_initial_mark,
208 during_conc_mark);
209 _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
210
211 // In the common case (i.e. when there is no evacuation
212 // failure) we make sure that the following is done when
213 // the region is freed so that it is "ready-to-go" when it's
214 // re-allocated. However, when evacuation failure happens, a
|
1 /*
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 *
174 };
175
176 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
177 G1CollectedHeap* _g1h;
178 ConcurrentMark* _cm;
179 uint _worker_id;
180 HeapRegionClaimer* _hrclaimer;
181
182 DirtyCardQueue _dcq;
183 UpdateRSetDeferred _update_rset_cl;
184
185 public:
186 RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
187 uint worker_id,
188 HeapRegionClaimer* hrclaimer) :
189 _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
190 _worker_id(worker_id), _cm(_g1h->concurrent_mark()), _hrclaimer(hrclaimer) {
191 }
192
193 bool doHeapRegion(HeapRegion *hr) {
194 bool during_initial_mark = _g1h->g1_policy()->collector_state()->during_initial_mark_pause();
195 bool during_conc_mark = _g1h->mark_in_progress();
196
197 assert(!hr->is_humongous(), "sanity");
198 assert(hr->in_collection_set(), "bad CS");
199
200 if (_hrclaimer->claim_region(hr->hrm_index())) {
201 if (hr->evacuation_failed()) {
202 RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
203 during_initial_mark,
204 during_conc_mark,
205 _worker_id);
206
207 hr->note_self_forwarding_removal_start(during_initial_mark,
208 during_conc_mark);
209 _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
210
211 // In the common case (i.e. when there is no evacuation
212 // failure) we make sure that the following is done when
213 // the region is freed so that it is "ready-to-go" when it's
214 // re-allocated. However, when evacuation failure happens, a
|