Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4ca6dc0799b6 595c0f60d50d |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
17606:45d7b2c7029d | 18041:52b4284cb496 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2014, 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. |
29 #include "classfile/vmSymbols.hpp" | 29 #include "classfile/vmSymbols.hpp" |
30 #include "code/codeCache.hpp" | 30 #include "code/codeCache.hpp" |
31 #include "code/icBuffer.hpp" | 31 #include "code/icBuffer.hpp" |
32 #include "gc_implementation/g1/g1Log.hpp" | 32 #include "gc_implementation/g1/g1Log.hpp" |
33 #include "gc_implementation/g1/g1MarkSweep.hpp" | 33 #include "gc_implementation/g1/g1MarkSweep.hpp" |
34 #include "gc_implementation/g1/g1StringDedup.hpp" | |
34 #include "gc_implementation/shared/gcHeapSummary.hpp" | 35 #include "gc_implementation/shared/gcHeapSummary.hpp" |
35 #include "gc_implementation/shared/gcTimer.hpp" | 36 #include "gc_implementation/shared/gcTimer.hpp" |
36 #include "gc_implementation/shared/gcTrace.hpp" | 37 #include "gc_implementation/shared/gcTrace.hpp" |
37 #include "gc_implementation/shared/gcTraceTime.hpp" | 38 #include "gc_implementation/shared/gcTraceTime.hpp" |
38 #include "memory/gcLocker.hpp" | 39 #include "memory/gcLocker.hpp" |
161 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); | 162 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); |
162 | 163 |
163 // Prune dead klasses from subklass/sibling/implementor lists. | 164 // Prune dead klasses from subklass/sibling/implementor lists. |
164 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); | 165 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); |
165 | 166 |
166 // Delete entries for dead interned strings. | 167 // Delete entries for dead interned string and clean up unreferenced symbols in symbol table. |
167 StringTable::unlink(&GenMarkSweep::is_alive); | 168 G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); |
168 | |
169 // Clean up unreferenced symbols in symbol table. | |
170 SymbolTable::unlink(); | |
171 | 169 |
172 if (VerifyDuringGC) { | 170 if (VerifyDuringGC) { |
173 HandleMark hm; // handle scope | 171 HandleMark hm; // handle scope |
174 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); | 172 COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact); |
175 Universe::heap()->prepare_for_verify(); | 173 Universe::heap()->prepare_for_verify(); |
197 | 195 |
198 class G1PrepareCompactClosure: public HeapRegionClosure { | 196 class G1PrepareCompactClosure: public HeapRegionClosure { |
199 G1CollectedHeap* _g1h; | 197 G1CollectedHeap* _g1h; |
200 ModRefBarrierSet* _mrbs; | 198 ModRefBarrierSet* _mrbs; |
201 CompactPoint _cp; | 199 CompactPoint _cp; |
202 HumongousRegionSet _humongous_proxy_set; | 200 HeapRegionSetCount _humongous_regions_removed; |
203 | 201 |
204 void free_humongous_region(HeapRegion* hr) { | 202 void free_humongous_region(HeapRegion* hr) { |
205 HeapWord* end = hr->end(); | 203 HeapWord* end = hr->end(); |
206 size_t dummy_pre_used; | |
207 FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep"); | 204 FreeRegionList dummy_free_list("Dummy Free List for G1MarkSweep"); |
208 | 205 |
209 assert(hr->startsHumongous(), | 206 assert(hr->startsHumongous(), |
210 "Only the start of a humongous region should be freed."); | 207 "Only the start of a humongous region should be freed."); |
211 _g1h->free_humongous_region(hr, &dummy_pre_used, &dummy_free_list, | 208 |
212 &_humongous_proxy_set, false /* par */); | 209 hr->set_containing_set(NULL); |
210 _humongous_regions_removed.increment(1u, hr->capacity()); | |
211 | |
212 _g1h->free_humongous_region(hr, &dummy_free_list, false /* par */); | |
213 hr->prepare_for_compaction(&_cp); | 213 hr->prepare_for_compaction(&_cp); |
214 // Also clear the part of the card table that will be unused after | 214 // Also clear the part of the card table that will be unused after |
215 // compaction. | 215 // compaction. |
216 _mrbs->clear(MemRegion(hr->compaction_top(), end)); | 216 _mrbs->clear(MemRegion(hr->compaction_top(), end)); |
217 dummy_free_list.remove_all(); | 217 dummy_free_list.remove_all(); |
220 public: | 220 public: |
221 G1PrepareCompactClosure(CompactibleSpace* cs) | 221 G1PrepareCompactClosure(CompactibleSpace* cs) |
222 : _g1h(G1CollectedHeap::heap()), | 222 : _g1h(G1CollectedHeap::heap()), |
223 _mrbs(_g1h->g1_barrier_set()), | 223 _mrbs(_g1h->g1_barrier_set()), |
224 _cp(NULL, cs, cs->initialize_threshold()), | 224 _cp(NULL, cs, cs->initialize_threshold()), |
225 _humongous_proxy_set("G1MarkSweep Humongous Proxy Set") { } | 225 _humongous_regions_removed() { } |
226 | 226 |
227 void update_sets() { | 227 void update_sets() { |
228 // We'll recalculate total used bytes and recreate the free list | 228 // We'll recalculate total used bytes and recreate the free list |
229 // at the end of the GC, so no point in updating those values here. | 229 // at the end of the GC, so no point in updating those values here. |
230 _g1h->update_sets_after_freeing_regions(0, /* pre_used */ | 230 HeapRegionSetCount empty_set; |
231 NULL, /* free_list */ | 231 _g1h->remove_from_old_sets(empty_set, _humongous_regions_removed); |
232 NULL, /* old_proxy_set */ | |
233 &_humongous_proxy_set, | |
234 false /* par */); | |
235 } | 232 } |
236 | 233 |
237 bool doHeapRegion(HeapRegion* hr) { | 234 bool doHeapRegion(HeapRegion* hr) { |
238 if (hr->isHumongous()) { | 235 if (hr->isHumongous()) { |
239 if (hr->startsHumongous()) { | 236 if (hr->startsHumongous()) { |
322 | 319 |
323 // Now adjust pointers in remaining weak roots. (All of which should | 320 // Now adjust pointers in remaining weak roots. (All of which should |
324 // have been cleared if they pointed to non-surviving objects.) | 321 // have been cleared if they pointed to non-surviving objects.) |
325 g1h->g1_process_weak_roots(&GenMarkSweep::adjust_pointer_closure); | 322 g1h->g1_process_weak_roots(&GenMarkSweep::adjust_pointer_closure); |
326 | 323 |
324 if (G1StringDedup::is_enabled()) { | |
325 G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure); | |
326 } | |
327 | |
327 GenMarkSweep::adjust_marks(); | 328 GenMarkSweep::adjust_marks(); |
328 | 329 |
329 G1AdjustPointersClosure blk; | 330 G1AdjustPointersClosure blk; |
330 g1h->heap_region_iterate(&blk); | 331 g1h->heap_region_iterate(&blk); |
331 } | 332 } |