3696 // 4945125 The vm thread comes to a safepoint during exit. |
3696 // 4945125 The vm thread comes to a safepoint during exit. |
3697 // GC vm_operations can get caught at the safepoint, and the |
3697 // GC vm_operations can get caught at the safepoint, and the |
3698 // heap is unparseable if they are caught. Grab the Heap_lock |
3698 // heap is unparseable if they are caught. Grab the Heap_lock |
3699 // to prevent this. The GC vm_operations will not be able to |
3699 // to prevent this. The GC vm_operations will not be able to |
3700 // queue until after the vm thread is dead. |
3700 // queue until after the vm thread is dead. |
|
3701 // After this point, we'll never emerge out of the safepoint before |
|
3702 // the VM exits, so concurrent GC threads do not need to be explicitly |
|
3703 // stopped; they remain inactive until the process exits. |
|
3704 // Note: some concurrent G1 threads may be running during a safepoint, |
|
3705 // but these will not be accessing the heap, just some G1-specific side |
|
3706 // data structures that are not accessed by any other threads but them |
|
3707 // after this point in a terminal safepoint. |
|
3708 |
3701 MutexLocker ml(Heap_lock); |
3709 MutexLocker ml(Heap_lock); |
3702 |
3710 |
3703 VMThread::wait_for_vm_thread_exit(); |
3711 VMThread::wait_for_vm_thread_exit(); |
3704 assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint"); |
3712 assert(SafepointSynchronize::is_at_safepoint(), "VM thread should exit at Safepoint"); |
3705 VMThread::destroy(); |
3713 VMThread::destroy(); |