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

Fri, 06 Feb 2009 01:38:50 +0300

author
apetrusenko
date
Fri, 06 Feb 2009 01:38:50 +0300
changeset 980
58054a18d735
parent 777
37f87013dfd8
child 1112
96b229c54d1e
permissions
-rw-r--r--

6484959: G1: introduce survivor spaces
6797754: G1: combined bugfix
Summary: Implemented a policy to control G1 survivor space parameters.
Reviewed-by: tonyp, iveresov

ysr@777 1 /*
ysr@777 2 * Copyright 2001-2007 Sun Microsystems, Inc. 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 *
ysr@777 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ysr@777 20 * CA 95054 USA or visit www.sun.com if you need additional information or
ysr@777 21 * have any 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 private:
ysr@777 35 public:
ysr@777 36 VM_G1CollectFull(int gc_count_before,
ysr@777 37 GCCause::Cause gc_cause)
ysr@777 38 : VM_GC_Operation(gc_count_before)
ysr@777 39 {
ysr@777 40 _gc_cause = gc_cause;
ysr@777 41 }
ysr@777 42 ~VM_G1CollectFull() {}
ysr@777 43 virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
ysr@777 44 virtual void doit();
ysr@777 45 virtual const char* name() const {
ysr@777 46 return "full garbage-first collection";
ysr@777 47 }
ysr@777 48 };
ysr@777 49
ysr@777 50 class VM_G1CollectForAllocation: public VM_GC_Operation {
ysr@777 51 private:
ysr@777 52 HeapWord* _res;
ysr@777 53 size_t _size; // size of object to be allocated
ysr@777 54 public:
ysr@777 55 VM_G1CollectForAllocation(size_t size, int gc_count_before)
ysr@777 56 : VM_GC_Operation(gc_count_before) {
ysr@777 57 _size = size;
ysr@777 58 _res = NULL;
ysr@777 59 }
ysr@777 60 ~VM_G1CollectForAllocation() {}
ysr@777 61 virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
ysr@777 62 virtual void doit();
ysr@777 63 virtual const char* name() const {
ysr@777 64 return "garbage-first collection to satisfy allocation";
ysr@777 65 }
ysr@777 66 HeapWord* result() { return _res; }
ysr@777 67 };
ysr@777 68
ysr@777 69 class VM_G1IncCollectionPause: public VM_GC_Operation {
ysr@777 70 public:
ysr@777 71 VM_G1IncCollectionPause(int gc_count_before) :
ysr@777 72 VM_GC_Operation(gc_count_before) {}
ysr@777 73 virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; }
ysr@777 74 virtual void doit();
ysr@777 75 virtual const char* name() const {
ysr@777 76 return "garbage-first incremental collection pause";
ysr@777 77 }
ysr@777 78 };
ysr@777 79
ysr@777 80 class VM_G1PopRegionCollectionPause: public VM_GC_Operation {
ysr@777 81 HeapRegion* _pop_region;
ysr@777 82 public:
ysr@777 83 VM_G1PopRegionCollectionPause(int gc_count_before, HeapRegion* pop_region) :
ysr@777 84 VM_GC_Operation(gc_count_before),
ysr@777 85 _pop_region(pop_region)
ysr@777 86 {}
ysr@777 87 virtual VMOp_Type type() const { return VMOp_G1PopRegionCollectionPause; }
ysr@777 88 virtual void doit();
ysr@777 89 virtual const char* name() const {
ysr@777 90 return "garbage-first popular region collection pause";
ysr@777 91 }
ysr@777 92 };
ysr@777 93
ysr@777 94 // Concurrent GC stop-the-world operations such as initial and final mark;
ysr@777 95 // consider sharing these with CMS's counterparts.
ysr@777 96 class VM_CGC_Operation: public VM_Operation {
ysr@777 97 VoidClosure* _cl;
ysr@777 98 const char* _printGCMessage;
ysr@777 99 public:
ysr@777 100 VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) :
ysr@777 101 _cl(cl),
ysr@777 102 _printGCMessage(printGCMsg)
ysr@777 103 {}
ysr@777 104
ysr@777 105 ~VM_CGC_Operation() {}
ysr@777 106
ysr@777 107 virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
ysr@777 108 virtual void doit();
ysr@777 109 virtual bool doit_prologue();
ysr@777 110 virtual void doit_epilogue();
ysr@777 111 virtual const char* name() const {
ysr@777 112 return "concurrent gc";
ysr@777 113 }
ysr@777 114 };

mercurial