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

Tue, 19 May 2009 04:05:31 -0700

author
apetrusenko
date
Tue, 19 May 2009 04:05:31 -0700
changeset 1231
29e7d79232b9
parent 777
37f87013dfd8
child 1280
df6caf649ff7
permissions
-rw-r--r--

6819065: G1: eliminate high serial card table clearing time
Reviewed-by: iveresov, tonyp

     1 /*
     2  * Copyright 2001-2007 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 /*
    26  * This really ought to be an inline function, but apparently the C++
    27  * compiler sometimes sees fit to ignore inline declarations.  Sigh.
    28  */
    30 // This must a ifdef'ed because the counting it controls is in a
    31 // perf-critical inner loop.
    32 #define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0
    34 inline void FilterIntoCSClosure::do_oop_nv(oop* p) {
    35   oop obj = *p;
    36   if (obj != NULL && _g1->obj_in_cs(obj)) {
    37     _oc->do_oop(p);
    38 #if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT
    39     _dcto_cl->incr_count();
    40 #endif
    41   }
    42 }
    44 inline void FilterIntoCSClosure::do_oop(oop* p)
    45 {
    46   do_oop_nv(p);
    47 }
    49 #define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0
    51 inline void FilterOutOfRegionClosure::do_oop_nv(oop* p) {
    52   oop obj = *p;
    53   HeapWord* obj_hw = (HeapWord*)obj;
    54   if (obj_hw != NULL && (obj_hw < _r_bottom || obj_hw >= _r_end)) {
    55     _oc->do_oop(p);
    56 #if FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT
    57     _out_of_region++;
    58 #endif
    59   }
    60 }
    62 inline void FilterOutOfRegionClosure::do_oop(oop* p)
    63 {
    64   do_oop_nv(p);
    65 }
    67 inline void FilterInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) {
    68   oop obj = *p;
    69   if (obj != NULL && _g1->obj_in_cs(obj))
    70     _oc->do_oop(p);
    71 }
    73 inline void FilterInHeapRegionAndIntoCSClosure::do_oop(oop* p)
    74 {
    75   do_oop_nv(p);
    76 }
    79 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) {
    80   oop obj = *p;
    81   if (obj != NULL) {
    82     HeapRegion* hr = _g1->heap_region_containing((HeapWord*) obj);
    83     if (hr != NULL) {
    84       if (hr->in_collection_set())
    85         _oc->do_oop(p);
    86       else if (!hr->is_young())
    87         _cm->grayRoot(obj);
    88     }
    89   }
    90 }
    92 inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop(oop* p)
    93 {
    94   do_oop_nv(p);
    95 }
    97 inline void G1ScanAndBalanceClosure::do_oop_nv(oop* p) {
    98   RefToScanQueue* q;
    99   if (ParallelGCThreads > 0) {
   100     // Deal the work out equally.
   101     _nq = (_nq + 1) % ParallelGCThreads;
   102     q = _g1->task_queue(_nq);
   103   } else {
   104     q = _g1->task_queue(0);
   105   }
   106   bool nooverflow = q->push(p);
   107   guarantee(nooverflow, "Overflow during poplularity region processing");
   108 }
   110 inline void G1ScanAndBalanceClosure::do_oop(oop* p) {
   111   do_oop_nv(p);
   112 }

mercurial