equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
36 |
36 |
37 ////////////////////////////////////////////////////////// |
37 ////////////////////////////////////////////////////////// |
38 // Methods in abstract class VM_CMS_Operation |
38 // Methods in abstract class VM_CMS_Operation |
39 ////////////////////////////////////////////////////////// |
39 ////////////////////////////////////////////////////////// |
40 void VM_CMS_Operation::acquire_pending_list_lock() { |
40 void VM_CMS_Operation::acquire_pending_list_lock() { |
41 // The caller may block while communicating |
41 _pending_list_locker.lock(); |
42 // with the SLT thread in order to acquire/release the PLL. |
|
43 SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt(); |
|
44 if (slt != NULL) { |
|
45 slt->manipulatePLL(SurrogateLockerThread::acquirePLL); |
|
46 } else { |
|
47 SurrogateLockerThread::report_missing_slt(); |
|
48 } |
|
49 } |
42 } |
50 |
43 |
51 void VM_CMS_Operation::release_and_notify_pending_list_lock() { |
44 void VM_CMS_Operation::release_and_notify_pending_list_lock() { |
52 // The caller may block while communicating |
45 _pending_list_locker.unlock(); |
53 // with the SLT thread in order to acquire/release the PLL. |
|
54 ConcurrentMarkSweepThread::slt()-> |
|
55 manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); |
|
56 } |
46 } |
57 |
47 |
58 void VM_CMS_Operation::verify_before_gc() { |
48 void VM_CMS_Operation::verify_before_gc() { |
59 if (VerifyBeforeGC && |
49 if (VerifyBeforeGC && |
60 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { |
50 GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) { |
93 assert(Thread::current()->is_ConcurrentGC_thread(), "just checking"); |
83 assert(Thread::current()->is_ConcurrentGC_thread(), "just checking"); |
94 assert(!CMSCollector::foregroundGCShouldWait(), "Possible deadlock"); |
84 assert(!CMSCollector::foregroundGCShouldWait(), "Possible deadlock"); |
95 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(), |
85 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(), |
96 "Possible deadlock"); |
86 "Possible deadlock"); |
97 |
87 |
98 if (needs_pll()) { |
88 if (needs_pending_list_lock()) { |
99 acquire_pending_list_lock(); |
89 acquire_pending_list_lock(); |
100 } |
90 } |
101 // Get the Heap_lock after the pending_list_lock. |
91 // Get the Heap_lock after the pending_list_lock. |
102 Heap_lock->lock(); |
92 Heap_lock->lock(); |
103 if (lost_race()) { |
93 if (lost_race()) { |
104 assert(_prologue_succeeded == false, "Initialized in c'tor"); |
94 assert(_prologue_succeeded == false, "Initialized in c'tor"); |
105 Heap_lock->unlock(); |
95 Heap_lock->unlock(); |
106 if (needs_pll()) { |
96 if (needs_pending_list_lock()) { |
107 release_and_notify_pending_list_lock(); |
97 release_and_notify_pending_list_lock(); |
108 } |
98 } |
109 } else { |
99 } else { |
110 _prologue_succeeded = true; |
100 _prologue_succeeded = true; |
111 } |
101 } |
118 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(), |
108 assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(), |
119 "Possible deadlock"); |
109 "Possible deadlock"); |
120 |
110 |
121 // Release the Heap_lock first. |
111 // Release the Heap_lock first. |
122 Heap_lock->unlock(); |
112 Heap_lock->unlock(); |
123 if (needs_pll()) { |
113 if (needs_pending_list_lock()) { |
124 release_and_notify_pending_list_lock(); |
114 release_and_notify_pending_list_lock(); |
125 } |
115 } |
126 } |
116 } |
127 |
117 |
128 ////////////////////////////////////////////////////////// |
118 ////////////////////////////////////////////////////////// |