182 // global monitor free list
183 static ObjectMonitor * volatile gFreeList;
184 // global monitor in-use list, for moribund threads,
185 // monitors they inflated need to be scanned for deflation
186 static ObjectMonitor * volatile gOmInUseList;
187 // count of entries in gOmInUseList
188 static int gOmInUseCount;
189
190 // Process oops in all global used monitors (i.e. moribund thread's monitors)
191 static void global_used_oops_do(OopClosure* f);
192 // Process oops in monitors on the given list
193 static void list_oops_do(ObjectMonitor* list, OopClosure* f);
194
195 // Support for SynchronizerTest access to GVars fields:
196 static u_char* get_gvars_addr();
197 static u_char* get_gvars_hcSequence_addr();
198 static size_t get_gvars_size();
199 static u_char* get_gvars_stwRandom_addr();
200 };
201
202 // ObjectLocker enforced balanced locking and can never thrown an
203 // IllegalMonitorStateException. However, a pending exception may
204 // have to pass through, and we must also be able to deal with
205 // asynchronous exceptions. The caller is responsible for checking
206 // the threads pending exception if needed.
207 class ObjectLocker : public StackObj {
208 private:
209 Thread* _thread;
210 Handle _obj;
211 BasicLock _lock;
212 bool _dolock; // default true
213 public:
214 ObjectLocker(Handle obj, Thread* thread, bool doLock = true);
215 ~ObjectLocker();
216
217 // Monitor behavior
218 void wait(TRAPS) { ObjectSynchronizer::wait(_obj, 0, CHECK); } // wait forever
219 void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); }
220 void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); }
221 // complete_exit gives up lock completely, returning recursion count
222 // reenter reclaims lock with original recursion count
223 intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); }
224 void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
225 };
226
|
182 // global monitor free list
183 static ObjectMonitor * volatile gFreeList;
184 // global monitor in-use list, for moribund threads,
185 // monitors they inflated need to be scanned for deflation
186 static ObjectMonitor * volatile gOmInUseList;
187 // count of entries in gOmInUseList
188 static int gOmInUseCount;
189
190 // Process oops in all global used monitors (i.e. moribund thread's monitors)
191 static void global_used_oops_do(OopClosure* f);
192 // Process oops in monitors on the given list
193 static void list_oops_do(ObjectMonitor* list, OopClosure* f);
194
195 // Support for SynchronizerTest access to GVars fields:
196 static u_char* get_gvars_addr();
197 static u_char* get_gvars_hcSequence_addr();
198 static size_t get_gvars_size();
199 static u_char* get_gvars_stwRandom_addr();
200 };
201
202 // ObjectLocker enforces balanced locking and can never throw an
203 // IllegalMonitorStateException. However, a pending exception may
204 // have to pass through, and we must also be able to deal with
205 // asynchronous exceptions. The caller is responsible for checking
206 // the thread's pending exception if needed.
207 class ObjectLocker : public StackObj {
208 private:
209 Thread* _thread;
210 Handle _obj;
211 BasicLock _lock;
212 bool _dolock; // default true
213 public:
214 ObjectLocker(Handle obj, Thread* thread, bool doLock = true);
215 ~ObjectLocker();
216
217 // Monitor behavior
218 void wait(TRAPS) { ObjectSynchronizer::wait(_obj, 0, CHECK); } // wait forever
219 void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); }
220 void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); }
221 // complete_exit gives up lock completely, returning recursion count
222 // reenter reclaims lock with original recursion count
223 intptr_t complete_exit(TRAPS) { return ObjectSynchronizer::complete_exit(_obj, THREAD); }
224 void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
225 };
226
|