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 *
2685 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
2686 assert(_nextMarkBitMap->isMarked(addr), "invariant");
2687 assert( addr < _cm->finger(), "invariant");
2688 assert(addr >= _task->finger(), "invariant");
2689
2690 // We move that task's local finger along.
2691 _task->move_finger_to(addr);
2692
2693 _task->scan_object(oop(addr));
2694 // we only partially drain the local queue and global stack
2695 _task->drain_local_queue(true);
2696 _task->drain_global_stack(true);
2697
2698 // if the has_aborted flag has been raised, we need to bail out of
2699 // the iteration
2700 return !_task->has_aborted();
2701 }
2702 };
2703
2704 static ReferenceProcessor* get_cm_oop_closure_ref_processor(G1CollectedHeap* g1h) {
2705 ReferenceProcessor* result = NULL;
2706 if (G1UseConcMarkReferenceProcessing) {
2707 result = g1h->ref_processor_cm();
2708 assert(result != NULL, "should not be NULL");
2709 }
2710 return result;
2711 }
2712
2713 G1CMOopClosure::G1CMOopClosure(G1CollectedHeap* g1h,
2714 G1ConcurrentMark* cm,
2715 G1CMTask* task)
2716 : MetadataAwareOopClosure(get_cm_oop_closure_ref_processor(g1h)),
2717 _g1h(g1h), _cm(cm), _task(task)
2718 { }
2719
2720 void G1CMTask::setup_for_region(HeapRegion* hr) {
2721 assert(hr != NULL,
2722 "claim_region() should have filtered out NULL regions");
2723 _curr_region = hr;
2724 _finger = hr->bottom();
2725 update_region_limit();
2726 }
2727
2728 void G1CMTask::update_region_limit() {
2729 HeapRegion* hr = _curr_region;
|
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 *
2685 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
2686 assert(_nextMarkBitMap->isMarked(addr), "invariant");
2687 assert( addr < _cm->finger(), "invariant");
2688 assert(addr >= _task->finger(), "invariant");
2689
2690 // We move that task's local finger along.
2691 _task->move_finger_to(addr);
2692
2693 _task->scan_object(oop(addr));
2694 // we only partially drain the local queue and global stack
2695 _task->drain_local_queue(true);
2696 _task->drain_global_stack(true);
2697
2698 // if the has_aborted flag has been raised, we need to bail out of
2699 // the iteration
2700 return !_task->has_aborted();
2701 }
2702 };
2703
2704 static ReferenceProcessor* get_cm_oop_closure_ref_processor(G1CollectedHeap* g1h) {
2705 ReferenceProcessor* result = g1h->ref_processor_cm();
2706 assert(result != NULL, "CM reference processor should not be NULL");
2707 return result;
2708 }
2709
2710 G1CMOopClosure::G1CMOopClosure(G1CollectedHeap* g1h,
2711 G1ConcurrentMark* cm,
2712 G1CMTask* task)
2713 : MetadataAwareOopClosure(get_cm_oop_closure_ref_processor(g1h)),
2714 _g1h(g1h), _cm(cm), _task(task)
2715 { }
2716
2717 void G1CMTask::setup_for_region(HeapRegion* hr) {
2718 assert(hr != NULL,
2719 "claim_region() should have filtered out NULL regions");
2720 _curr_region = hr;
2721 _finger = hr->bottom();
2722 update_region_limit();
2723 }
2724
2725 void G1CMTask::update_region_limit() {
2726 HeapRegion* hr = _curr_region;
|