36 // a set of operations (VM_Operation) related to GC. |
36 // a set of operations (VM_Operation) related to GC. |
37 // |
37 // |
38 // VM_Operation |
38 // VM_Operation |
39 // VM_GC_Operation |
39 // VM_GC_Operation |
40 // VM_GC_HeapInspection |
40 // VM_GC_HeapInspection |
41 // VM_GenCollectForAllocation |
|
42 // VM_GenCollectFull |
41 // VM_GenCollectFull |
43 // VM_GenCollectFullConcurrent |
42 // VM_GenCollectFullConcurrent |
44 // VM_ParallelGCFailedAllocation |
|
45 // VM_ParallelGCSystemGC |
43 // VM_ParallelGCSystemGC |
|
44 // VM_CollectForAllocation |
|
45 // VM_GenCollectForAllocation |
|
46 // VM_ParallelGCFailedAllocation |
46 // VM_GC_Operation |
47 // VM_GC_Operation |
47 // - implements methods common to all classes in the hierarchy: |
48 // - implements methods common to all classes in the hierarchy: |
48 // prevents multiple gc requests and manages lock on heap; |
49 // prevents multiple gc requests and manages lock on heap; |
49 // |
50 // |
50 // VM_GC_HeapInspection |
51 // VM_GC_HeapInspection |
51 // - prints class histogram on SIGBREAK if PrintClassHistogram |
52 // - prints class histogram on SIGBREAK if PrintClassHistogram |
52 // is specified; and also the attach "inspectheap" operation |
53 // is specified; and also the attach "inspectheap" operation |
53 // |
54 // |
|
55 // VM_CollectForAllocation |
54 // VM_GenCollectForAllocation |
56 // VM_GenCollectForAllocation |
55 // VM_ParallelGCFailedAllocation |
57 // VM_ParallelGCFailedAllocation |
56 // - this operation is invoked when allocation is failed; |
58 // - this operation is invoked when allocation is failed; |
57 // operation performs garbage collection and tries to |
59 // operation performs garbage collection and tries to |
58 // allocate afterwards; |
60 // allocate afterwards; |
158 void set_columns(const char* value) {_columns = value;} |
160 void set_columns(const char* value) {_columns = value;} |
159 protected: |
161 protected: |
160 bool collect(); |
162 bool collect(); |
161 }; |
163 }; |
162 |
164 |
163 |
165 class VM_CollectForAllocation : public VM_GC_Operation { |
164 class VM_GenCollectForAllocation: public VM_GC_Operation { |
166 protected: |
165 private: |
167 size_t _word_size; // Size of object to be allocated (in number of words) |
166 HeapWord* _res; |
168 HeapWord* _result; // Allocation result (NULL if allocation failed) |
167 size_t _size; // size of object to be allocated. |
169 |
|
170 public: |
|
171 VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause) |
|
172 : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size) {} |
|
173 |
|
174 HeapWord* result() const { |
|
175 return _result; |
|
176 } |
|
177 }; |
|
178 |
|
179 class VM_GenCollectForAllocation : public VM_CollectForAllocation { |
|
180 private: |
168 bool _tlab; // alloc is of a tlab. |
181 bool _tlab; // alloc is of a tlab. |
169 public: |
182 public: |
170 VM_GenCollectForAllocation(size_t size, |
183 VM_GenCollectForAllocation(size_t word_size, |
171 bool tlab, |
184 bool tlab, |
172 uint gc_count_before) |
185 uint gc_count_before) |
173 : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure), |
186 : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure), |
174 _size(size), |
|
175 _tlab(tlab) { |
187 _tlab(tlab) { |
176 _res = NULL; |
188 assert(word_size != 0, "An allocation should always be requested with this operation."); |
177 } |
189 } |
178 ~VM_GenCollectForAllocation() {} |
190 ~VM_GenCollectForAllocation() {} |
179 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; } |
191 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; } |
180 virtual void doit(); |
192 virtual void doit(); |
181 HeapWord* result() const { return _res; } |
|
182 }; |
193 }; |
183 |
194 |
184 // VM operation to invoke a collection of the heap as a |
195 // VM operation to invoke a collection of the heap as a |
185 // GenCollectedHeap heap. |
196 // GenCollectedHeap heap. |
186 class VM_GenCollectFull: public VM_GC_Operation { |
197 class VM_GenCollectFull: public VM_GC_Operation { |