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