hotspot/src/share/vm/gc/g1/g1RootClosures.inline.hpp
changeset 34763 138d9e3f9da7
parent 34762 d68b7daca533
parent 34748 3b2cde99bd99
child 34764 f9bcdce2df26
equal deleted inserted replaced
34762:d68b7daca533 34763:138d9e3f9da7
     1 /*
       
     2  * Copyright (c) 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  *
       
    23  */
       
    24 
       
    25 #include "gc/g1/bufferingOopClosure.hpp"
       
    26 #include "gc/g1/g1CodeBlobClosure.hpp"
       
    27 #include "gc/g1/g1CollectedHeap.hpp"
       
    28 #include "gc/g1/g1OopClosures.inline.hpp"
       
    29 #include "gc/g1/g1RootClosures.hpp"
       
    30 
       
    31 // Simple holder object for a complete set of closures used by the G1 evacuation code.
       
    32 template <G1Mark Mark>
       
    33 class G1SharedClosures VALUE_OBJ_CLASS_SPEC {
       
    34 public:
       
    35   G1ParCopyClosure<G1BarrierNone,  Mark> _oops;
       
    36   G1ParCopyClosure<G1BarrierKlass, Mark> _oop_in_klass;
       
    37   G1KlassScanClosure                     _klass_in_cld_closure;
       
    38   CLDToKlassAndOopClosure                _clds;
       
    39   G1CodeBlobClosure                      _codeblobs;
       
    40   BufferingOopClosure                    _buffered_oops;
       
    41 
       
    42   G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty_klasses, bool must_claim_cld) :
       
    43     _oops(g1h, pss),
       
    44     _oop_in_klass(g1h, pss),
       
    45     _klass_in_cld_closure(&_oop_in_klass, process_only_dirty_klasses),
       
    46     _clds(&_klass_in_cld_closure, &_oops, must_claim_cld),
       
    47     _codeblobs(&_oops),
       
    48     _buffered_oops(&_oops) {}
       
    49 };
       
    50 
       
    51 class G1EvacuationClosures : public G1EvacuationRootClosures {
       
    52   G1SharedClosures<G1MarkNone> _closures;
       
    53 
       
    54 public:
       
    55   G1EvacuationClosures(G1CollectedHeap* g1h,
       
    56                        G1ParScanThreadState* pss,
       
    57                        bool gcs_are_young) :
       
    58       _closures(g1h, pss, gcs_are_young, /* must_claim_cld */ false) {}
       
    59 
       
    60   OopClosure* weak_oops()   { return &_closures._buffered_oops; }
       
    61   OopClosure* strong_oops() { return &_closures._buffered_oops; }
       
    62 
       
    63   CLDClosure* weak_clds()             { return &_closures._clds; }
       
    64   CLDClosure* strong_clds()           { return &_closures._clds; }
       
    65   CLDClosure* thread_root_clds()      { return NULL; }
       
    66   CLDClosure* second_pass_weak_clds() { return NULL; }
       
    67 
       
    68   CodeBlobClosure* strong_codeblobs()      { return &_closures._codeblobs; }
       
    69   CodeBlobClosure* weak_codeblobs()        { return &_closures._codeblobs; }
       
    70 
       
    71   void flush()                 { _closures._buffered_oops.done(); }
       
    72   double closure_app_seconds() { return _closures._buffered_oops.closure_app_seconds(); }
       
    73 
       
    74   OopClosure* raw_strong_oops() { return &_closures._oops; }
       
    75 
       
    76   bool trace_metadata()         { return false; }
       
    77 };