author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 35061 | hotspot/src/share/vm/gc/shared/generation.cpp@be6025ebffea |
child 47546 | 64ba55ba8516 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
29200 | 2 |
* Copyright (c) 1997, 2015, 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:
4106
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4106
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:
4106
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/serial/genMarkSweep.hpp" |
27 |
#include "gc/shared/blockOffsetTable.inline.hpp" |
|
28 |
#include "gc/shared/cardTableRS.hpp" |
|
29 |
#include "gc/shared/collectedHeap.inline.hpp" |
|
30 |
#include "gc/shared/gcLocker.inline.hpp" |
|
31 |
#include "gc/shared/gcTimer.hpp" |
|
32 |
#include "gc/shared/gcTrace.hpp" |
|
33 |
#include "gc/shared/genCollectedHeap.hpp" |
|
34 |
#include "gc/shared/genOopClosures.hpp" |
|
35 |
#include "gc/shared/genOopClosures.inline.hpp" |
|
36 |
#include "gc/shared/generation.hpp" |
|
37 |
#include "gc/shared/space.inline.hpp" |
|
38 |
#include "gc/shared/spaceDecorator.hpp" |
|
35061 | 39 |
#include "logging/log.hpp" |
7397 | 40 |
#include "memory/allocation.inline.hpp" |
41 |
#include "oops/oop.inline.hpp" |
|
42 |
#include "runtime/java.hpp" |
|
43 |
#include "utilities/copy.hpp" |
|
44 |
#include "utilities/events.hpp" |
|
1 | 45 |
|
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
46 |
Generation::Generation(ReservedSpace rs, size_t initial_size) : |
1 | 47 |
_ref_processor(NULL) { |
48 |
if (!_virtual_space.initialize(rs, initial_size)) { |
|
49 |
vm_exit_during_initialization("Could not reserve enough space for " |
|
50 |
"object heap"); |
|
51 |
} |
|
971
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
52 |
// Mangle all of the the initial generation. |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
53 |
if (ZapUnusedHeapArea) { |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
54 |
MemRegion mangle_region((HeapWord*)_virtual_space.low(), |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
55 |
(HeapWord*)_virtual_space.high()); |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
56 |
SpaceMangler::mangle_region(mangle_region); |
f0b20be4165d
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
360
diff
changeset
|
57 |
} |
1 | 58 |
_reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(), |
59 |
(HeapWord*)_virtual_space.high_boundary()); |
|
60 |
} |
|
61 |
||
33580 | 62 |
size_t Generation::initial_size() { |
1 | 63 |
GenCollectedHeap* gch = GenCollectedHeap::heap(); |
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
64 |
if (gch->is_young_gen(this)) { |
33580 | 65 |
return gch->gen_policy()->young_gen_spec()->init_size(); |
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
66 |
} |
33580 | 67 |
return gch->gen_policy()->old_gen_spec()->init_size(); |
1 | 68 |
} |
69 |
||
70 |
size_t Generation::max_capacity() const { |
|
71 |
return reserved().byte_size(); |
|
72 |
} |
|
73 |
||
74 |
// By default we get a single threaded default reference processor; |
|
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7397
diff
changeset
|
75 |
// generations needing multi-threaded refs processing or discovery override this method. |
1 | 76 |
void Generation::ref_processor_init() { |
77 |
assert(_ref_processor == NULL, "a reference processor already exists"); |
|
78 |
assert(!_reserved.is_empty(), "empty generation?"); |
|
8688
493d12ccc6db
6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads
ysr
parents:
7397
diff
changeset
|
79 |
_ref_processor = new ReferenceProcessor(_reserved); // a vanilla reference processor |
1 | 80 |
if (_ref_processor == NULL) { |
81 |
vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); |
|
82 |
} |
|
83 |
} |
|
84 |
||
85 |
void Generation::print() const { print_on(tty); } |
|
86 |
||
87 |
void Generation::print_on(outputStream* st) const { |
|
88 |
st->print(" %-20s", name()); |
|
89 |
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", |
|
90 |
capacity()/K, used()/K); |
|
91 |
st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", |
|
29800
fa5f7a2bf717
8076073: shared: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
29794
diff
changeset
|
92 |
p2i(_virtual_space.low_boundary()), |
fa5f7a2bf717
8076073: shared: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
29794
diff
changeset
|
93 |
p2i(_virtual_space.high()), |
fa5f7a2bf717
8076073: shared: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
29794
diff
changeset
|
94 |
p2i(_virtual_space.high_boundary())); |
1 | 95 |
} |
96 |
||
97 |
void Generation::print_summary_info() { print_summary_info_on(tty); } |
|
98 |
||
99 |
void Generation::print_summary_info_on(outputStream* st) { |
|
100 |
StatRecord* sr = stat_record(); |
|
101 |
double time = sr->accumulated_time.seconds(); |
|
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
102 |
// I didn't want to change the logging when removing the level concept, |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
103 |
// but I guess this logging could say young/old or something instead of 0/1. |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
104 |
uint level; |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
105 |
if (GenCollectedHeap::heap()->is_young_gen(this)) { |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
106 |
level = 0; |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
107 |
} else { |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
108 |
level = 1; |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
109 |
} |
1 | 110 |
st->print_cr("[Accumulated GC generation %d time %3.7f secs, " |
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
111 |
"%u GC's, avg GC time %3.7f]", |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
112 |
level, time, sr->invocations, |
1 | 113 |
sr->invocations > 0 ? time / sr->invocations : 0.0); |
114 |
} |
|
115 |
||
116 |
// Utility iterator classes |
|
117 |
||
118 |
class GenerationIsInReservedClosure : public SpaceClosure { |
|
119 |
public: |
|
120 |
const void* _p; |
|
121 |
Space* sp; |
|
122 |
virtual void do_space(Space* s) { |
|
123 |
if (sp == NULL) { |
|
124 |
if (s->is_in_reserved(_p)) sp = s; |
|
125 |
} |
|
126 |
} |
|
127 |
GenerationIsInReservedClosure(const void* p) : _p(p), sp(NULL) {} |
|
128 |
}; |
|
129 |
||
130 |
class GenerationIsInClosure : public SpaceClosure { |
|
131 |
public: |
|
132 |
const void* _p; |
|
133 |
Space* sp; |
|
134 |
virtual void do_space(Space* s) { |
|
135 |
if (sp == NULL) { |
|
136 |
if (s->is_in(_p)) sp = s; |
|
137 |
} |
|
138 |
} |
|
139 |
GenerationIsInClosure(const void* p) : _p(p), sp(NULL) {} |
|
140 |
}; |
|
141 |
||
142 |
bool Generation::is_in(const void* p) const { |
|
143 |
GenerationIsInClosure blk(p); |
|
144 |
((Generation*)this)->space_iterate(&blk); |
|
145 |
return blk.sp != NULL; |
|
146 |
} |
|
147 |
||
148 |
size_t Generation::max_contiguous_available() const { |
|
149 |
// The largest number of contiguous free words in this or any higher generation. |
|
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
150 |
size_t avail = contiguous_available(); |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
151 |
size_t old_avail = 0; |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
152 |
if (GenCollectedHeap::heap()->is_young_gen(this)) { |
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
153 |
old_avail = GenCollectedHeap::heap()->old_gen()->contiguous_available(); |
1 | 154 |
} |
31358
693058672cc6
8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents:
30870
diff
changeset
|
155 |
return MAX2(avail, old_avail); |
1 | 156 |
} |
157 |
||
6985
e9364ec299ac
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
5547
diff
changeset
|
158 |
bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const { |
e9364ec299ac
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
5547
diff
changeset
|
159 |
size_t available = max_contiguous_available(); |
e9364ec299ac
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
5547
diff
changeset
|
160 |
bool res = (available >= max_promotion_in_bytes); |
35061 | 161 |
log_trace(gc)("Generation: promo attempt is%s safe: available(" SIZE_FORMAT ") %s max_promo(" SIZE_FORMAT ")", |
162 |
res? "":" not", available, res? ">=":"<", max_promotion_in_bytes); |
|
6985
e9364ec299ac
6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents:
5547
diff
changeset
|
163 |
return res; |
1 | 164 |
} |
165 |
||
166 |
// Ignores "ref" and calls allocate(). |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
167 |
oop Generation::promote(oop obj, size_t obj_size) { |
1 | 168 |
assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); |
169 |
||
170 |
#ifndef PRODUCT |
|
30173
13cf7580b000
8077413: Avoid use of Universe::heap() inside collectors
pliden
parents:
29800
diff
changeset
|
171 |
if (GenCollectedHeap::heap()->promotion_should_fail()) { |
1 | 172 |
return NULL; |
173 |
} |
|
174 |
#endif // #ifndef PRODUCT |
|
175 |
||
176 |
HeapWord* result = allocate(obj_size, false); |
|
177 |
if (result != NULL) { |
|
178 |
Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size); |
|
179 |
return oop(result); |
|
180 |
} else { |
|
181 |
GenCollectedHeap* gch = GenCollectedHeap::heap(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
182 |
return gch->handle_failed_promotion(this, obj, obj_size); |
1 | 183 |
} |
184 |
} |
|
185 |
||
186 |
oop Generation::par_promote(int thread_num, |
|
187 |
oop obj, markOop m, size_t word_sz) { |
|
188 |
// Could do a bad general impl here that gets a lock. But no. |
|
189 |
ShouldNotCallThis(); |
|
190 |
return NULL; |
|
191 |
} |
|
192 |
||
193 |
Space* Generation::space_containing(const void* p) const { |
|
194 |
GenerationIsInReservedClosure blk(p); |
|
195 |
// Cast away const |
|
196 |
((Generation*)this)->space_iterate(&blk); |
|
197 |
return blk.sp; |
|
198 |
} |
|
199 |
||
200 |
// Some of these are mediocre general implementations. Should be |
|
201 |
// overridden to get better performance. |
|
202 |
||
203 |
class GenerationBlockStartClosure : public SpaceClosure { |
|
204 |
public: |
|
205 |
const void* _p; |
|
206 |
HeapWord* _start; |
|
207 |
virtual void do_space(Space* s) { |
|
208 |
if (_start == NULL && s->is_in_reserved(_p)) { |
|
209 |
_start = s->block_start(_p); |
|
210 |
} |
|
211 |
} |
|
212 |
GenerationBlockStartClosure(const void* p) { _p = p; _start = NULL; } |
|
213 |
}; |
|
214 |
||
215 |
HeapWord* Generation::block_start(const void* p) const { |
|
216 |
GenerationBlockStartClosure blk(p); |
|
217 |
// Cast away const |
|
218 |
((Generation*)this)->space_iterate(&blk); |
|
219 |
return blk._start; |
|
220 |
} |
|
221 |
||
222 |
class GenerationBlockSizeClosure : public SpaceClosure { |
|
223 |
public: |
|
224 |
const HeapWord* _p; |
|
225 |
size_t size; |
|
226 |
virtual void do_space(Space* s) { |
|
227 |
if (size == 0 && s->is_in_reserved(_p)) { |
|
228 |
size = s->block_size(_p); |
|
229 |
} |
|
230 |
} |
|
231 |
GenerationBlockSizeClosure(const HeapWord* p) { _p = p; size = 0; } |
|
232 |
}; |
|
233 |
||
234 |
size_t Generation::block_size(const HeapWord* p) const { |
|
235 |
GenerationBlockSizeClosure blk(p); |
|
236 |
// Cast away const |
|
237 |
((Generation*)this)->space_iterate(&blk); |
|
238 |
assert(blk.size > 0, "seems reasonable"); |
|
239 |
return blk.size; |
|
240 |
} |
|
241 |
||
242 |
class GenerationBlockIsObjClosure : public SpaceClosure { |
|
243 |
public: |
|
244 |
const HeapWord* _p; |
|
245 |
bool is_obj; |
|
246 |
virtual void do_space(Space* s) { |
|
247 |
if (!is_obj && s->is_in_reserved(_p)) { |
|
248 |
is_obj |= s->block_is_obj(_p); |
|
249 |
} |
|
250 |
} |
|
251 |
GenerationBlockIsObjClosure(const HeapWord* p) { _p = p; is_obj = false; } |
|
252 |
}; |
|
253 |
||
254 |
bool Generation::block_is_obj(const HeapWord* p) const { |
|
255 |
GenerationBlockIsObjClosure blk(p); |
|
256 |
// Cast away const |
|
257 |
((Generation*)this)->space_iterate(&blk); |
|
258 |
return blk.is_obj; |
|
259 |
} |
|
260 |
||
261 |
class GenerationOopIterateClosure : public SpaceClosure { |
|
262 |
public: |
|
23508
3b15250ea28f
8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes
mgerdin
parents:
21767
diff
changeset
|
263 |
ExtendedOopClosure* _cl; |
1 | 264 |
virtual void do_space(Space* s) { |
23508
3b15250ea28f
8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes
mgerdin
parents:
21767
diff
changeset
|
265 |
s->oop_iterate(_cl); |
1 | 266 |
} |
23508
3b15250ea28f
8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes
mgerdin
parents:
21767
diff
changeset
|
267 |
GenerationOopIterateClosure(ExtendedOopClosure* cl) : |
3b15250ea28f
8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes
mgerdin
parents:
21767
diff
changeset
|
268 |
_cl(cl) {} |
1 | 269 |
}; |
270 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
271 |
void Generation::oop_iterate(ExtendedOopClosure* cl) { |
23508
3b15250ea28f
8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes
mgerdin
parents:
21767
diff
changeset
|
272 |
GenerationOopIterateClosure blk(cl); |
1 | 273 |
space_iterate(&blk); |
274 |
} |
|
275 |
||
276 |
void Generation::younger_refs_in_space_iterate(Space* sp, |
|
30870
3050fdcdc60b
8080112: Replace and remove the last usages of CollectedHeap::n_par_threads()
stefank
parents:
30764
diff
changeset
|
277 |
OopsInGenClosure* cl, |
3050fdcdc60b
8080112: Replace and remove the last usages of CollectedHeap::n_par_threads()
stefank
parents:
30764
diff
changeset
|
278 |
uint n_threads) { |
33212 | 279 |
CardTableRS* rs = GenCollectedHeap::heap()->rem_set(); |
30870
3050fdcdc60b
8080112: Replace and remove the last usages of CollectedHeap::n_par_threads()
stefank
parents:
30764
diff
changeset
|
280 |
rs->younger_refs_in_space_iterate(sp, cl, n_threads); |
1 | 281 |
} |
282 |
||
283 |
class GenerationObjIterateClosure : public SpaceClosure { |
|
284 |
private: |
|
285 |
ObjectClosure* _cl; |
|
286 |
public: |
|
287 |
virtual void do_space(Space* s) { |
|
288 |
s->object_iterate(_cl); |
|
289 |
} |
|
290 |
GenerationObjIterateClosure(ObjectClosure* cl) : _cl(cl) {} |
|
291 |
}; |
|
292 |
||
293 |
void Generation::object_iterate(ObjectClosure* cl) { |
|
294 |
GenerationObjIterateClosure blk(cl); |
|
295 |
space_iterate(&blk); |
|
296 |
} |
|
297 |
||
1893
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
298 |
class GenerationSafeObjIterateClosure : public SpaceClosure { |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
299 |
private: |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
300 |
ObjectClosure* _cl; |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
301 |
public: |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
302 |
virtual void do_space(Space* s) { |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
303 |
s->safe_object_iterate(_cl); |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
304 |
} |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
305 |
GenerationSafeObjIterateClosure(ObjectClosure* cl) : _cl(cl) {} |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
306 |
}; |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
307 |
|
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
308 |
void Generation::safe_object_iterate(ObjectClosure* cl) { |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
309 |
GenerationSafeObjIterateClosure blk(cl); |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
310 |
space_iterate(&blk); |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
311 |
} |
c82e388e17c5
6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
jmasa
parents:
979
diff
changeset
|
312 |
|
1 | 313 |
void Generation::prepare_for_compaction(CompactPoint* cp) { |
314 |
// Generic implementation, can be specialized |
|
315 |
CompactibleSpace* space = first_compaction_space(); |
|
316 |
while (space != NULL) { |
|
317 |
space->prepare_for_compaction(cp); |
|
318 |
space = space->next_compaction_space(); |
|
319 |
} |
|
320 |
} |
|
321 |
||
322 |
class AdjustPointersClosure: public SpaceClosure { |
|
323 |
public: |
|
324 |
void do_space(Space* sp) { |
|
325 |
sp->adjust_pointers(); |
|
326 |
} |
|
327 |
}; |
|
328 |
||
329 |
void Generation::adjust_pointers() { |
|
330 |
// Note that this is done over all spaces, not just the compactible |
|
331 |
// ones. |
|
332 |
AdjustPointersClosure blk; |
|
333 |
space_iterate(&blk, true); |
|
334 |
} |
|
335 |
||
336 |
void Generation::compact() { |
|
337 |
CompactibleSpace* sp = first_compaction_space(); |
|
338 |
while (sp != NULL) { |
|
339 |
sp->compact(); |
|
340 |
sp = sp->next_compaction_space(); |
|
341 |
} |
|
342 |
} |