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 *
3306 CMSBitMap* bit_map, CMSMarkStack* overflow_stack):
3307 MetadataAwareOopClosure(collector->ref_processor()),
3308 _collector(collector),
3309 _task(task),
3310 _span(collector->_span),
3311 _work_queue(work_queue),
3312 _bit_map(bit_map),
3313 _overflow_stack(overflow_stack)
3314 { }
3315 virtual void do_oop(oop* p);
3316 virtual void do_oop(narrowOop* p);
3317
3318 void trim_queue(size_t max);
3319 void handle_stack_overflow(HeapWord* lost);
3320 void do_yield_check() {
3321 if (_task->should_yield()) {
3322 _task->yield();
3323 }
3324 }
3325 };
3326
3327 // Grey object scanning during work stealing phase --
3328 // the salient assumption here is that any references
3329 // that are in these stolen objects being scanned must
3330 // already have been initialized (else they would not have
3331 // been published), so we do not need to check for
3332 // uninitialized objects before pushing here.
3333 void ParConcMarkingClosure::do_oop(oop obj) {
3334 assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
3335 HeapWord* addr = (HeapWord*)obj;
3336 // Check if oop points into the CMS generation
3337 // and is not marked
3338 if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
3339 // a white object ...
3340 // If we manage to "claim" the object, by being the
3341 // first thread to mark it, then we push it on our
3342 // marking stack
3343 if (_bit_map->par_mark(addr)) { // ... now grey
3344 // push on work queue (grey set)
3345 bool simulate_overflow = false;
|
1 /*
2 * Copyright (c) 2001, 2016, 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 *
3306 CMSBitMap* bit_map, CMSMarkStack* overflow_stack):
3307 MetadataAwareOopClosure(collector->ref_processor()),
3308 _collector(collector),
3309 _task(task),
3310 _span(collector->_span),
3311 _work_queue(work_queue),
3312 _bit_map(bit_map),
3313 _overflow_stack(overflow_stack)
3314 { }
3315 virtual void do_oop(oop* p);
3316 virtual void do_oop(narrowOop* p);
3317
3318 void trim_queue(size_t max);
3319 void handle_stack_overflow(HeapWord* lost);
3320 void do_yield_check() {
3321 if (_task->should_yield()) {
3322 _task->yield();
3323 }
3324 }
3325 };
3326
3327 DO_OOP_WORK_IMPL(ParConcMarkingClosure)
3328
3329 // Grey object scanning during work stealing phase --
3330 // the salient assumption here is that any references
3331 // that are in these stolen objects being scanned must
3332 // already have been initialized (else they would not have
3333 // been published), so we do not need to check for
3334 // uninitialized objects before pushing here.
3335 void ParConcMarkingClosure::do_oop(oop obj) {
3336 assert(obj->is_oop_or_null(true), "Expected an oop or NULL at " PTR_FORMAT, p2i(obj));
3337 HeapWord* addr = (HeapWord*)obj;
3338 // Check if oop points into the CMS generation
3339 // and is not marked
3340 if (_span.contains(addr) && !_bit_map->isMarked(addr)) {
3341 // a white object ...
3342 // If we manage to "claim" the object, by being the
3343 // first thread to mark it, then we push it on our
3344 // marking stack
3345 if (_bit_map->par_mark(addr)) { // ... now grey
3346 // push on work queue (grey set)
3347 bool simulate_overflow = false;
|