annotate src/share/vm/memory/genRemSet.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents ba764ed4b6f2
children 1ee8caae33af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 113
diff changeset
2 * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // A GenRemSet provides ways of iterating over pointers accross generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // (This is especially useful for older-to-younger.)
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class Generation;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 class BarrierSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class OopsInGenClosure;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 class CardTableRS;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 class GenRemSet: public CHeapObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 friend class Generation;
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 BarrierSet* _bs;
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
39 enum Name {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 CardTable,
a61af66fc99e Initial load
duke
parents:
diff changeset
41 Other
a61af66fc99e Initial load
duke
parents:
diff changeset
42 };
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 GenRemSet(BarrierSet * bs) : _bs(bs) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 virtual Name rs_kind() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // These are for dynamic downcasts. Unfortunately that it names the
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // possible subtypes (but not that they are subtypes!) Return NULL if
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // the cast is invalide.
a61af66fc99e Initial load
duke
parents:
diff changeset
51 virtual CardTableRS* as_CardTableRS() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Return the barrier set associated with "this."
a61af66fc99e Initial load
duke
parents:
diff changeset
54 BarrierSet* bs() { return _bs; }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // Do any (sequential) processing necessary to prepare for (possibly
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // "parallel", if that arg is true) calls to younger_refs_iterate.
a61af66fc99e Initial load
duke
parents:
diff changeset
58 virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // Apply the "do_oop" method of "blk" to (exactly) all oop locations
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // 1) that are in objects allocated in "g" at the time of the last call
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // to "save_Marks", and
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // 2) that point to objects in younger generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
64 virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 virtual void younger_refs_in_space_iterate(Space* sp,
a61af66fc99e Initial load
duke
parents:
diff changeset
67 OopsInGenClosure* cl) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // This method is used to notify the remembered set that "new_val" has
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // been written into "field" by the garbage collector.
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
71 void write_ref_field_gc(void* field, oop new_val);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
72 protected:
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
73 virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // A version of the above suitable for use by parallel collectors.
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 6
diff changeset
77 virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // Resize one of the regions covered by the remembered set.
a61af66fc99e Initial load
duke
parents:
diff changeset
80 virtual void resize_covered_region(MemRegion new_region) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // If the rem set imposes any alignment restrictions on boundaries
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // within the heap, this function tells whether they are met.
a61af66fc99e Initial load
duke
parents:
diff changeset
84 virtual bool is_aligned(HeapWord* addr) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // If the RS (or BS) imposes an aligment constraint on maximum heap size.
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // (This must be static, and dispatch on "nm", because it is called
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // before an RS is created.)
a61af66fc99e Initial load
duke
parents:
diff changeset
89 static uintx max_alignment_constraint(Name nm);
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 virtual void verify() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // Verify that the remembered set has no entries for
6
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
94 // the heap interval denoted by mr. If there are any
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
95 // alignment constraints on the remembered set, only the
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
96 // part of the region that is aligned is checked.
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
97 //
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
98 // alignment boundaries
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
99 // +--------+-------+--------+-------+
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
100 // [ region mr )
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
101 // [ part checked )
73e96e5c30df 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 0
diff changeset
102 virtual void verify_aligned_region_empty(MemRegion mr) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // If appropriate, print some information about the remset on "tty".
a61af66fc99e Initial load
duke
parents:
diff changeset
105 virtual void print() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Informs the RS that the given memregion contains no references to
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // younger generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
109 virtual void clear(MemRegion mr) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // Informs the RS that there are no references to generations
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // younger than gen from generations gen and older.
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // The parameter clear_perm indicates if the perm_gen's
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // remembered set should also be processed/cleared.
a61af66fc99e Initial load
duke
parents:
diff changeset
115 virtual void clear_into_younger(Generation* gen, bool clear_perm) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 // Informs the RS that refs in the given "mr" may have changed
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // arbitrarily, and therefore may contain old-to-young pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
119 virtual void invalidate(MemRegion mr) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Informs the RS that refs in this generation
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // may have changed arbitrarily, and therefore may contain
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // old-to-young pointers in arbitrary locations. The parameter
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // younger indicates if the same should be done for younger generations
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // as well. The parameter perm indicates if the same should be done for
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // perm gen as well.
a61af66fc99e Initial load
duke
parents:
diff changeset
127 virtual void invalidate_or_clear(Generation* gen, bool younger, bool perm) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
128 };