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

Mon, 26 Jan 2009 12:47:21 -0800

author
ysr
date
Mon, 26 Jan 2009 12:47:21 -0800
changeset 969
5cfd8d19e546
parent 548
ba764ed4b6f2
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6786503: Overflow list performance can be improved
Summary: Avoid overflow list walk in CMS & ParNew when it is unnecessary. Fix a couple of correctness issues, including a C-heap leak, in ParNew at the intersection of promotion failure, work queue overflow and object array chunking. Add stress testing option and related assertion checking.
Reviewed-by: jmasa

     1 /*
     2  * Copyright (c) 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 // Closures for ParNewGeneration
    27 class ParScanThreadState;
    28 class ParNewGeneration;
    29 typedef OopTaskQueueSet ObjToScanQueueSet;
    30 class ParallelTaskTerminator;
    32 class ParScanClosure: public OopsInGenClosure {
    33  protected:
    34   ParScanThreadState* _par_scan_state;
    35   ParNewGeneration*   _g;
    36   HeapWord*           _boundary;
    37   template <class T> void inline par_do_barrier(T* p);
    38   template <class T> void inline do_oop_work(T* p,
    39                                              bool gc_barrier,
    40                                              bool root_scan);
    41  public:
    42   ParScanClosure(ParNewGeneration* g, ParScanThreadState* par_scan_state);
    43 };
    45 class ParScanWithBarrierClosure: public ParScanClosure {
    46  public:
    47   ParScanWithBarrierClosure(ParNewGeneration* g,
    48                             ParScanThreadState* par_scan_state) :
    49     ParScanClosure(g, par_scan_state) {}
    50   virtual void do_oop(oop* p);
    51   virtual void do_oop(narrowOop* p);
    52   inline void do_oop_nv(oop* p);
    53   inline void do_oop_nv(narrowOop* p);
    54 };
    56 class ParScanWithoutBarrierClosure: public ParScanClosure {
    57  public:
    58   ParScanWithoutBarrierClosure(ParNewGeneration* g,
    59                                ParScanThreadState* par_scan_state) :
    60     ParScanClosure(g, par_scan_state) {}
    61   virtual void do_oop(oop* p);
    62   virtual void do_oop(narrowOop* p);
    63   inline void do_oop_nv(oop* p);
    64   inline void do_oop_nv(narrowOop* p);
    65 };
    67 class ParRootScanWithBarrierTwoGensClosure: public ParScanClosure {
    68  public:
    69   ParRootScanWithBarrierTwoGensClosure(ParNewGeneration* g,
    70                                        ParScanThreadState* par_scan_state) :
    71     ParScanClosure(g, par_scan_state) {}
    72   virtual void do_oop(oop* p);
    73   virtual void do_oop(narrowOop* p);
    74 };
    76 class ParRootScanWithoutBarrierClosure: public ParScanClosure {
    77  public:
    78   ParRootScanWithoutBarrierClosure(ParNewGeneration* g,
    79                                    ParScanThreadState* par_scan_state) :
    80     ParScanClosure(g, par_scan_state) {}
    81   virtual void do_oop(oop* p);
    82   virtual void do_oop(narrowOop* p);
    83 };
    85 class ParScanWeakRefClosure: public ScanWeakRefClosure {
    86  protected:
    87   ParScanThreadState* _par_scan_state;
    88   template <class T> inline void do_oop_work(T* p);
    89  public:
    90   ParScanWeakRefClosure(ParNewGeneration* g,
    91                         ParScanThreadState* par_scan_state);
    92   virtual void do_oop(oop* p);
    93   virtual void do_oop(narrowOop* p);
    94   inline void do_oop_nv(oop* p);
    95   inline void do_oop_nv(narrowOop* p);
    96 };
    98 class ParEvacuateFollowersClosure: public VoidClosure {
    99  private:
   100   ParScanThreadState* _par_scan_state;
   101   ParScanThreadState* par_scan_state() { return _par_scan_state; }
   103   // We want to preserve the specific types here (rather than "OopClosure")
   104   // for later de-virtualization of do_oop calls.
   105   ParScanWithoutBarrierClosure* _to_space_closure;
   106   ParScanWithoutBarrierClosure* to_space_closure() {
   107     return _to_space_closure;
   108   }
   109   ParRootScanWithoutBarrierClosure* _to_space_root_closure;
   110   ParRootScanWithoutBarrierClosure* to_space_root_closure() {
   111     return _to_space_root_closure;
   112   }
   114   ParScanWithBarrierClosure* _old_gen_closure;
   115   ParScanWithBarrierClosure* old_gen_closure () {
   116     return _old_gen_closure;
   117   }
   118   ParRootScanWithBarrierTwoGensClosure* _old_gen_root_closure;
   119   ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure () {
   120     return _old_gen_root_closure;
   121   }
   123   ParNewGeneration* _par_gen;
   124   ParNewGeneration* par_gen() { return _par_gen; }
   126   ObjToScanQueueSet*  _task_queues;
   127   ObjToScanQueueSet*  task_queues() { return _task_queues; }
   129   ParallelTaskTerminator* _terminator;
   130   ParallelTaskTerminator* terminator() { return _terminator; }
   131  public:
   132   ParEvacuateFollowersClosure(
   133     ParScanThreadState* par_scan_state_,
   134     ParScanWithoutBarrierClosure* to_space_closure_,
   135     ParScanWithBarrierClosure* old_gen_closure_,
   136     ParRootScanWithoutBarrierClosure* to_space_root_closure_,
   137     ParNewGeneration* par_gen_,
   138     ParRootScanWithBarrierTwoGensClosure* old_gen_root_closure_,
   139     ObjToScanQueueSet* task_queues_,
   140     ParallelTaskTerminator* terminator_);
   141   virtual void do_void();
   142 };

mercurial