src/share/vm/memory/genRemSet.hpp

Fri, 17 Apr 2009 12:22:18 -0700

author
never
date
Fri, 17 Apr 2009 12:22:18 -0700
changeset 1149
981375ca07b7
parent 791
1ee8caae33af
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6831604: missing null check in guarantee
Reviewed-by: kvn

duke@435 1 /*
xdono@631 2 * Copyright 2001-2008 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // A GenRemSet provides ways of iterating over pointers accross generations.
duke@435 26 // (This is especially useful for older-to-younger.)
duke@435 27
duke@435 28 class Generation;
duke@435 29 class BarrierSet;
duke@435 30 class OopsInGenClosure;
duke@435 31 class CardTableRS;
duke@435 32
duke@435 33 class GenRemSet: public CHeapObj {
duke@435 34 friend class Generation;
duke@435 35
duke@435 36 BarrierSet* _bs;
duke@435 37
duke@435 38 public:
duke@435 39 enum Name {
duke@435 40 CardTable,
duke@435 41 Other
duke@435 42 };
duke@435 43
duke@435 44 GenRemSet(BarrierSet * bs) : _bs(bs) {}
ysr@777 45 GenRemSet() : _bs(NULL) {}
duke@435 46
duke@435 47 virtual Name rs_kind() = 0;
duke@435 48
duke@435 49 // These are for dynamic downcasts. Unfortunately that it names the
duke@435 50 // possible subtypes (but not that they are subtypes!) Return NULL if
duke@435 51 // the cast is invalide.
duke@435 52 virtual CardTableRS* as_CardTableRS() { return NULL; }
duke@435 53
duke@435 54 // Return the barrier set associated with "this."
duke@435 55 BarrierSet* bs() { return _bs; }
duke@435 56
ysr@777 57 // Set the barrier set.
ysr@777 58 void set_bs(BarrierSet* bs) { _bs = bs; }
ysr@777 59
duke@435 60 // Do any (sequential) processing necessary to prepare for (possibly
duke@435 61 // "parallel", if that arg is true) calls to younger_refs_iterate.
duke@435 62 virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
duke@435 63
duke@435 64 // Apply the "do_oop" method of "blk" to (exactly) all oop locations
duke@435 65 // 1) that are in objects allocated in "g" at the time of the last call
duke@435 66 // to "save_Marks", and
duke@435 67 // 2) that point to objects in younger generations.
duke@435 68 virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
duke@435 69
duke@435 70 virtual void younger_refs_in_space_iterate(Space* sp,
duke@435 71 OopsInGenClosure* cl) = 0;
duke@435 72
duke@435 73 // This method is used to notify the remembered set that "new_val" has
duke@435 74 // been written into "field" by the garbage collector.
coleenp@548 75 void write_ref_field_gc(void* field, oop new_val);
duke@435 76 protected:
coleenp@548 77 virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
duke@435 78 public:
duke@435 79
duke@435 80 // A version of the above suitable for use by parallel collectors.
coleenp@548 81 virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
duke@435 82
duke@435 83 // Resize one of the regions covered by the remembered set.
duke@435 84 virtual void resize_covered_region(MemRegion new_region) = 0;
duke@435 85
duke@435 86 // If the rem set imposes any alignment restrictions on boundaries
duke@435 87 // within the heap, this function tells whether they are met.
duke@435 88 virtual bool is_aligned(HeapWord* addr) = 0;
duke@435 89
duke@435 90 // If the RS (or BS) imposes an aligment constraint on maximum heap size.
duke@435 91 // (This must be static, and dispatch on "nm", because it is called
duke@435 92 // before an RS is created.)
duke@435 93 static uintx max_alignment_constraint(Name nm);
duke@435 94
duke@435 95 virtual void verify() = 0;
duke@435 96
duke@435 97 // Verify that the remembered set has no entries for
jmasa@441 98 // the heap interval denoted by mr. If there are any
jmasa@441 99 // alignment constraints on the remembered set, only the
jmasa@441 100 // part of the region that is aligned is checked.
jmasa@441 101 //
jmasa@441 102 // alignment boundaries
jmasa@441 103 // +--------+-------+--------+-------+
jmasa@441 104 // [ region mr )
jmasa@441 105 // [ part checked )
jmasa@441 106 virtual void verify_aligned_region_empty(MemRegion mr) = 0;
duke@435 107
duke@435 108 // If appropriate, print some information about the remset on "tty".
duke@435 109 virtual void print() {}
duke@435 110
duke@435 111 // Informs the RS that the given memregion contains no references to
duke@435 112 // younger generations.
duke@435 113 virtual void clear(MemRegion mr) = 0;
duke@435 114
duke@435 115 // Informs the RS that there are no references to generations
duke@435 116 // younger than gen from generations gen and older.
duke@435 117 // The parameter clear_perm indicates if the perm_gen's
duke@435 118 // remembered set should also be processed/cleared.
duke@435 119 virtual void clear_into_younger(Generation* gen, bool clear_perm) = 0;
duke@435 120
duke@435 121 // Informs the RS that refs in the given "mr" may have changed
duke@435 122 // arbitrarily, and therefore may contain old-to-young pointers.
ysr@777 123 // If "whole heap" is true, then this invalidation is part of an
ysr@777 124 // invalidation of the whole heap, which an implementation might
ysr@777 125 // handle differently than that of a sub-part of the heap.
ysr@777 126 virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
duke@435 127
duke@435 128 // Informs the RS that refs in this generation
duke@435 129 // may have changed arbitrarily, and therefore may contain
duke@435 130 // old-to-young pointers in arbitrary locations. The parameter
duke@435 131 // younger indicates if the same should be done for younger generations
duke@435 132 // as well. The parameter perm indicates if the same should be done for
duke@435 133 // perm gen as well.
duke@435 134 virtual void invalidate_or_clear(Generation* gen, bool younger, bool perm) = 0;
duke@435 135 };

mercurial