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

Tue, 21 Aug 2012 14:10:39 -0700

author
johnc
date
Tue, 21 Aug 2012 14:10:39 -0700
changeset 3998
7383557659bd
parent 3823
37552638d24a
child 6876
710a3c8b516e
child 7118
227a9e5e4b4a
permissions
-rw-r--r--

7185699: G1: Prediction model discrepancies
Summary: Correct the result value of G1CollectedHeap::pending_card_num(). Change the code that calculates the GC efficiency of a non-young heap region to use historical data from mixed GCs and the actual number of live bytes when predicting how long it would take to collect the region. Changes were also reviewed by Thomas Schatzl.
Reviewed-by: azeemj, brutisso

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

mercurial