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