1 /*
2 * Copyright (c) 2001, 2014, 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 *
204 check_mark(addr);
205 _bm.set_bit(heapWordToOffset(addr));
206 }
207
208 inline void CMBitMap::clear(HeapWord* addr) {
209 check_mark(addr);
210 _bm.clear_bit(heapWordToOffset(addr));
211 }
212
213 inline bool CMBitMap::parMark(HeapWord* addr) {
214 check_mark(addr);
215 return _bm.par_set_bit(heapWordToOffset(addr));
216 }
217
218 inline bool CMBitMap::parClear(HeapWord* addr) {
219 check_mark(addr);
220 return _bm.par_clear_bit(heapWordToOffset(addr));
221 }
222
223 #undef check_mark
224
225 inline void CMTask::push(oop obj) {
226 HeapWord* objAddr = (HeapWord*) obj;
227 assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
228 assert(!_g1h->is_on_master_free_list(
229 _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
230 assert(!_g1h->is_obj_ill(obj), "invariant");
231 assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
232
233 if (_cm->verbose_high()) {
234 gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
235 }
236
237 if (!_task_queue->push(obj)) {
238 // The local task queue looks full. We need to push some entries
239 // to the global stack.
240
241 if (_cm->verbose_medium()) {
242 gclog_or_tty->print_cr("[%u] task queue overflow, "
243 "moving entries to the global stack",
|
1 /*
2 * Copyright (c) 2001, 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 *
204 check_mark(addr);
205 _bm.set_bit(heapWordToOffset(addr));
206 }
207
208 inline void CMBitMap::clear(HeapWord* addr) {
209 check_mark(addr);
210 _bm.clear_bit(heapWordToOffset(addr));
211 }
212
213 inline bool CMBitMap::parMark(HeapWord* addr) {
214 check_mark(addr);
215 return _bm.par_set_bit(heapWordToOffset(addr));
216 }
217
218 inline bool CMBitMap::parClear(HeapWord* addr) {
219 check_mark(addr);
220 return _bm.par_clear_bit(heapWordToOffset(addr));
221 }
222
223 #undef check_mark
224
225 inline bool CMTask::is_stale_humongous_queue_entry(oop obj) const {
226 // When a humongous object is eagerly reclaimed, we don't remove
227 // entries for it from queues. Instead, we filter out such entries
228 // on the processing side.
229 //
230 // Recently allocated objects are filtered out when queuing, to
231 // minimize queue size and processing time. Therefore, if we find
232 // what appears to be a recently allocated object in the queue, it
233 // must be for a reclaimed humongous object.
234 HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
235 bool result = hr->obj_allocated_since_next_marking(obj);
236 #ifdef ASSERT
237 if (result) {
238 HeapWord* hp = (HeapWord*)obj;
239 assert(hp == hr->bottom(), "stale humongous should be at region bottom");
240 assert(!_nextMarkBitMap->isMarked(hp), "stale humongous should not be marked");
241 }
242 #endif
243 return result;
244 }
245
246 inline void CMTask::push(oop obj) {
247 HeapWord* objAddr = (HeapWord*) obj;
248 assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
249 assert(!_g1h->is_on_master_free_list(
250 _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
251 assert(!_g1h->is_obj_ill(obj), "invariant");
252 assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
253
254 if (_cm->verbose_high()) {
255 gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
256 }
257
258 if (!_task_queue->push(obj)) {
259 // The local task queue looks full. We need to push some entries
260 // to the global stack.
261
262 if (_cm->verbose_medium()) {
263 gclog_or_tty->print_cr("[%u] task queue overflow, "
264 "moving entries to the global stack",
|