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

Mon, 09 Aug 2010 05:41:05 -0700

author
jcoomes
date
Mon, 09 Aug 2010 05:41:05 -0700
changeset 2064
5f429ee79634
parent 2011
4e5661ba9d98
child 2314
f95d63e2154a
permissions
-rw-r--r--

6966222: G1: simplify TaskQueue overflow handling
Reviewed-by: tonyp, ysr

ysr@777 1 /*
trims@1907 2 * Copyright (c) 2001, 2009, 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
ysr@777 25 // VM_operations for the G1 collector.
ysr@777 26 // VM_GC_Operation:
ysr@777 27 // - VM_CGC_Operation
ysr@777 28 // - VM_G1CollectFull
ysr@777 29 // - VM_G1CollectForAllocation
ysr@777 30 // - VM_G1IncCollectionPause
ysr@777 31 // - VM_G1PopRegionCollectionPause
ysr@777 32
ysr@777 33 class VM_G1CollectFull: public VM_GC_Operation {
ysr@777 34 public:
tonyp@2011 35 VM_G1CollectFull(unsigned int gc_count_before,
tonyp@2011 36 unsigned int full_gc_count_before,
tonyp@2011 37 GCCause::Cause cause)
tonyp@2011 38 : VM_GC_Operation(gc_count_before, full_gc_count_before) {
tonyp@2011 39 _gc_cause = cause;
ysr@777 40 }
ysr@777 41 ~VM_G1CollectFull() {}
ysr@777 42 virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
ysr@777 43 virtual void doit();
ysr@777 44 virtual const char* name() const {
ysr@777 45 return "full garbage-first collection";
ysr@777 46 }
ysr@777 47 };
ysr@777 48
ysr@777 49 class VM_G1CollectForAllocation: public VM_GC_Operation {
ysr@777 50 private:
ysr@777 51 HeapWord* _res;
ysr@777 52 size_t _size; // size of object to be allocated
ysr@777 53 public:
ysr@777 54 VM_G1CollectForAllocation(size_t size, int gc_count_before)
ysr@777 55 : VM_GC_Operation(gc_count_before) {
ysr@777 56 _size = size;
ysr@777 57 _res = NULL;
ysr@777 58 }
ysr@777 59 ~VM_G1CollectForAllocation() {}
ysr@777 60 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
ysr@777 61 virtual void doit();
ysr@777 62 virtual const char* name() const {
ysr@777 63 return "garbage-first collection to satisfy allocation";
ysr@777 64 }
ysr@777 65 HeapWord* result() { return _res; }
ysr@777 66 };
ysr@777 67
ysr@777 68 class VM_G1IncCollectionPause: public VM_GC_Operation {
tonyp@2011 69 private:
tonyp@2011 70 bool _should_initiate_conc_mark;
tonyp@2011 71 double _target_pause_time_ms;
tonyp@2011 72 unsigned int _full_collections_completed_before;
tonyp@2011 73 public:
tonyp@2011 74 VM_G1IncCollectionPause(unsigned int gc_count_before,
tonyp@2011 75 bool should_initiate_conc_mark,
tonyp@2011 76 double target_pause_time_ms,
tonyp@2011 77 GCCause::Cause cause)
tonyp@2011 78 : VM_GC_Operation(gc_count_before),
tonyp@2011 79 _full_collections_completed_before(0),
tonyp@2011 80 _should_initiate_conc_mark(should_initiate_conc_mark),
tonyp@2011 81 _target_pause_time_ms(target_pause_time_ms) {
tonyp@2011 82 guarantee(target_pause_time_ms > 0.0,
tonyp@2011 83 err_msg("target_pause_time_ms = %1.6lf should be positive",
tonyp@2011 84 target_pause_time_ms));
tonyp@2011 85
tonyp@2011 86 _gc_cause = cause;
tonyp@2011 87 }
ysr@777 88 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
ysr@777 89 virtual void doit();
tonyp@2011 90 virtual void doit_epilogue();
ysr@777 91 virtual const char* name() const {
ysr@777 92 return "garbage-first incremental collection pause";
ysr@777 93 }
ysr@777 94 };
ysr@777 95
ysr@777 96 // Concurrent GC stop-the-world operations such as initial and final mark;
ysr@777 97 // consider sharing these with CMS's counterparts.
ysr@777 98 class VM_CGC_Operation: public VM_Operation {
ysr@777 99 VoidClosure* _cl;
ysr@777 100 const char* _printGCMessage;
ysr@777 101 public:
ysr@777 102 VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) :
ysr@777 103 _cl(cl),
ysr@777 104 _printGCMessage(printGCMsg)
ysr@777 105 {}
ysr@777 106
ysr@777 107 ~VM_CGC_Operation() {}
ysr@777 108
ysr@777 109 virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
ysr@777 110 virtual void doit();
ysr@777 111 virtual bool doit_prologue();
ysr@777 112 virtual void doit_epilogue();
ysr@777 113 virtual const char* name() const {
ysr@777 114 return "concurrent gc";
ysr@777 115 }
ysr@777 116 };

mercurial