48 #include "gc/shared/referenceProcessor.hpp"
49 #include "gc/shared/spaceDecorator.hpp"
50 #include "gc/shared/weakProcessor.hpp"
51 #include "logging/log.hpp"
52 #include "oops/oop.inline.hpp"
53 #include "runtime/biasedLocking.hpp"
54 #include "runtime/flags/flagSetting.hpp"
55 #include "runtime/handles.inline.hpp"
56 #include "runtime/safepoint.hpp"
57 #include "runtime/vmThread.hpp"
58 #include "services/management.hpp"
59 #include "services/memoryService.hpp"
60 #include "utilities/align.hpp"
61 #include "utilities/events.hpp"
62 #include "utilities/stack.inline.hpp"
63
64 elapsedTimer PSMarkSweep::_accumulated_time;
65 jlong PSMarkSweep::_time_of_last_gc = 0;
66 CollectorCounters* PSMarkSweep::_counters = NULL;
67
68 void PSMarkSweep::initialize() {
69 MemRegion mr = ParallelScavengeHeap::heap()->reserved_region();
70 set_ref_processor(new ReferenceProcessor(mr)); // a vanilla ref proc
71 _counters = new CollectorCounters("PSMarkSweep", 1);
72 }
73
74 // This method contains all heap specific policy for invoking mark sweep.
75 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
76 // the heap. It will do nothing further. If we need to bail out for policy
77 // reasons, scavenge before full gc, or any other specialized behavior, it
78 // needs to be added here.
79 //
80 // Note that this method should only be called from the vm_thread while
81 // at a safepoint!
82 //
83 // Note that the all_soft_refs_clear flag in the collector policy
84 // may be true because this method can be called without intervening
85 // activity. For example when the heap space is tight and full measure
86 // are being taken to free space.
87
88 void PSMarkSweep::invoke(bool maximum_heap_compaction) {
89 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
90 assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
|
48 #include "gc/shared/referenceProcessor.hpp"
49 #include "gc/shared/spaceDecorator.hpp"
50 #include "gc/shared/weakProcessor.hpp"
51 #include "logging/log.hpp"
52 #include "oops/oop.inline.hpp"
53 #include "runtime/biasedLocking.hpp"
54 #include "runtime/flags/flagSetting.hpp"
55 #include "runtime/handles.inline.hpp"
56 #include "runtime/safepoint.hpp"
57 #include "runtime/vmThread.hpp"
58 #include "services/management.hpp"
59 #include "services/memoryService.hpp"
60 #include "utilities/align.hpp"
61 #include "utilities/events.hpp"
62 #include "utilities/stack.inline.hpp"
63
64 elapsedTimer PSMarkSweep::_accumulated_time;
65 jlong PSMarkSweep::_time_of_last_gc = 0;
66 CollectorCounters* PSMarkSweep::_counters = NULL;
67
68 SpanSubjectToDiscoveryClosure PSMarkSweep::_span_based_discoverer;
69
70 void PSMarkSweep::initialize() {
71 _span_based_discoverer.set_span(ParallelScavengeHeap::heap()->reserved_region());
72 set_ref_processor(new ReferenceProcessor(&_span_based_discoverer)); // a vanilla ref proc
73 _counters = new CollectorCounters("PSMarkSweep", 1);
74 }
75
76 // This method contains all heap specific policy for invoking mark sweep.
77 // PSMarkSweep::invoke_no_policy() will only attempt to mark-sweep-compact
78 // the heap. It will do nothing further. If we need to bail out for policy
79 // reasons, scavenge before full gc, or any other specialized behavior, it
80 // needs to be added here.
81 //
82 // Note that this method should only be called from the vm_thread while
83 // at a safepoint!
84 //
85 // Note that the all_soft_refs_clear flag in the collector policy
86 // may be true because this method can be called without intervening
87 // activity. For example when the heap space is tight and full measure
88 // are being taken to free space.
89
90 void PSMarkSweep::invoke(bool maximum_heap_compaction) {
91 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
92 assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
|