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