src/share/vm/gc_implementation/g1/g1MarkSweep.cpp

changeset 9358
6a4a6c499e89
parent 7659
38d6febe66af
child 9448
73d689add964
child 9665
a8441ccaff15
equal deleted inserted replaced
9357:0ef29304c2b4 9358:6a4a6c499e89
1 /* 1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2018, 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.
133 ClassLoaderDataGraph::clear_claimed_marks(); 133 ClassLoaderDataGraph::clear_claimed_marks();
134 134
135 MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); 135 MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations);
136 { 136 {
137 G1RootProcessor root_processor(g1h); 137 G1RootProcessor root_processor(g1h);
138 root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, 138 if (ClassUnloading) {
139 &GenMarkSweep::follow_cld_closure, 139 root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure,
140 &follow_code_closure); 140 &GenMarkSweep::follow_cld_closure,
141 &follow_code_closure);
142 } else {
143 root_processor.process_all_roots_no_string_table(
144 &GenMarkSweep::follow_root_closure,
145 &GenMarkSweep::follow_cld_closure,
146 &follow_code_closure);
147 }
141 } 148 }
142 149
143 // Process reference objects found during marking 150 // Process reference objects found during marking
144 ReferenceProcessor* rp = GenMarkSweep::ref_processor(); 151 ReferenceProcessor* rp = GenMarkSweep::ref_processor();
145 assert(rp == g1h->ref_processor_stw(), "Sanity"); 152 assert(rp == g1h->ref_processor_stw(), "Sanity");
156 163
157 164
158 // This is the point where the entire marking should have completed. 165 // This is the point where the entire marking should have completed.
159 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); 166 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
160 167
161 // Unload classes and purge the SystemDictionary. 168 if (ClassUnloading) {
162 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); 169
163 170 // Unload classes and purge the SystemDictionary.
164 // Unload nmethods. 171 bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
165 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); 172
166 173 // Unload nmethods.
167 // Prune dead klasses from subklass/sibling/implementor lists. 174 CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
168 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); 175
169 176 // Prune dead klasses from subklass/sibling/implementor lists.
177 Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
178 }
170 // Delete entries for dead interned string and clean up unreferenced symbols in symbol table. 179 // Delete entries for dead interned string and clean up unreferenced symbols in symbol table.
171 G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); 180 G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive);
172 181
173 if (VerifyDuringGC) { 182 if (VerifyDuringGC) {
174 HandleMark hm; // handle scope 183 HandleMark hm; // handle scope

mercurial