src/share/vm/memory/genRemSet.hpp

Sun, 01 Apr 2012 17:04:26 -0400

author
acorn
date
Sun, 01 Apr 2012 17:04:26 -0400
changeset 3686
749b1464aa81
parent 2314
f95d63e2154a
child 3900
d2a62e0f25eb
permissions
-rw-r--r--

Merge

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 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.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_MEMORY_GENREMSET_HPP
stefank@2314 26 #define SHARE_VM_MEMORY_GENREMSET_HPP
stefank@2314 27
stefank@2314 28 #include "oops/oop.hpp"
stefank@2314 29
duke@435 30 // A GenRemSet provides ways of iterating over pointers accross generations.
duke@435 31 // (This is especially useful for older-to-younger.)
duke@435 32
duke@435 33 class Generation;
duke@435 34 class BarrierSet;
duke@435 35 class OopsInGenClosure;
duke@435 36 class CardTableRS;
duke@435 37
duke@435 38 class GenRemSet: public CHeapObj {
duke@435 39 friend class Generation;
duke@435 40
duke@435 41 BarrierSet* _bs;
duke@435 42
duke@435 43 public:
duke@435 44 enum Name {
duke@435 45 CardTable,
duke@435 46 Other
duke@435 47 };
duke@435 48
duke@435 49 GenRemSet(BarrierSet * bs) : _bs(bs) {}
ysr@777 50 GenRemSet() : _bs(NULL) {}
duke@435 51
duke@435 52 virtual Name rs_kind() = 0;
duke@435 53
duke@435 54 // These are for dynamic downcasts. Unfortunately that it names the
duke@435 55 // possible subtypes (but not that they are subtypes!) Return NULL if
duke@435 56 // the cast is invalide.
duke@435 57 virtual CardTableRS* as_CardTableRS() { return NULL; }
duke@435 58
duke@435 59 // Return the barrier set associated with "this."
duke@435 60 BarrierSet* bs() { return _bs; }
duke@435 61
ysr@777 62 // Set the barrier set.
ysr@777 63 void set_bs(BarrierSet* bs) { _bs = bs; }
ysr@777 64
duke@435 65 // Do any (sequential) processing necessary to prepare for (possibly
duke@435 66 // "parallel", if that arg is true) calls to younger_refs_iterate.
duke@435 67 virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
duke@435 68
duke@435 69 // Apply the "do_oop" method of "blk" to (exactly) all oop locations
duke@435 70 // 1) that are in objects allocated in "g" at the time of the last call
duke@435 71 // to "save_Marks", and
duke@435 72 // 2) that point to objects in younger generations.
duke@435 73 virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
duke@435 74
duke@435 75 virtual void younger_refs_in_space_iterate(Space* sp,
duke@435 76 OopsInGenClosure* cl) = 0;
duke@435 77
duke@435 78 // This method is used to notify the remembered set that "new_val" has
duke@435 79 // been written into "field" by the garbage collector.
coleenp@548 80 void write_ref_field_gc(void* field, oop new_val);
duke@435 81 protected:
coleenp@548 82 virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
duke@435 83 public:
duke@435 84
duke@435 85 // A version of the above suitable for use by parallel collectors.
coleenp@548 86 virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
duke@435 87
duke@435 88 // Resize one of the regions covered by the remembered set.
duke@435 89 virtual void resize_covered_region(MemRegion new_region) = 0;
duke@435 90
duke@435 91 // If the rem set imposes any alignment restrictions on boundaries
duke@435 92 // within the heap, this function tells whether they are met.
duke@435 93 virtual bool is_aligned(HeapWord* addr) = 0;
duke@435 94
duke@435 95 // If the RS (or BS) imposes an aligment constraint on maximum heap size.
duke@435 96 // (This must be static, and dispatch on "nm", because it is called
duke@435 97 // before an RS is created.)
duke@435 98 static uintx max_alignment_constraint(Name nm);
duke@435 99
duke@435 100 virtual void verify() = 0;
duke@435 101
duke@435 102 // Verify that the remembered set has no entries for
jmasa@441 103 // the heap interval denoted by mr. If there are any
jmasa@441 104 // alignment constraints on the remembered set, only the
jmasa@441 105 // part of the region that is aligned is checked.
jmasa@441 106 //
jmasa@441 107 // alignment boundaries
jmasa@441 108 // +--------+-------+--------+-------+
jmasa@441 109 // [ region mr )
jmasa@441 110 // [ part checked )
jmasa@441 111 virtual void verify_aligned_region_empty(MemRegion mr) = 0;
duke@435 112
duke@435 113 // If appropriate, print some information about the remset on "tty".
duke@435 114 virtual void print() {}
duke@435 115
duke@435 116 // Informs the RS that the given memregion contains no references to
duke@435 117 // younger generations.
duke@435 118 virtual void clear(MemRegion mr) = 0;
duke@435 119
duke@435 120 // Informs the RS that there are no references to generations
duke@435 121 // younger than gen from generations gen and older.
duke@435 122 // The parameter clear_perm indicates if the perm_gen's
duke@435 123 // remembered set should also be processed/cleared.
duke@435 124 virtual void clear_into_younger(Generation* gen, bool clear_perm) = 0;
duke@435 125
duke@435 126 // Informs the RS that refs in the given "mr" may have changed
duke@435 127 // arbitrarily, and therefore may contain old-to-young pointers.
ysr@777 128 // If "whole heap" is true, then this invalidation is part of an
ysr@777 129 // invalidation of the whole heap, which an implementation might
ysr@777 130 // handle differently than that of a sub-part of the heap.
ysr@777 131 virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
duke@435 132
duke@435 133 // Informs the RS that refs in this generation
duke@435 134 // may have changed arbitrarily, and therefore may contain
duke@435 135 // old-to-young pointers in arbitrary locations. The parameter
duke@435 136 // younger indicates if the same should be done for younger generations
duke@435 137 // as well. The parameter perm indicates if the same should be done for
duke@435 138 // perm gen as well.
duke@435 139 virtual void invalidate_or_clear(Generation* gen, bool younger, bool perm) = 0;
duke@435 140 };
stefank@2314 141
stefank@2314 142 #endif // SHARE_VM_MEMORY_GENREMSET_HPP

mercurial