author | dcubed |
Sun, 17 Mar 2013 08:57:56 -0700 | |
changeset 16355 | f4d5aba63f4e |
parent 13728 | 882756847a04 |
child 19286 | 48394008c803 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
2 |
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1388
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_MEMORY_GENREMSET_HPP |
26 |
#define SHARE_VM_MEMORY_GENREMSET_HPP |
|
27 |
||
28 |
#include "oops/oop.hpp" |
|
29 |
||
1 | 30 |
// A GenRemSet provides ways of iterating over pointers accross generations. |
31 |
// (This is especially useful for older-to-younger.) |
|
32 |
||
33 |
class Generation; |
|
34 |
class BarrierSet; |
|
35 |
class OopsInGenClosure; |
|
36 |
class CardTableRS; |
|
37 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
38 |
// Helper to remember modified oops in all klasses. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
39 |
class KlassRemSet { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
40 |
bool _accumulate_modified_oops; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
41 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
42 |
KlassRemSet() : _accumulate_modified_oops(false) {} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
43 |
void set_accumulate_modified_oops(bool value) { _accumulate_modified_oops = value; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
44 |
bool accumulate_modified_oops() { return _accumulate_modified_oops; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
45 |
bool mod_union_is_clear(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
46 |
void clear_mod_union(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
47 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
48 |
|
13195 | 49 |
class GenRemSet: public CHeapObj<mtGC> { |
1 | 50 |
friend class Generation; |
51 |
||
52 |
BarrierSet* _bs; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
53 |
KlassRemSet _klass_rem_set; |
1 | 54 |
|
55 |
public: |
|
56 |
enum Name { |
|
57 |
CardTable, |
|
58 |
Other |
|
59 |
}; |
|
60 |
||
61 |
GenRemSet(BarrierSet * bs) : _bs(bs) {} |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
62 |
GenRemSet() : _bs(NULL) {} |
1 | 63 |
|
64 |
virtual Name rs_kind() = 0; |
|
65 |
||
66 |
// These are for dynamic downcasts. Unfortunately that it names the |
|
67 |
// possible subtypes (but not that they are subtypes!) Return NULL if |
|
68 |
// the cast is invalide. |
|
69 |
virtual CardTableRS* as_CardTableRS() { return NULL; } |
|
70 |
||
71 |
// Return the barrier set associated with "this." |
|
72 |
BarrierSet* bs() { return _bs; } |
|
73 |
||
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
74 |
// Set the barrier set. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
75 |
void set_bs(BarrierSet* bs) { _bs = bs; } |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
76 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
77 |
KlassRemSet* klass_rem_set() { return &_klass_rem_set; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
78 |
|
1 | 79 |
// Do any (sequential) processing necessary to prepare for (possibly |
80 |
// "parallel", if that arg is true) calls to younger_refs_iterate. |
|
81 |
virtual void prepare_for_younger_refs_iterate(bool parallel) = 0; |
|
82 |
||
83 |
// Apply the "do_oop" method of "blk" to (exactly) all oop locations |
|
84 |
// 1) that are in objects allocated in "g" at the time of the last call |
|
85 |
// to "save_Marks", and |
|
86 |
// 2) that point to objects in younger generations. |
|
87 |
virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0; |
|
88 |
||
89 |
virtual void younger_refs_in_space_iterate(Space* sp, |
|
90 |
OopsInGenClosure* cl) = 0; |
|
91 |
||
92 |
// This method is used to notify the remembered set that "new_val" has |
|
93 |
// been written into "field" by the garbage collector. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
94 |
void write_ref_field_gc(void* field, oop new_val); |
1 | 95 |
protected: |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
96 |
virtual void write_ref_field_gc_work(void* field, oop new_val) = 0; |
1 | 97 |
public: |
98 |
||
99 |
// A version of the above suitable for use by parallel collectors. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
179
diff
changeset
|
100 |
virtual void write_ref_field_gc_par(void* field, oop new_val) = 0; |
1 | 101 |
|
102 |
// Resize one of the regions covered by the remembered set. |
|
103 |
virtual void resize_covered_region(MemRegion new_region) = 0; |
|
104 |
||
105 |
// If the rem set imposes any alignment restrictions on boundaries |
|
106 |
// within the heap, this function tells whether they are met. |
|
107 |
virtual bool is_aligned(HeapWord* addr) = 0; |
|
108 |
||
109 |
// If the RS (or BS) imposes an aligment constraint on maximum heap size. |
|
110 |
// (This must be static, and dispatch on "nm", because it is called |
|
111 |
// before an RS is created.) |
|
112 |
static uintx max_alignment_constraint(Name nm); |
|
113 |
||
114 |
virtual void verify() = 0; |
|
115 |
||
116 |
// Verify that the remembered set has no entries for |
|
179
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
117 |
// the heap interval denoted by mr. If there are any |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
118 |
// alignment constraints on the remembered set, only the |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
119 |
// part of the region that is aligned is checked. |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
120 |
// |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
121 |
// alignment boundaries |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
122 |
// +--------+-------+--------+-------+ |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
123 |
// [ region mr ) |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
124 |
// [ part checked ) |
59e3abf83f72
6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents:
1
diff
changeset
|
125 |
virtual void verify_aligned_region_empty(MemRegion mr) = 0; |
1 | 126 |
|
127 |
// If appropriate, print some information about the remset on "tty". |
|
128 |
virtual void print() {} |
|
129 |
||
130 |
// Informs the RS that the given memregion contains no references to |
|
131 |
// younger generations. |
|
132 |
virtual void clear(MemRegion mr) = 0; |
|
133 |
||
134 |
// Informs the RS that there are no references to generations |
|
135 |
// younger than gen from generations gen and older. |
|
136 |
// The parameter clear_perm indicates if the perm_gen's |
|
137 |
// remembered set should also be processed/cleared. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
138 |
virtual void clear_into_younger(Generation* gen) = 0; |
1 | 139 |
|
140 |
// Informs the RS that refs in the given "mr" may have changed |
|
141 |
// arbitrarily, and therefore may contain old-to-young pointers. |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
142 |
// If "whole heap" is true, then this invalidation is part of an |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
143 |
// invalidation of the whole heap, which an implementation might |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
144 |
// handle differently than that of a sub-part of the heap. |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
145 |
virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0; |
1 | 146 |
|
147 |
// Informs the RS that refs in this generation |
|
148 |
// may have changed arbitrarily, and therefore may contain |
|
149 |
// old-to-young pointers in arbitrary locations. The parameter |
|
150 |
// younger indicates if the same should be done for younger generations |
|
151 |
// as well. The parameter perm indicates if the same should be done for |
|
152 |
// perm gen as well. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
153 |
virtual void invalidate_or_clear(Generation* gen, bool younger) = 0; |
1 | 154 |
}; |
7397 | 155 |
|
156 |
#endif // SHARE_VM_MEMORY_GENREMSET_HPP |