1 /* 2 * Copyright (c) 2001, 2020, 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 bool _gc_succeeded; 39 40 public: 41 VM_G1CollectFull(uint gc_count_before, 42 uint full_gc_count_before, 43 GCCause::Cause cause) : 44 VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true), 45 _gc_succeeded(false) { } 46 virtual VMOp_Type type() const { return VMOp_G1CollectFull; } 47 virtual void doit(); 48 bool gc_succeeded() const { return _gc_succeeded; } 49 }; 50 51 class VM_G1TryInitiateConcMark : public VM_GC_Operation { 52 double _target_pause_time_ms; 53 bool _transient_failure; 54 bool _cycle_already_in_progress; 55 bool _terminating; 56 bool _gc_succeeded; 57 58 public: 59 VM_G1TryInitiateConcMark(uint gc_count_before, 60 GCCause::Cause gc_cause, 61 double target_pause_time_ms); 62 virtual VMOp_Type type() const { return VMOp_G1TryInitiateConcMark; } 63 virtual bool doit_prologue(); 64 virtual void doit(); 65 bool transient_failure() const { return _transient_failure; } 66 bool cycle_already_in_progress() const { return _cycle_already_in_progress; } 67 bool terminating() const { return _terminating; } 68 bool gc_succeeded() const { return _gc_succeeded; } 69 }; 70 71 class VM_G1CollectForAllocation : public VM_CollectForAllocation { 72 bool _gc_succeeded; 73 double _target_pause_time_ms; 74 75 public: 76 VM_G1CollectForAllocation(size_t word_size, 77 uint gc_count_before, 78 GCCause::Cause gc_cause, 79 double target_pause_time_ms); 80 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } 81 virtual void doit(); 82 bool gc_succeeded() const { return _gc_succeeded; } 83 }; 84 85 // Concurrent G1 stop-the-world operations such as remark and cleanup. 86 class VM_G1Concurrent : public VM_Operation { 87 VoidClosure* _cl; 88 const char* _message; 89 uint _gc_id; 90 91 public: 92 VM_G1Concurrent(VoidClosure* cl, const char* message) : 93 _cl(cl), _message(message), _gc_id(GCId::current()) { } 94 virtual VMOp_Type type() const { return VMOp_G1Concurrent; } 95 virtual void doit(); 96 virtual bool doit_prologue(); 97 virtual void doit_epilogue(); 98 }; 99 100 #endif // SHARE_GC_G1_G1VMOPERATIONS_HPP