1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
111 Mutex* FullGCALot_lock = NULL;
112 #endif
113
114 Mutex* Debug1_lock = NULL;
115 Mutex* Debug2_lock = NULL;
116 Mutex* Debug3_lock = NULL;
117
118 Mutex* tty_lock = NULL;
119
120 Mutex* RawMonitor_lock = NULL;
121 Mutex* PerfDataMemAlloc_lock = NULL;
122 Mutex* PerfDataManager_lock = NULL;
123 Mutex* OopMapCacheAlloc_lock = NULL;
124
125 Mutex* MMUTracker_lock = NULL;
126 Mutex* HotCardCache_lock = NULL;
127
128 Monitor* GCTaskManager_lock = NULL;
129
130 Mutex* Management_lock = NULL;
131 Monitor* LowMemory_lock = NULL;
132
133 #define MAX_NUM_MUTEX 128
134 static Monitor * _mutex_array[MAX_NUM_MUTEX];
135 static int _num_mutex;
136
137 #ifdef ASSERT
138 void assert_locked_or_safepoint(const Monitor * lock) {
139 // check if this thread owns the lock (common case)
140 if (IgnoreLockingAssertions) return;
141 assert(lock != NULL, "Need non-NULL lock");
142 if (lock->owned_by_self()) return;
143 if (SafepointSynchronize::is_at_safepoint()) return;
144 if (!Universe::is_fully_initialized()) return;
145 // see if invoker of VM operation owns it
146 VM_Operation* op = VMThread::vm_operation();
147 if (op != NULL && op->calling_thread() == lock->owner()) return;
148 fatal(err_msg("must own lock %s", lock->name()));
149 }
150
151 // a stronger assertion than the above
184 def(SATB_Q_CBL_mon , Monitor, nonleaf, true );
185 def(Shared_SATB_Q_lock , Mutex, nonleaf, true );
186
187 def(DirtyCardQ_FL_lock , Mutex , special, true );
188 def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true );
189 def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true );
190
191 def(MMUTracker_lock , Mutex , leaf , true );
192 def(HotCardCache_lock , Mutex , special , true );
193 def(EvacFailureStack_lock , Mutex , nonleaf , true );
194 }
195 def(ParGCRareEvent_lock , Mutex , leaf , true );
196 def(DerivedPointerTableGC_lock , Mutex, leaf, true );
197 def(CodeCache_lock , Mutex , special, true );
198 def(Interrupt_lock , Monitor, special, true ); // used for interrupt processing
199 def(RawMonitor_lock , Mutex, special, true );
200 def(OopMapCacheAlloc_lock , Mutex, leaf, true ); // used for oop_map_cache allocation.
201
202 def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
203 def(ObjAllocPost_lock , Monitor, special, false);
204 def(LowMemory_lock , Monitor, special, true ); // used for low memory detection
205 def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
206
207 def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
208 def(PackageTable_lock , Mutex , leaf, false);
209 def(InlineCacheBuffer_lock , Mutex , leaf, true );
210 def(VMStatistic_lock , Mutex , leaf, false);
211 def(ExpandHeap_lock , Mutex , leaf, true ); // Used during compilation by VM thread
212 def(JNIHandleBlockFreeList_lock , Mutex , leaf, true ); // handles are used by VM thread
213 def(SignatureHandlerLibrary_lock , Mutex , leaf, false);
214 def(SymbolTable_lock , Mutex , leaf, true );
215 def(StringTable_lock , Mutex , leaf, true );
216 def(ProfilePrint_lock , Mutex , leaf, false); // serial profile printing
217 def(ExceptionCache_lock , Mutex , leaf, false); // serial profile printing
218 def(OsrList_lock , Mutex , leaf, true );
219 def(Debug1_lock , Mutex , leaf, true );
220 #ifndef PRODUCT
221 def(FullGCALot_lock , Mutex , leaf, false); // a lock to make FullGCALot MT safe
222 #endif
223 def(BeforeExit_lock , Monitor, leaf, true );
224 def(PerfDataMemAlloc_lock , Mutex , leaf, true ); // used for allocating PerfData memory for performance data
|
1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
111 Mutex* FullGCALot_lock = NULL;
112 #endif
113
114 Mutex* Debug1_lock = NULL;
115 Mutex* Debug2_lock = NULL;
116 Mutex* Debug3_lock = NULL;
117
118 Mutex* tty_lock = NULL;
119
120 Mutex* RawMonitor_lock = NULL;
121 Mutex* PerfDataMemAlloc_lock = NULL;
122 Mutex* PerfDataManager_lock = NULL;
123 Mutex* OopMapCacheAlloc_lock = NULL;
124
125 Mutex* MMUTracker_lock = NULL;
126 Mutex* HotCardCache_lock = NULL;
127
128 Monitor* GCTaskManager_lock = NULL;
129
130 Mutex* Management_lock = NULL;
131 Monitor* Service_lock = NULL;
132
133 #define MAX_NUM_MUTEX 128
134 static Monitor * _mutex_array[MAX_NUM_MUTEX];
135 static int _num_mutex;
136
137 #ifdef ASSERT
138 void assert_locked_or_safepoint(const Monitor * lock) {
139 // check if this thread owns the lock (common case)
140 if (IgnoreLockingAssertions) return;
141 assert(lock != NULL, "Need non-NULL lock");
142 if (lock->owned_by_self()) return;
143 if (SafepointSynchronize::is_at_safepoint()) return;
144 if (!Universe::is_fully_initialized()) return;
145 // see if invoker of VM operation owns it
146 VM_Operation* op = VMThread::vm_operation();
147 if (op != NULL && op->calling_thread() == lock->owner()) return;
148 fatal(err_msg("must own lock %s", lock->name()));
149 }
150
151 // a stronger assertion than the above
184 def(SATB_Q_CBL_mon , Monitor, nonleaf, true );
185 def(Shared_SATB_Q_lock , Mutex, nonleaf, true );
186
187 def(DirtyCardQ_FL_lock , Mutex , special, true );
188 def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true );
189 def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true );
190
191 def(MMUTracker_lock , Mutex , leaf , true );
192 def(HotCardCache_lock , Mutex , special , true );
193 def(EvacFailureStack_lock , Mutex , nonleaf , true );
194 }
195 def(ParGCRareEvent_lock , Mutex , leaf , true );
196 def(DerivedPointerTableGC_lock , Mutex, leaf, true );
197 def(CodeCache_lock , Mutex , special, true );
198 def(Interrupt_lock , Monitor, special, true ); // used for interrupt processing
199 def(RawMonitor_lock , Mutex, special, true );
200 def(OopMapCacheAlloc_lock , Mutex, leaf, true ); // used for oop_map_cache allocation.
201
202 def(Patching_lock , Mutex , special, true ); // used for safepointing and code patching.
203 def(ObjAllocPost_lock , Monitor, special, false);
204 def(Service_lock , Monitor, special, true ); // used for service thread operations
205 def(JmethodIdCreation_lock , Mutex , leaf, true ); // used for creating jmethodIDs.
206
207 def(SystemDictionary_lock , Monitor, leaf, true ); // lookups done by VM thread
208 def(PackageTable_lock , Mutex , leaf, false);
209 def(InlineCacheBuffer_lock , Mutex , leaf, true );
210 def(VMStatistic_lock , Mutex , leaf, false);
211 def(ExpandHeap_lock , Mutex , leaf, true ); // Used during compilation by VM thread
212 def(JNIHandleBlockFreeList_lock , Mutex , leaf, true ); // handles are used by VM thread
213 def(SignatureHandlerLibrary_lock , Mutex , leaf, false);
214 def(SymbolTable_lock , Mutex , leaf, true );
215 def(StringTable_lock , Mutex , leaf, true );
216 def(ProfilePrint_lock , Mutex , leaf, false); // serial profile printing
217 def(ExceptionCache_lock , Mutex , leaf, false); // serial profile printing
218 def(OsrList_lock , Mutex , leaf, true );
219 def(Debug1_lock , Mutex , leaf, true );
220 #ifndef PRODUCT
221 def(FullGCALot_lock , Mutex , leaf, false); // a lock to make FullGCALot MT safe
222 #endif
223 def(BeforeExit_lock , Monitor, leaf, true );
224 def(PerfDataMemAlloc_lock , Mutex , leaf, true ); // used for allocating PerfData memory for performance data
|