8040807: G1: Enable G1CollectedHeap::stop()
Reviewed-by: brutisso, jmasa, tschatzl
This commit is contained in:
parent
3e5805dc08
commit
2652623308
@ -901,7 +901,7 @@ void ConcurrentMark::checkpointRootsInitialPre() {
|
|||||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||||
G1CollectorPolicy* g1p = g1h->g1_policy();
|
G1CollectorPolicy* g1p = g1h->g1_policy();
|
||||||
|
|
||||||
_has_aborted = false;
|
clear_has_aborted();
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (G1PrintReachableAtInitialMark) {
|
if (G1PrintReachableAtInitialMark) {
|
||||||
@ -3261,7 +3261,7 @@ void ConcurrentMark::abort() {
|
|||||||
}
|
}
|
||||||
_first_overflow_barrier_sync.abort();
|
_first_overflow_barrier_sync.abort();
|
||||||
_second_overflow_barrier_sync.abort();
|
_second_overflow_barrier_sync.abort();
|
||||||
_has_aborted = true;
|
set_has_aborted();
|
||||||
|
|
||||||
SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
|
SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
|
||||||
satb_mq_set.abandon_partial_marking();
|
satb_mq_set.abandon_partial_marking();
|
||||||
|
@ -822,7 +822,9 @@ public:
|
|||||||
// Called to abort the marking cycle after a Full GC takes place.
|
// Called to abort the marking cycle after a Full GC takes place.
|
||||||
void abort();
|
void abort();
|
||||||
|
|
||||||
bool has_aborted() { return _has_aborted; }
|
bool has_aborted() { return _has_aborted; }
|
||||||
|
void set_has_aborted() { _has_aborted = true; }
|
||||||
|
void clear_has_aborted() { _has_aborted = false; }
|
||||||
|
|
||||||
// This prints the global/local fingers. It is used for debugging.
|
// This prints the global/local fingers. It is used for debugging.
|
||||||
NOT_PRODUCT(void print_finger();)
|
NOT_PRODUCT(void print_finger();)
|
||||||
|
@ -2174,20 +2174,14 @@ jint G1CollectedHeap::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void G1CollectedHeap::stop() {
|
void G1CollectedHeap::stop() {
|
||||||
#if 0
|
// Abort any ongoing concurrent mark and stop all concurrent threads.
|
||||||
// Stopping concurrent worker threads is currently disabled until
|
// We do this to make sure these threads do not continue to execute
|
||||||
// some bugs in concurrent mark has been resolve. Without fixing
|
// and access resources (e.g. gclog_or_tty) that are destroyed during
|
||||||
// those bugs first we risk haning during VM exit when trying to
|
// shutdown.
|
||||||
// stop these threads.
|
_cm->set_has_aborted();
|
||||||
|
|
||||||
// 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.
|
|
||||||
_cm->root_regions()->abort();
|
_cm->root_regions()->abort();
|
||||||
_cm->root_regions()->wait_until_scan_finished();
|
_cm->root_regions()->wait_until_scan_finished();
|
||||||
stop_conc_gc_threads();
|
stop_conc_gc_threads();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t G1CollectedHeap::conservative_max_heap_alignment() {
|
size_t G1CollectedHeap::conservative_max_heap_alignment() {
|
||||||
|
@ -501,9 +501,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();
|
||||||
@ -518,10 +515,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) {
|
||||||
|
@ -3966,14 +3966,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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user