src/share/vm/gc_implementation/parNew/parOopClosures.hpp

changeset 435
a61af66fc99e
child 548
ba764ed4b6f2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/parNew/parOopClosures.hpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,136 @@
     1.4 +/*
     1.5 + * Copyright (c) 2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +// Closures for ParNewGeneration
    1.29 +
    1.30 +class ParScanThreadState;
    1.31 +class ParNewGeneration;
    1.32 +template<class E> class GenericTaskQueueSet;
    1.33 +typedef GenericTaskQueueSet<oop> ObjToScanQueueSet;
    1.34 +class ParallelTaskTerminator;
    1.35 +
    1.36 +class ParScanClosure: public OopsInGenClosure {
    1.37 +protected:
    1.38 +  ParScanThreadState* _par_scan_state;
    1.39 +  ParNewGeneration* _g;
    1.40 +  HeapWord* _boundary;
    1.41 +  void do_oop_work(oop* p,
    1.42 +                          bool gc_barrier,
    1.43 +                          bool root_scan);
    1.44 +
    1.45 +  void par_do_barrier(oop* p);
    1.46 +
    1.47 +public:
    1.48 +  ParScanClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state);
    1.49 +};
    1.50 +
    1.51 +class ParScanWithBarrierClosure: public ParScanClosure {
    1.52 +public:
    1.53 +  void do_oop(oop* p)    { do_oop_work(p, true, false); }
    1.54 +  void do_oop_nv(oop* p) { do_oop_work(p, true, false); }
    1.55 +  ParScanWithBarrierClosure(ParNewGeneration* g,
    1.56 +                            ParScanThreadState* par_scan_state) :
    1.57 +    ParScanClosure(g, par_scan_state) {}
    1.58 +};
    1.59 +
    1.60 +class ParScanWithoutBarrierClosure: public ParScanClosure {
    1.61 +public:
    1.62 +  ParScanWithoutBarrierClosure(ParNewGeneration* g,
    1.63 +                               ParScanThreadState* par_scan_state) :
    1.64 +    ParScanClosure(g, par_scan_state) {}
    1.65 +  void do_oop(oop* p)    { do_oop_work(p, false, false); }
    1.66 +  void do_oop_nv(oop* p) { do_oop_work(p, false, false); }
    1.67 +};
    1.68 +
    1.69 +class ParRootScanWithBarrierTwoGensClosure: public ParScanClosure {
    1.70 +public:
    1.71 +  ParRootScanWithBarrierTwoGensClosure(ParNewGeneration* g,
    1.72 +                                       ParScanThreadState* par_scan_state) :
    1.73 +    ParScanClosure(g, par_scan_state) {}
    1.74 +  void do_oop(oop* p) { do_oop_work(p, true, true); }
    1.75 +};
    1.76 +
    1.77 +class ParRootScanWithoutBarrierClosure: public ParScanClosure {
    1.78 +public:
    1.79 +  ParRootScanWithoutBarrierClosure(ParNewGeneration* g,
    1.80 +                                   ParScanThreadState* par_scan_state) :
    1.81 +    ParScanClosure(g, par_scan_state) {}
    1.82 +  void do_oop(oop* p) { do_oop_work(p, false, true); }
    1.83 +};
    1.84 +
    1.85 +class ParScanWeakRefClosure: public ScanWeakRefClosure {
    1.86 +protected:
    1.87 +  ParScanThreadState* _par_scan_state;
    1.88 +public:
    1.89 +  ParScanWeakRefClosure(ParNewGeneration* g,
    1.90 +                        ParScanThreadState* par_scan_state);
    1.91 +  void do_oop(oop* p);
    1.92 +  void do_oop_nv(oop* p);
    1.93 +};
    1.94 +
    1.95 +class ParEvacuateFollowersClosure: public VoidClosure {
    1.96 +  ParScanThreadState* _par_scan_state;
    1.97 +  ParScanThreadState* par_scan_state() { return _par_scan_state; }
    1.98 +
    1.99 +  // We want to preserve the specific types here (rather than "OopClosure")
   1.100 +  // for later de-virtualization of do_oop calls.
   1.101 +  ParScanWithoutBarrierClosure* _to_space_closure;
   1.102 +  ParScanWithoutBarrierClosure* to_space_closure() {
   1.103 +    return _to_space_closure;
   1.104 +  }
   1.105 +  ParRootScanWithoutBarrierClosure* _to_space_root_closure;
   1.106 +  ParRootScanWithoutBarrierClosure* to_space_root_closure() {
   1.107 +    return _to_space_root_closure;
   1.108 +  }
   1.109 +
   1.110 +  ParScanWithBarrierClosure* _old_gen_closure;
   1.111 +  ParScanWithBarrierClosure* old_gen_closure () {
   1.112 +    return _old_gen_closure;
   1.113 +  }
   1.114 +  ParRootScanWithBarrierTwoGensClosure* _old_gen_root_closure;
   1.115 +  ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure () {
   1.116 +    return _old_gen_root_closure;
   1.117 +  }
   1.118 +
   1.119 +  ParNewGeneration* _par_gen;
   1.120 +  ParNewGeneration* par_gen() { return _par_gen; }
   1.121 +
   1.122 +  ObjToScanQueueSet*  _task_queues;
   1.123 +  ObjToScanQueueSet*  task_queues() { return _task_queues; }
   1.124 +
   1.125 +  ParallelTaskTerminator* _terminator;
   1.126 +  ParallelTaskTerminator* terminator() { return _terminator; }
   1.127 +
   1.128 +public:
   1.129 +  ParEvacuateFollowersClosure(
   1.130 +    ParScanThreadState* par_scan_state_,
   1.131 +    ParScanWithoutBarrierClosure* to_space_closure_,
   1.132 +    ParScanWithBarrierClosure* old_gen_closure_,
   1.133 +    ParRootScanWithoutBarrierClosure* to_space_root_closure_,
   1.134 +    ParNewGeneration* par_gen_,
   1.135 +    ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure_,
   1.136 +    ObjToScanQueueSet* task_queues_,
   1.137 +    ParallelTaskTerminator* terminator_);
   1.138 +  void do_void();
   1.139 +};

mercurial