index

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

Print this page
rev 8024 : imported patch event1
* * *
imported patch event2

@@ -24,10 +24,11 @@
 
 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
 
 #include "gc_interface/collectedHeap.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "memory/heapInspection.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/synchronizer.hpp"
 #include "runtime/vm_operations.hpp"

@@ -162,14 +163,19 @@
 
 class VM_CollectForAllocation : public VM_GC_Operation {
  protected:
   size_t    _word_size; // Size of object to be allocated (in number of words)
   HeapWord* _result;    // Allocation result (NULL if allocation failed)
+  uint                       _gc_attempt; // Collection attempt for this allocation.
+  GCId                       _gcid;       // Predicted GCId for this operation.
 
  public:
-  VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause)
-    : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) {}
+  VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause, uint gc_attempt);
+
+  // The epilogue is run by the requesting thread after and if the collection happened.
+  // It is extended here to trace collections performed due to failed allocations.
+  void doit_epilogue();
 
   HeapWord* result() const {
     return _result;
   }
 };

@@ -178,12 +184,13 @@
  private:
   bool        _tlab;                       // alloc is of a tlab.
  public:
   VM_GenCollectForAllocation(size_t word_size,
                              bool tlab,
-                             uint gc_count_before)
-    : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
+                             uint gc_count_before,
+                             uint gc_attempt)
+    : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure, gc_attempt),
       _tlab(tlab) {
     assert(word_size != 0, "An allocation should always be requested with this operation.");
   }
   ~VM_GenCollectForAllocation()  {}
   virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }

@@ -211,21 +218,22 @@
  private:
   MetaWord*                _result;
   size_t                   _size;     // size of object to be allocated
   Metaspace::MetadataType  _mdtype;
   ClassLoaderData*         _loader_data;
+  uint                     _gc_attempt;  // Collection attempt for this allocation.
+  GCId                     _gcid;        // Predicted GCId for this operation.
  public:
   VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
                                   size_t size, Metaspace::MetadataType mdtype,
                                   uint gc_count_before,
                                   uint full_gc_count_before,
-                                  GCCause::Cause gc_cause)
-    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
-      _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
-  }
+                                  GCCause::Cause gc_cause,
+                                  uint gc_attempt);
   virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
   virtual void doit();
+  void doit_epilogue();
   MetaWord* result() const       { return _result; }
 
   bool initiate_concurrent_GC();
 };
 
index