< prev index next >
src/share/vm/gc_implementation/shared/vmGCOperations.hpp
Print this page
rev 7780 : imported patch 8072621
rev 7781 : imported patch 8066771
rev 7782 : [mq]: review
@@ -36,23 +36,25 @@
// a set of operations (VM_Operation) related to GC.
//
// VM_Operation
// VM_GC_Operation
// VM_GC_HeapInspection
-// VM_GenCollectForAllocation
// VM_GenCollectFull
// VM_GenCollectFullConcurrent
-// VM_ParallelGCFailedAllocation
// VM_ParallelGCSystemGC
+// VM_CollectForAllocation
+// VM_GenCollectForAllocation
+// VM_ParallelGCFailedAllocation
// VM_GC_Operation
// - implements methods common to all classes in the hierarchy:
// prevents multiple gc requests and manages lock on heap;
//
// VM_GC_HeapInspection
// - prints class histogram on SIGBREAK if PrintClassHistogram
// is specified; and also the attach "inspectheap" operation
//
+// VM_CollectForAllocation
// VM_GenCollectForAllocation
// VM_ParallelGCFailedAllocation
// - this operation is invoked when allocation is failed;
// operation performs garbage collection and tries to
// allocate afterwards;
@@ -158,29 +160,38 @@
void set_columns(const char* value) {_columns = value;}
protected:
bool collect();
};
+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)
+
+ 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) {}
+
+ HeapWord* result() const {
+ return _result;
+ }
+};
-class VM_GenCollectForAllocation: public VM_GC_Operation {
+class VM_GenCollectForAllocation : public VM_CollectForAllocation {
private:
- HeapWord* _res;
- size_t _size; // size of object to be allocated.
bool _tlab; // alloc is of a tlab.
public:
- VM_GenCollectForAllocation(size_t size,
+ VM_GenCollectForAllocation(size_t word_size,
bool tlab,
uint gc_count_before)
- : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
- _size(size),
+ : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
_tlab(tlab) {
- _res = NULL;
+ assert(word_size != 0, "An allocation should always be requested with this operation.");
}
~VM_GenCollectForAllocation() {}
virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
virtual void doit();
- HeapWord* result() const { return _res; }
};
// VM operation to invoke a collection of the heap as a
// GenCollectedHeap heap.
class VM_GenCollectFull: public VM_GC_Operation {
< prev index next >