提交 6dcd78ef 编写于 作者: P pliden

8044796: G1: Enable G1CollectedHeap::stop()

Reviewed-by: brutisso, sjohanss
上级 0575a10d
...@@ -432,14 +432,6 @@ HeapRegion* G1CollectedHeap::pop_dirty_cards_region() ...@@ -432,14 +432,6 @@ HeapRegion* G1CollectedHeap::pop_dirty_cards_region()
return hr; return hr;
} }
void G1CollectedHeap::stop_conc_gc_threads() {
_cg1r->stop();
_cmThread->stop();
if (G1StringDedup::is_enabled()) {
G1StringDedup::stop();
}
}
#ifdef ASSERT #ifdef ASSERT
// A region is added to the collection set as it is retired // A region is added to the collection set as it is retired
// so an address p can point to a region which will be in the // so an address p can point to a region which will be in the
...@@ -2186,20 +2178,14 @@ jint G1CollectedHeap::initialize() { ...@@ -2186,20 +2178,14 @@ jint G1CollectedHeap::initialize() {
} }
void G1CollectedHeap::stop() { void G1CollectedHeap::stop() {
#if 0 // Stop all concurrent threads. We do this to make sure these threads
// Stopping concurrent worker threads is currently disabled until // do not continue to execute and access resources (e.g. gclog_or_tty)
// some bugs in concurrent mark has been resolve. Without fixing
// those bugs first we risk haning during VM exit when trying to
// stop these threads.
// Abort any ongoing concurrent root region scanning and stop all
// concurrent threads. We do this to make sure these threads do
// not continue to execute and access resources (e.g. gclog_or_tty)
// that are destroyed during shutdown. // that are destroyed during shutdown.
_cm->root_regions()->abort(); _cg1r->stop();
_cm->root_regions()->wait_until_scan_finished(); _cmThread->stop();
stop_conc_gc_threads(); if (G1StringDedup::is_enabled()) {
#endif G1StringDedup::stop();
}
} }
size_t G1CollectedHeap::conservative_max_heap_alignment() { size_t G1CollectedHeap::conservative_max_heap_alignment() {
......
...@@ -1699,8 +1699,6 @@ public: ...@@ -1699,8 +1699,6 @@ public:
void print_all_rsets() PRODUCT_RETURN; void print_all_rsets() PRODUCT_RETURN;
public: public:
void stop_conc_gc_threads();
size_t pending_card_num(); size_t pending_card_num();
size_t cards_scanned(); size_t cards_scanned();
......
...@@ -497,9 +497,6 @@ void before_exit(JavaThread * thread) { ...@@ -497,9 +497,6 @@ void before_exit(JavaThread * thread) {
os::infinite_sleep(); os::infinite_sleep();
} }
// Stop any ongoing concurrent GC work
Universe::heap()->stop();
// Terminate watcher thread - must before disenrolling any periodic task // Terminate watcher thread - must before disenrolling any periodic task
if (PeriodicTask::num_tasks() > 0) if (PeriodicTask::num_tasks() > 0)
WatcherThread::stop(); WatcherThread::stop();
...@@ -514,10 +511,8 @@ void before_exit(JavaThread * thread) { ...@@ -514,10 +511,8 @@ void before_exit(JavaThread * thread) {
StatSampler::disengage(); StatSampler::disengage();
StatSampler::destroy(); StatSampler::destroy();
// We do not need to explicitly stop concurrent GC threads because the // Stop concurrent GC threads
// JVM will be taken down at a safepoint when such threads are inactive -- Universe::heap()->stop();
// except for some concurrent G1 threads, see (comment in)
// Threads::destroy_vm().
// Print GC/heap related information. // Print GC/heap related information.
if (PrintGCDetails) { if (PrintGCDetails) {
......
...@@ -4013,14 +4013,8 @@ bool Threads::destroy_vm() { ...@@ -4013,14 +4013,8 @@ bool Threads::destroy_vm() {
// GC vm_operations can get caught at the safepoint, and the // GC vm_operations can get caught at the safepoint, and the
// heap is unparseable if they are caught. Grab the Heap_lock // heap is unparseable if they are caught. Grab the Heap_lock
// to prevent this. The GC vm_operations will not be able to // to prevent this. The GC vm_operations will not be able to
// queue until after the vm thread is dead. // queue until after the vm thread is dead. After this point,
// After this point, we'll never emerge out of the safepoint before // we'll never emerge out of the safepoint before the VM exits.
// the VM exits, so concurrent GC threads do not need to be explicitly
// stopped; they remain inactive until the process exits.
// Note: some concurrent G1 threads may be running during a safepoint,
// but these will not be accessing the heap, just some G1-specific side
// data structures that are not accessed by any other threads but them
// after this point in a terminal safepoint.
MutexLocker ml(Heap_lock); MutexLocker ml(Heap_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册