1 /* 2 * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 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_GC_G1_G1VMOPERATIONS_HPP 26 #define SHARE_GC_G1_G1VMOPERATIONS_HPP 27 28 #include "gc/shared/gcId.hpp" 29 #include "gc/shared/gcVMOperations.hpp" 30 31 // VM_operations for the G1 collector. 32 // VM_GC_Operation: 33 // - VM_G1Concurrent 34 // - VM_G1CollectForAllocation 35 // - VM_G1CollectFull 36 37 class VM_G1CollectFull : public VM_GC_Operation { 38 public: 39 VM_G1CollectFull(uint gc_count_before, 40 uint full_gc_count_before, 41 GCCause::Cause cause) : 42 VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { } 43 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } 44 virtual void doit(); 45 }; 46 47 class VM_G1CollectForAllocation : public VM_CollectForAllocation { 48 bool _pause_succeeded; 49 50 bool _should_initiate_conc_mark; 51 bool _should_retry_gc; 52 double _target_pause_time_ms; 53 uint _old_marking_cycles_completed_before; 54 55 public: 56 VM_G1CollectForAllocation(size_t word_size, 57 uint gc_count_before, 58 GCCause::Cause gc_cause, 59 bool should_initiate_conc_mark, 60 double target_pause_time_ms); 61 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } 62 virtual bool doit_prologue(); 63 virtual void doit(); 64 virtual void doit_epilogue(); 65 bool should_retry_gc() const { return _should_retry_gc; } 66 bool pause_succeeded() { return _pause_succeeded; } 67 }; 68 69 // Concurrent G1 stop-the-world operations such as remark and cleanup. 70 class VM_G1Concurrent : public VM_Operation { 71 VoidClosure* _cl; 72 const char* _message; 73 uint _gc_id; 74 75 public: 76 VM_G1Concurrent(VoidClosure* cl, const char* message) : 77 _cl(cl), _message(message), _gc_id(GCId::current()) { } 78 virtual VMOp_Type type() const { return VMOp_G1Concurrent; } 79 virtual void doit(); 80 virtual bool doit_prologue(); 81 virtual void doit_epilogue(); 82 }; 83 84 #endif // SHARE_GC_G1_G1VMOPERATIONS_HPP