Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 2153:377371490991
Merge
author | johnc |
---|---|
date | Thu, 20 Jan 2011 13:57:12 -0800 |
parents | 9afee0b9fc1d 0fa27f37d4d4 |
children | 3582bf76420e |
comparison
equal
deleted
inserted
replaced
2148:02b6913287da | 2153:377371490991 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
179 assert(GenMarkSweep::_marking_stack.is_empty(), | 179 assert(GenMarkSweep::_marking_stack.is_empty(), |
180 "stack should be empty by now"); | 180 "stack should be empty by now"); |
181 } | 181 } |
182 | 182 |
183 class G1PrepareCompactClosure: public HeapRegionClosure { | 183 class G1PrepareCompactClosure: public HeapRegionClosure { |
184 G1CollectedHeap* _g1h; | |
184 ModRefBarrierSet* _mrbs; | 185 ModRefBarrierSet* _mrbs; |
185 CompactPoint _cp; | 186 CompactPoint _cp; |
187 size_t _pre_used; | |
188 FreeRegionList _free_list; | |
189 HumongousRegionSet _humongous_proxy_set; | |
186 | 190 |
187 void free_humongous_region(HeapRegion* hr) { | 191 void free_humongous_region(HeapRegion* hr) { |
188 HeapWord* bot = hr->bottom(); | |
189 HeapWord* end = hr->end(); | 192 HeapWord* end = hr->end(); |
190 assert(hr->startsHumongous(), | 193 assert(hr->startsHumongous(), |
191 "Only the start of a humongous region should be freed."); | 194 "Only the start of a humongous region should be freed."); |
192 G1CollectedHeap::heap()->free_region(hr); | 195 _g1h->free_humongous_region(hr, &_pre_used, &_free_list, |
196 &_humongous_proxy_set, false /* par */); | |
197 // Do we also need to do this for the continues humongous regions | |
198 // we just collapsed? | |
193 hr->prepare_for_compaction(&_cp); | 199 hr->prepare_for_compaction(&_cp); |
194 // Also clear the part of the card table that will be unused after | 200 // Also clear the part of the card table that will be unused after |
195 // compaction. | 201 // compaction. |
196 _mrbs->clear(MemRegion(hr->compaction_top(), hr->end())); | 202 _mrbs->clear(MemRegion(hr->compaction_top(), end)); |
197 } | 203 } |
198 | 204 |
199 public: | 205 public: |
200 G1PrepareCompactClosure(CompactibleSpace* cs) : | 206 G1PrepareCompactClosure(CompactibleSpace* cs) |
207 : _g1h(G1CollectedHeap::heap()), | |
208 _mrbs(G1CollectedHeap::heap()->mr_bs()), | |
201 _cp(NULL, cs, cs->initialize_threshold()), | 209 _cp(NULL, cs, cs->initialize_threshold()), |
202 _mrbs(G1CollectedHeap::heap()->mr_bs()) | 210 _pre_used(0), |
203 {} | 211 _free_list("Local Free List for G1MarkSweep"), |
212 _humongous_proxy_set("G1MarkSweep Humongous Proxy Set") { } | |
213 | |
214 void update_sets() { | |
215 // We'll recalculate total used bytes and recreate the free list | |
216 // at the end of the GC, so no point in updating those values here. | |
217 _g1h->update_sets_after_freeing_regions(0, /* pre_used */ | |
218 NULL, /* free_list */ | |
219 &_humongous_proxy_set, | |
220 false /* par */); | |
221 _free_list.remove_all(); | |
222 } | |
223 | |
204 bool doHeapRegion(HeapRegion* hr) { | 224 bool doHeapRegion(HeapRegion* hr) { |
205 if (hr->isHumongous()) { | 225 if (hr->isHumongous()) { |
206 if (hr->startsHumongous()) { | 226 if (hr->startsHumongous()) { |
207 oop obj = oop(hr->bottom()); | 227 oop obj = oop(hr->bottom()); |
208 if (obj->is_gc_marked()) { | 228 if (obj->is_gc_marked()) { |
264 sp = r->next_compaction_space(); | 284 sp = r->next_compaction_space(); |
265 } | 285 } |
266 | 286 |
267 G1PrepareCompactClosure blk(sp); | 287 G1PrepareCompactClosure blk(sp); |
268 g1h->heap_region_iterate(&blk); | 288 g1h->heap_region_iterate(&blk); |
289 blk.update_sets(); | |
269 | 290 |
270 CompactPoint perm_cp(pg, NULL, NULL); | 291 CompactPoint perm_cp(pg, NULL, NULL); |
271 pg->prepare_for_compaction(&perm_cp); | 292 pg->prepare_for_compaction(&perm_cp); |
272 } | 293 } |
273 | 294 |