< prev index next >

src/share/vm/gc/shared/vmGCOperations.hpp

Print this page




  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 #ifndef SHARE_VM_GC_SHARED_VMGCOPERATIONS_HPP
  26 #define SHARE_VM_GC_SHARED_VMGCOPERATIONS_HPP
  27 
  28 #include "gc/shared/collectedHeap.hpp"
  29 #include "gc/shared/genCollectedHeap.hpp"
  30 #include "gc/shared/referencePendingListLocker.hpp"
  31 #include "memory/heapInspection.hpp"
  32 #include "prims/jvmtiExport.hpp"
  33 #include "runtime/handles.hpp"
  34 #include "runtime/jniHandles.hpp"
  35 #include "runtime/synchronizer.hpp"
  36 #include "runtime/vm_operations.hpp"
  37 
  38 // The following class hierarchy represents
  39 // a set of operations (VM_Operation) related to GC.
  40 //
  41 //  VM_Operation
  42 //      VM_GC_Operation
  43 //          VM_GC_HeapInspection
  44 //          VM_GenCollectFull
  45 //          VM_GenCollectFullConcurrent
  46 //          VM_ParallelGCSystemGC
  47 //          VM_CollectForAllocation
  48 //              VM_GenCollectForAllocation
  49 //              VM_ParallelGCFailedAllocation
  50 //  VM_GC_Operation


  53 //
  54 //  VM_GC_HeapInspection
  55 //   - prints class histogram on SIGBREAK if PrintClassHistogram
  56 //     is specified; and also the attach "inspectheap" operation
  57 //
  58 //  VM_CollectForAllocation
  59 //  VM_GenCollectForAllocation
  60 //  VM_ParallelGCFailedAllocation
  61 //   - this operation is invoked when allocation is failed;
  62 //     operation performs garbage collection and tries to
  63 //     allocate afterwards;
  64 //
  65 //  VM_GenCollectFull
  66 //  VM_GenCollectFullConcurrent
  67 //  VM_ParallelGCSystemGC
  68 //   - these operations preform full collection of heaps of
  69 //     different kind
  70 //
  71 
  72 class VM_GC_Operation: public VM_Operation {
  73  private:
  74   ReferencePendingListLocker _pending_list_locker;
  75 
  76  protected:
  77   uint           _gc_count_before;         // gc count before acquiring PLL
  78   uint           _full_gc_count_before;    // full gc count before acquiring PLL
  79   bool           _full;                    // whether a "full" collection
  80   bool           _prologue_succeeded;      // whether doit_prologue succeeded
  81   GCCause::Cause _gc_cause;                // the putative cause for this gc op
  82   bool           _gc_locked;               // will be set if gc was locked
  83 
  84   virtual bool skip_operation() const;
  85 
  86   // java.lang.ref.Reference support
  87   void acquire_pending_list_lock();
  88   void release_and_notify_pending_list_lock();
  89 
  90  public:
  91   VM_GC_Operation(uint gc_count_before,
  92                   GCCause::Cause _cause,
  93                   uint full_gc_count_before = 0,
  94                   bool full = false) {
  95     _full = full;
  96     _prologue_succeeded = false;
  97     _gc_count_before    = gc_count_before;
  98 
  99     // A subclass constructor will likely overwrite the following
 100     _gc_cause           = _cause;
 101 
 102     _gc_locked = false;
 103 
 104     _full_gc_count_before = full_gc_count_before;
 105     // In ParallelScavengeHeap::mem_allocate() collections can be
 106     // executed within a loop and _all_soft_refs_clear can be set
 107     // true after they have been cleared by a collection and another
 108     // collection started so that _all_soft_refs_clear can be true




  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 #ifndef SHARE_VM_GC_SHARED_VMGCOPERATIONS_HPP
  26 #define SHARE_VM_GC_SHARED_VMGCOPERATIONS_HPP
  27 
  28 #include "gc/shared/collectedHeap.hpp"
  29 #include "gc/shared/genCollectedHeap.hpp"

  30 #include "memory/heapInspection.hpp"
  31 #include "prims/jvmtiExport.hpp"
  32 #include "runtime/handles.hpp"
  33 #include "runtime/jniHandles.hpp"
  34 #include "runtime/synchronizer.hpp"
  35 #include "runtime/vm_operations.hpp"
  36 
  37 // The following class hierarchy represents
  38 // a set of operations (VM_Operation) related to GC.
  39 //
  40 //  VM_Operation
  41 //      VM_GC_Operation
  42 //          VM_GC_HeapInspection
  43 //          VM_GenCollectFull
  44 //          VM_GenCollectFullConcurrent
  45 //          VM_ParallelGCSystemGC
  46 //          VM_CollectForAllocation
  47 //              VM_GenCollectForAllocation
  48 //              VM_ParallelGCFailedAllocation
  49 //  VM_GC_Operation


  52 //
  53 //  VM_GC_HeapInspection
  54 //   - prints class histogram on SIGBREAK if PrintClassHistogram
  55 //     is specified; and also the attach "inspectheap" operation
  56 //
  57 //  VM_CollectForAllocation
  58 //  VM_GenCollectForAllocation
  59 //  VM_ParallelGCFailedAllocation
  60 //   - this operation is invoked when allocation is failed;
  61 //     operation performs garbage collection and tries to
  62 //     allocate afterwards;
  63 //
  64 //  VM_GenCollectFull
  65 //  VM_GenCollectFullConcurrent
  66 //  VM_ParallelGCSystemGC
  67 //   - these operations preform full collection of heaps of
  68 //     different kind
  69 //
  70 
  71 class VM_GC_Operation: public VM_Operation {



  72  protected:
  73   uint           _gc_count_before;         // gc count before acquiring PLL
  74   uint           _full_gc_count_before;    // full gc count before acquiring PLL
  75   bool           _full;                    // whether a "full" collection
  76   bool           _prologue_succeeded;      // whether doit_prologue succeeded
  77   GCCause::Cause _gc_cause;                // the putative cause for this gc op
  78   bool           _gc_locked;               // will be set if gc was locked
  79 
  80   virtual bool skip_operation() const;




  81 
  82  public:
  83   VM_GC_Operation(uint gc_count_before,
  84                   GCCause::Cause _cause,
  85                   uint full_gc_count_before = 0,
  86                   bool full = false) {
  87     _full = full;
  88     _prologue_succeeded = false;
  89     _gc_count_before    = gc_count_before;
  90 
  91     // A subclass constructor will likely overwrite the following
  92     _gc_cause           = _cause;
  93 
  94     _gc_locked = false;
  95 
  96     _full_gc_count_before = full_gc_count_before;
  97     // In ParallelScavengeHeap::mem_allocate() collections can be
  98     // executed within a loop and _all_soft_refs_clear can be set
  99     // true after they have been cleared by a collection and another
 100     // collection started so that _all_soft_refs_clear can be true


< prev index next >