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

Tue, 10 May 2011 00:33:21 -0700

author
ysr
date
Tue, 10 May 2011 00:33:21 -0700
changeset 2889
fc2b798ab316
parent 2314
f95d63e2154a
child 3900
d2a62e0f25eb
permissions
-rw-r--r--

6883834: ParNew: assert(!_g->to()->is_in_reserved(obj),"Scanning field twice?") with LargeObjects tests
Summary: Fixed process_chunk_boundaries(), used for parallel card scanning when using ParNew/CMS, so as to prevent double-scanning, or worse, non-scanning of imprecisely marked objects exceeding parallel chunk size. Made some sizing parameters for parallel card scanning diagnostic, disabled ParallelGCRetainPLAB, and elaborated and clarified some comments.
Reviewed-by: stefank, johnc

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

mercurial