26 #include "classfile/javaClasses.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "classfile/vmSymbols.hpp"
31 #include "code/codeCache.hpp"
32 #include "code/icBuffer.hpp"
33 #include "gc/serial/genMarkSweep.hpp"
34 #include "gc/shared/collectedHeap.inline.hpp"
35 #include "gc/shared/gcHeapSummary.hpp"
36 #include "gc/shared/gcTimer.hpp"
37 #include "gc/shared/gcTrace.hpp"
38 #include "gc/shared/gcTraceTime.inline.hpp"
39 #include "gc/shared/genCollectedHeap.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "gc/shared/genOopClosures.inline.hpp"
42 #include "gc/shared/modRefBarrierSet.hpp"
43 #include "gc/shared/referencePolicy.hpp"
44 #include "gc/shared/space.hpp"
45 #include "gc/shared/strongRootsScope.hpp"
46 #include "oops/instanceRefKlass.hpp"
47 #include "oops/oop.inline.hpp"
48 #include "prims/jvmtiExport.hpp"
49 #include "runtime/handles.inline.hpp"
50 #include "runtime/synchronizer.hpp"
51 #include "runtime/thread.inline.hpp"
52 #include "runtime/vmThread.hpp"
53 #include "utilities/copy.hpp"
54 #include "utilities/events.hpp"
55 #include "utilities/stack.inline.hpp"
56
57 void GenMarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, bool clear_all_softrefs) {
58 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
59
60 GenCollectedHeap* gch = GenCollectedHeap::heap();
61 #ifdef ASSERT
62 if (gch->collector_policy()->should_clear_all_soft_refs()) {
63 assert(clear_all_softrefs, "Policy should have been checked earlier");
64 }
65 #endif
198 gch->full_process_roots(&srs,
199 false, // not the adjust phase
200 GenCollectedHeap::SO_None,
201 ClassUnloading, // only strong roots if ClassUnloading
202 // is enabled
203 &follow_root_closure,
204 &follow_cld_closure);
205 }
206
207 // Process reference objects found during marking
208 {
209 GCTraceTime(Debug, gc, phases) tm_m("Reference Processing", gc_timer());
210
211 ref_processor()->setup_policy(clear_all_softrefs);
212 ReferenceProcessorPhaseTimes pt(_gc_timer, ref_processor()->num_q());
213 const ReferenceProcessorStats& stats =
214 ref_processor()->process_discovered_references(
215 &is_alive, &keep_alive, &follow_stack_closure, NULL, &pt);
216 pt.print_all_references();
217 gc_tracer()->report_gc_reference_stats(stats);
218 }
219
220 // This is the point where the entire marking should have completed.
221 assert(_marking_stack.is_empty(), "Marking should have completed");
222
223 {
224 GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", gc_timer());
225
226 // Unload classes and purge the SystemDictionary.
227 bool purged_class = SystemDictionary::do_unloading(&is_alive, gc_timer());
228
229 // Unload nmethods.
230 CodeCache::do_unloading(&is_alive, purged_class);
231
232 // Prune dead klasses from subklass/sibling/implementor lists.
233 Klass::clean_weak_klass_links(&is_alive);
234 }
235
236 {
237 GCTraceTime(Debug, gc, phases) t("Scrub String Table", gc_timer());
|
26 #include "classfile/javaClasses.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "classfile/vmSymbols.hpp"
31 #include "code/codeCache.hpp"
32 #include "code/icBuffer.hpp"
33 #include "gc/serial/genMarkSweep.hpp"
34 #include "gc/shared/collectedHeap.inline.hpp"
35 #include "gc/shared/gcHeapSummary.hpp"
36 #include "gc/shared/gcTimer.hpp"
37 #include "gc/shared/gcTrace.hpp"
38 #include "gc/shared/gcTraceTime.inline.hpp"
39 #include "gc/shared/genCollectedHeap.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "gc/shared/genOopClosures.inline.hpp"
42 #include "gc/shared/modRefBarrierSet.hpp"
43 #include "gc/shared/referencePolicy.hpp"
44 #include "gc/shared/space.hpp"
45 #include "gc/shared/strongRootsScope.hpp"
46 #include "gc/shared/weakProcessor.hpp"
47 #include "oops/instanceRefKlass.hpp"
48 #include "oops/oop.inline.hpp"
49 #include "prims/jvmtiExport.hpp"
50 #include "runtime/handles.inline.hpp"
51 #include "runtime/synchronizer.hpp"
52 #include "runtime/thread.inline.hpp"
53 #include "runtime/vmThread.hpp"
54 #include "utilities/copy.hpp"
55 #include "utilities/events.hpp"
56 #include "utilities/stack.inline.hpp"
57
58 void GenMarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, bool clear_all_softrefs) {
59 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
60
61 GenCollectedHeap* gch = GenCollectedHeap::heap();
62 #ifdef ASSERT
63 if (gch->collector_policy()->should_clear_all_soft_refs()) {
64 assert(clear_all_softrefs, "Policy should have been checked earlier");
65 }
66 #endif
199 gch->full_process_roots(&srs,
200 false, // not the adjust phase
201 GenCollectedHeap::SO_None,
202 ClassUnloading, // only strong roots if ClassUnloading
203 // is enabled
204 &follow_root_closure,
205 &follow_cld_closure);
206 }
207
208 // Process reference objects found during marking
209 {
210 GCTraceTime(Debug, gc, phases) tm_m("Reference Processing", gc_timer());
211
212 ref_processor()->setup_policy(clear_all_softrefs);
213 ReferenceProcessorPhaseTimes pt(_gc_timer, ref_processor()->num_q());
214 const ReferenceProcessorStats& stats =
215 ref_processor()->process_discovered_references(
216 &is_alive, &keep_alive, &follow_stack_closure, NULL, &pt);
217 pt.print_all_references();
218 gc_tracer()->report_gc_reference_stats(stats);
219 }
220
221 {
222 GCTraceTime(Debug, gc, phases) tm_m("Weak Processing", gc_timer());
223 WeakProcessor::unlink_or_oops_do(&is_alive, &keep_alive, &follow_stack_closure);
224 }
225
226 // This is the point where the entire marking should have completed.
227 assert(_marking_stack.is_empty(), "Marking should have completed");
228
229 {
230 GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", gc_timer());
231
232 // Unload classes and purge the SystemDictionary.
233 bool purged_class = SystemDictionary::do_unloading(&is_alive, gc_timer());
234
235 // Unload nmethods.
236 CodeCache::do_unloading(&is_alive, purged_class);
237
238 // Prune dead klasses from subklass/sibling/implementor lists.
239 Klass::clean_weak_klass_links(&is_alive);
240 }
241
242 {
243 GCTraceTime(Debug, gc, phases) t("Scrub String Table", gc_timer());
|