1.1 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Thu Apr 09 15:58:49 2015 +0200 1.2 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp Thu Apr 09 15:59:26 2015 +0200 1.3 @@ -38,11 +38,12 @@ 1.4 // VM_Operation 1.5 // VM_GC_Operation 1.6 // VM_GC_HeapInspection 1.7 -// VM_GenCollectForAllocation 1.8 // VM_GenCollectFull 1.9 // VM_GenCollectFullConcurrent 1.10 -// VM_ParallelGCFailedAllocation 1.11 // VM_ParallelGCSystemGC 1.12 +// VM_CollectForAllocation 1.13 +// VM_GenCollectForAllocation 1.14 +// VM_ParallelGCFailedAllocation 1.15 // VM_GC_Operation 1.16 // - implements methods common to all classes in the hierarchy: 1.17 // prevents multiple gc requests and manages lock on heap; 1.18 @@ -51,6 +52,7 @@ 1.19 // - prints class histogram on SIGBREAK if PrintClassHistogram 1.20 // is specified; and also the attach "inspectheap" operation 1.21 // 1.22 +// VM_CollectForAllocation 1.23 // VM_GenCollectForAllocation 1.24 // VM_ParallelGCFailedAllocation 1.25 // - this operation is invoked when allocation is failed; 1.26 @@ -160,25 +162,34 @@ 1.27 bool collect(); 1.28 }; 1.29 1.30 +class VM_CollectForAllocation : public VM_GC_Operation { 1.31 + protected: 1.32 + size_t _word_size; // Size of object to be allocated (in number of words) 1.33 + HeapWord* _result; // Allocation result (NULL if allocation failed) 1.34 1.35 -class VM_GenCollectForAllocation: public VM_GC_Operation { 1.36 + public: 1.37 + VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause) 1.38 + : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) {} 1.39 + 1.40 + HeapWord* result() const { 1.41 + return _result; 1.42 + } 1.43 +}; 1.44 + 1.45 +class VM_GenCollectForAllocation : public VM_CollectForAllocation { 1.46 private: 1.47 - HeapWord* _res; 1.48 - size_t _size; // size of object to be allocated. 1.49 bool _tlab; // alloc is of a tlab. 1.50 public: 1.51 - VM_GenCollectForAllocation(size_t size, 1.52 + VM_GenCollectForAllocation(size_t word_size, 1.53 bool tlab, 1.54 uint gc_count_before) 1.55 - : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), 1.56 - _size(size), 1.57 + : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure), 1.58 _tlab(tlab) { 1.59 - _res = NULL; 1.60 + assert(word_size != 0, "An allocation should always be requested with this operation."); 1.61 } 1.62 ~VM_GenCollectForAllocation() {} 1.63 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; } 1.64 virtual void doit(); 1.65 - HeapWord* result() const { return _res; } 1.66 }; 1.67 1.68 // VM operation to invoke a collection of the heap as a