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

Thu, 12 Oct 2017 21:27:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 21:27:07 +0800
changeset 7535
7ae4e26cb1e0
parent 7285
1d6eb209432a
parent 6876
710a3c8b516e
child 7994
04ff2f6cd0eb
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
sjohanss@7118 28 #include "gc_implementation/g1/g1AllocationContext.hpp"
aoqi@0 29 #include "gc_implementation/shared/vmGCOperations.hpp"
aoqi@0 30
aoqi@0 31 // VM_operations for the G1 collector.
aoqi@0 32 // VM_GC_Operation:
aoqi@0 33 // - VM_CGC_Operation
aoqi@0 34 // - VM_G1CollectFull
aoqi@0 35 // - VM_G1OperationWithAllocRequest
aoqi@0 36 // - VM_G1CollectForAllocation
aoqi@0 37 // - VM_G1IncCollectionPause
aoqi@0 38
aoqi@0 39 class VM_G1OperationWithAllocRequest: public VM_GC_Operation {
aoqi@0 40 protected:
aoqi@0 41 size_t _word_size;
aoqi@0 42 HeapWord* _result;
aoqi@0 43 bool _pause_succeeded;
sjohanss@7118 44 AllocationContext_t _allocation_context;
aoqi@0 45
aoqi@0 46 public:
aoqi@0 47 VM_G1OperationWithAllocRequest(unsigned int gc_count_before,
aoqi@0 48 size_t word_size,
aoqi@0 49 GCCause::Cause gc_cause)
aoqi@0 50 : VM_GC_Operation(gc_count_before, gc_cause),
aoqi@0 51 _word_size(word_size), _result(NULL), _pause_succeeded(false) { }
aoqi@0 52 HeapWord* result() { return _result; }
aoqi@0 53 bool pause_succeeded() { return _pause_succeeded; }
sjohanss@7118 54 void set_allocation_context(AllocationContext_t context) { _allocation_context = context; }
sjohanss@7118 55 AllocationContext_t allocation_context() { return _allocation_context; }
aoqi@0 56 };
aoqi@0 57
aoqi@0 58 class VM_G1CollectFull: public VM_GC_Operation {
aoqi@0 59 public:
aoqi@0 60 VM_G1CollectFull(unsigned int gc_count_before,
aoqi@0 61 unsigned int full_gc_count_before,
aoqi@0 62 GCCause::Cause cause)
sjohanss@7285 63 : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { }
aoqi@0 64 virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
aoqi@0 65 virtual void doit();
aoqi@0 66 virtual const char* name() const {
aoqi@0 67 return "full garbage-first collection";
aoqi@0 68 }
aoqi@0 69 };
aoqi@0 70
aoqi@0 71 class VM_G1CollectForAllocation: public VM_G1OperationWithAllocRequest {
aoqi@0 72 public:
aoqi@0 73 VM_G1CollectForAllocation(unsigned int gc_count_before,
aoqi@0 74 size_t word_size);
aoqi@0 75 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
aoqi@0 76 virtual void doit();
aoqi@0 77 virtual const char* name() const {
aoqi@0 78 return "garbage-first collection to satisfy allocation";
aoqi@0 79 }
aoqi@0 80 };
aoqi@0 81
aoqi@0 82 class VM_G1IncCollectionPause: public VM_G1OperationWithAllocRequest {
aoqi@0 83 private:
aoqi@0 84 bool _should_initiate_conc_mark;
aoqi@0 85 bool _should_retry_gc;
aoqi@0 86 double _target_pause_time_ms;
aoqi@0 87 unsigned int _old_marking_cycles_completed_before;
aoqi@0 88 public:
aoqi@0 89 VM_G1IncCollectionPause(unsigned int gc_count_before,
aoqi@0 90 size_t word_size,
aoqi@0 91 bool should_initiate_conc_mark,
aoqi@0 92 double target_pause_time_ms,
aoqi@0 93 GCCause::Cause gc_cause);
aoqi@0 94 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
aoqi@0 95 virtual bool doit_prologue();
aoqi@0 96 virtual void doit();
aoqi@0 97 virtual void doit_epilogue();
aoqi@0 98 virtual const char* name() const {
aoqi@0 99 return "garbage-first incremental collection pause";
aoqi@0 100 }
aoqi@0 101 bool should_retry_gc() const { return _should_retry_gc; }
aoqi@0 102 };
aoqi@0 103
aoqi@0 104 // Concurrent GC stop-the-world operations such as remark and cleanup;
aoqi@0 105 // consider sharing these with CMS's counterparts.
aoqi@0 106 class VM_CGC_Operation: public VM_Operation {
aoqi@0 107 VoidClosure* _cl;
aoqi@0 108 const char* _printGCMessage;
aoqi@0 109 bool _needs_pll;
aoqi@0 110
aoqi@0 111 protected:
aoqi@0 112 // java.lang.ref.Reference support
aoqi@0 113 void acquire_pending_list_lock();
aoqi@0 114 void release_and_notify_pending_list_lock();
aoqi@0 115
aoqi@0 116 public:
aoqi@0 117 VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg, bool needs_pll)
aoqi@0 118 : _cl(cl), _printGCMessage(printGCMsg), _needs_pll(needs_pll) { }
aoqi@0 119 virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
aoqi@0 120 virtual void doit();
aoqi@0 121 virtual bool doit_prologue();
aoqi@0 122 virtual void doit_epilogue();
aoqi@0 123 virtual const char* name() const {
aoqi@0 124 return "concurrent gc";
aoqi@0 125 }
aoqi@0 126 };
aoqi@0 127
aoqi@0 128 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_VM_OPERATIONS_G1_HPP

mercurial