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