9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 "memory/heapInspection.hpp"
30 #include "prims/jvmtiExport.hpp"
31 #include "runtime/handles.hpp"
32 #include "runtime/jniHandles.hpp"
33 #include "runtime/synchronizer.hpp"
34 #include "runtime/vm_operations.hpp"
35
36 // The following class hierarchy represents
37 // a set of operations (VM_Operation) related to GC.
38 //
39 // VM_Operation
40 // VM_GC_Operation
41 // VM_GC_HeapInspection
42 // VM_GenCollectFull
43 // VM_GenCollectFullConcurrent
44 // VM_ParallelGCSystemGC
45 // VM_CollectForAllocation
46 // VM_GenCollectForAllocation
47 // VM_ParallelGCFailedAllocation
48 // VM_GC_Operation
176 class VM_GenCollectForAllocation : public VM_CollectForAllocation {
177 private:
178 bool _tlab; // alloc is of a tlab.
179 public:
180 VM_GenCollectForAllocation(size_t word_size,
181 bool tlab,
182 uint gc_count_before)
183 : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
184 _tlab(tlab) {
185 assert(word_size != 0, "An allocation should always be requested with this operation.");
186 }
187 ~VM_GenCollectForAllocation() {}
188 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
189 virtual void doit();
190 };
191
192 // VM operation to invoke a collection of the heap as a
193 // GenCollectedHeap heap.
194 class VM_GenCollectFull: public VM_GC_Operation {
195 private:
196 int _max_level;
197 public:
198 VM_GenCollectFull(uint gc_count_before,
199 uint full_gc_count_before,
200 GCCause::Cause gc_cause,
201 int max_level)
202 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
203 _max_level(max_level) { }
204 ~VM_GenCollectFull() {}
205 virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
206 virtual void doit();
207 };
208
209 class VM_CollectForMetadataAllocation: public VM_GC_Operation {
210 private:
211 MetaWord* _result;
212 size_t _size; // size of object to be allocated
213 Metaspace::MetadataType _mdtype;
214 ClassLoaderData* _loader_data;
215 public:
216 VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
217 size_t size, Metaspace::MetadataType mdtype,
218 uint gc_count_before,
219 uint full_gc_count_before,
220 GCCause::Cause gc_cause)
221 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
222 _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
223 }
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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/generation.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
177 class VM_GenCollectForAllocation : public VM_CollectForAllocation {
178 private:
179 bool _tlab; // alloc is of a tlab.
180 public:
181 VM_GenCollectForAllocation(size_t word_size,
182 bool tlab,
183 uint gc_count_before)
184 : VM_CollectForAllocation(word_size, gc_count_before, GCCause::_allocation_failure),
185 _tlab(tlab) {
186 assert(word_size != 0, "An allocation should always be requested with this operation.");
187 }
188 ~VM_GenCollectForAllocation() {}
189 virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
190 virtual void doit();
191 };
192
193 // VM operation to invoke a collection of the heap as a
194 // GenCollectedHeap heap.
195 class VM_GenCollectFull: public VM_GC_Operation {
196 private:
197 Generation::Type _max_generation;
198 public:
199 VM_GenCollectFull(uint gc_count_before,
200 uint full_gc_count_before,
201 GCCause::Cause gc_cause,
202 Generation::Type max_generation)
203 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
204 _max_generation(max_generation) { }
205 ~VM_GenCollectFull() {}
206 virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
207 virtual void doit();
208 };
209
210 class VM_CollectForMetadataAllocation: public VM_GC_Operation {
211 private:
212 MetaWord* _result;
213 size_t _size; // size of object to be allocated
214 Metaspace::MetadataType _mdtype;
215 ClassLoaderData* _loader_data;
216 public:
217 VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
218 size_t size, Metaspace::MetadataType mdtype,
219 uint gc_count_before,
220 uint full_gc_count_before,
221 GCCause::Cause gc_cause)
222 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
223 _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
224 }
|