src/share/vm/gc_implementation/g1/vm_operations_g1.hpp

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 3823
37552638d24a
parent 0
f90c822e73f8
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP
aoqi@0 27
aoqi@0 28 #include "gc_implementation/shared/vmGCOperations.hpp"
aoqi@0 29
aoqi@0 30 // VM_operations for the G1 collector.
aoqi@0 31 // VM_GC_Operation:
aoqi@0 32 // - VM_CGC_Operation
aoqi@0 33 // - VM_G1CollectFull
aoqi@0 34 // - VM_G1OperationWithAllocRequest
aoqi@0 35 // - VM_G1CollectForAllocation
aoqi@0 36 // - VM_G1IncCollectionPause
aoqi@0 37
aoqi@0 38 class VM_G1OperationWithAllocRequest: public VM_GC_Operation {
aoqi@0 39 protected:
aoqi@0 40 size_t _word_size;
aoqi@0 41 HeapWord* _result;
aoqi@0 42 bool _pause_succeeded;
aoqi@0 43
aoqi@0 44 public:
aoqi@0 45 VM_G1OperationWithAllocRequest(unsigned int gc_count_before,
aoqi@0 46 size_t word_size,
aoqi@0 47 GCCause::Cause gc_cause)
aoqi@0 48 : VM_GC_Operation(gc_count_before, gc_cause),
aoqi@0 49 _word_size(word_size), _result(NULL), _pause_succeeded(false) { }
aoqi@0 50 HeapWord* result() { return _result; }
aoqi@0 51 bool pause_succeeded() { return _pause_succeeded; }
aoqi@0 52 };
aoqi@0 53
aoqi@0 54 class VM_G1CollectFull: public VM_GC_Operation {
aoqi@0 55 public:
aoqi@0 56 VM_G1CollectFull(unsigned int gc_count_before,
aoqi@0 57 unsigned int full_gc_count_before,
aoqi@0 58 GCCause::Cause cause)
aoqi@0 59 : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { }
aoqi@0 60 virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
aoqi@0 61 virtual void doit();
aoqi@0 62 virtual const char* name() const {
aoqi@0 63 return "full garbage-first collection";
aoqi@0 64 }
aoqi@0 65 };
aoqi@0 66
aoqi@0 67 class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest {
aoqi@0 68 public:
aoqi@0 69 VM_G1CollectForAllocation(unsigned int gc_count_before,
aoqi@0 70 size_t word_size);
aoqi@0 71 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
aoqi@0 72 virtual void doit();
aoqi@0 73 virtual const char* name() const {
aoqi@0 74 return "garbage-first collection to satisfy allocation";
aoqi@0 75 }
aoqi@0 76 };
aoqi@0 77
aoqi@0 78 class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest {
aoqi@0 79 private:
aoqi@0 80 bool _should_initiate_conc_mark;
aoqi@0 81 bool _should_retry_gc;
aoqi@0 82 double _target_pause_time_ms;
aoqi@0 83 unsigned int _old_marking_cycles_completed_before;
aoqi@0 84 public:
aoqi@0 85 VM_G1IncCollectionPause(unsigned int gc_count_before,
aoqi@0 86 size_t word_size,
aoqi@0 87 bool should_initiate_conc_mark,
aoqi@0 88 double target_pause_time_ms,
aoqi@0 89 GCCause::Cause gc_cause);
aoqi@0 90 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
aoqi@0 91 virtual bool doit_prologue();
aoqi@0 92 virtual void doit();
aoqi@0 93 virtual void doit_epilogue();
aoqi@0 94 virtual const char* name() const {
aoqi@0 95 return "garbage-first incremental collection pause";
aoqi@0 96 }
aoqi@0 97 bool should_retry_gc() const { return _should_retry_gc; }
aoqi@0 98 };
aoqi@0 99
aoqi@0 100 // Concurrent GC stop-the-world operations such as remark and cleanup;
aoqi@0 101 // consider sharing these with CMS's counterparts.
aoqi@0 102 class VM_CGC_Operation: public VM_Operation {
aoqi@0 103 VoidClosure* _cl;
aoqi@0 104 const char* _printGCMessage;
aoqi@0 105 bool _needs_pll;
aoqi@0 106
aoqi@0 107 protected:
aoqi@0 108 // java.lang.ref.Reference support
aoqi@0 109 void acquire_pending_list_lock();
aoqi@0 110 void release_and_notify_pending_list_lock();
aoqi@0 111
aoqi@0 112 public:
aoqi@0 113 VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg, bool needs_pll)
aoqi@0 114 : _cl(cl), _printGCMessage(printGCMsg), _needs_pll(needs_pll) { }
aoqi@0 115 virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
aoqi@0 116 virtual void doit();
aoqi@0 117 virtual bool doit_prologue();
aoqi@0 118 virtual void doit_epilogue();
aoqi@0 119 virtual const char* name() const {
aoqi@0 120 return "concurrent gc";
aoqi@0 121 }
aoqi@0 122 };
aoqi@0 123
aoqi@0 124 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP

mercurial