src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp

Fri, 06 Feb 2009 01:38:50 +0300

author
apetrusenko
date
Fri, 06 Feb 2009 01:38:50 +0300
changeset 980
58054a18d735
parent 777
37f87013dfd8
child 1280
df6caf649ff7
permissions
-rw-r--r--

6484959: G1: introduce survivor spaces
6797754: G1: combined bugfix
Summary: Implemented a policy to control G1 survivor space parameters.
Reviewed-by: tonyp, iveresov

ysr@777 1 /*
ysr@777 2 * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved.
ysr@777 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@777 4 *
ysr@777 5 * This code is free software; you can redistribute it and/or modify it
ysr@777 6 * under the terms of the GNU General Public License version 2 only, as
ysr@777 7 * published by the Free Software Foundation.
ysr@777 8 *
ysr@777 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@777 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@777 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@777 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@777 13 * accompanied this code).
ysr@777 14 *
ysr@777 15 * You should have received a copy of the GNU General Public License version
ysr@777 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@777 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@777 18 *
ysr@777 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ysr@777 20 * CA 95054 USA or visit www.sun.com if you need additional information or
ysr@777 21 * have any questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
ysr@777 25 /*
ysr@777 26 * This really ought to be an inline function, but apparently the C++
ysr@777 27 * compiler sometimes sees fit to ignore inline declarations. Sigh.
ysr@777 28 */
ysr@777 29
ysr@777 30 // This must a ifdef'ed because the counting it controls is in a
ysr@777 31 // perf-critical inner loop.
ysr@777 32 #define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0
ysr@777 33
ysr@777 34 inline void FilterIntoCSClosure::do_oop_nv(oop* p) {
ysr@777 35 oop obj = *p;
ysr@777 36 if (obj != NULL && _g1->obj_in_cs(obj)) {
ysr@777 37 _oc->do_oop(p);
ysr@777 38 #if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT
ysr@777 39 _dcto_cl->incr_count();
ysr@777 40 #endif
ysr@777 41 }
ysr@777 42 }
ysr@777 43
ysr@777 44 inline void FilterIntoCSClosure::do_oop(oop* p)
ysr@777 45 {
ysr@777 46 do_oop_nv(p);
ysr@777 47 }
ysr@777 48
ysr@777 49 #define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0
ysr@777 50
ysr@777 51 inline void FilterOutOfRegionClosure::do_oop_nv(oop* p) {
ysr@777 52 oop obj = *p;
ysr@777 53 HeapWord* obj_hw = (HeapWord*)obj;
ysr@777 54 if (obj_hw != NULL && (obj_hw < _r_bottom || obj_hw >= _r_end)) {
ysr@777 55 _oc->do_oop(p);
ysr@777 56 #if FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT
ysr@777 57 _out_of_region++;
ysr@777 58 #endif
ysr@777 59 }
ysr@777 60 }
ysr@777 61
ysr@777 62 inline void FilterOutOfRegionClosure::do_oop(oop* p)
ysr@777 63 {
ysr@777 64 do_oop_nv(p);
ysr@777 65 }
ysr@777 66
ysr@777 67 inline void FilterInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) {
ysr@777 68 oop obj = *p;
ysr@777 69 if (obj != NULL && _g1->obj_in_cs(obj))
ysr@777 70 _oc->do_oop(p);
ysr@777 71 }
ysr@777 72
ysr@777 73 inline void FilterInHeapRegionAndIntoCSClosure::do_oop(oop* p)
ysr@777 74 {
ysr@777 75 do_oop_nv(p);
ysr@777 76 }
ysr@777 77
ysr@777 78
ysr@777 79 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) {
ysr@777 80 oop obj = *p;
ysr@777 81 if (obj != NULL) {
ysr@777 82 HeapRegion* hr = _g1->heap_region_containing((HeapWord*) obj);
ysr@777 83 if (hr != NULL) {
ysr@777 84 if (hr->in_collection_set())
ysr@777 85 _oc->do_oop(p);
ysr@777 86 else if (!hr->is_young())
ysr@777 87 _cm->grayRoot(obj);
ysr@777 88 }
ysr@777 89 }
ysr@777 90 }
ysr@777 91
ysr@777 92 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop(oop* p)
ysr@777 93 {
ysr@777 94 do_oop_nv(p);
ysr@777 95 }
ysr@777 96
ysr@777 97 inline void G1ScanAndBalanceClosure::do_oop_nv(oop* p) {
ysr@777 98 RefToScanQueue* q;
ysr@777 99 if (ParallelGCThreads > 0) {
ysr@777 100 // Deal the work out equally.
ysr@777 101 _nq = (_nq + 1) % ParallelGCThreads;
ysr@777 102 q = _g1->task_queue(_nq);
ysr@777 103 } else {
ysr@777 104 q = _g1->task_queue(0);
ysr@777 105 }
ysr@777 106 bool nooverflow = q->push(p);
ysr@777 107 guarantee(nooverflow, "Overflow during poplularity region processing");
ysr@777 108 }
ysr@777 109
ysr@777 110 inline void G1ScanAndBalanceClosure::do_oop(oop* p) {
ysr@777 111 do_oop_nv(p);
ysr@777 112 }

mercurial