227 static size_t get_gvars_size();
228 static u_char* get_gvars_stw_random_addr();
229
230 static void handle_sync_on_value_based_class(Handle obj, JavaThread* locking_thread);
231 };
232
233 // ObjectLocker enforces balanced locking and can never throw an
234 // IllegalMonitorStateException. However, a pending exception may
235 // have to pass through, and we must also be able to deal with
236 // asynchronous exceptions. The caller is responsible for checking
237 // the thread's pending exception if needed.
238 // When using ObjectLocker the top native frames in the stack will
239 // not be seen in case we attempt preemption, since we start walking
240 // from the last Java anchor, so we disable it with NoPreemptMark.
241 class ObjectLocker : public StackObj {
242 private:
243 JavaThread* _thread;
244 Handle _obj;
245 BasicLock _lock;
246 NoPreemptMark _npm;
247 public:
248 ObjectLocker(Handle obj, JavaThread* current);
249 ~ObjectLocker();
250
251 // Monitor behavior
252 void wait(TRAPS) { ObjectSynchronizer::wait(_obj, 0, CHECK); } // wait forever
253 void wait_uninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); } // wait forever
254 void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); }
255 };
256
257 // Interface to visit monitors
258 class ObjectMonitorsView {
259 public:
260 // Visit monitors that belong to the given thread
261 virtual void visit(MonitorClosure* closure, JavaThread* thread) = 0;
262 };
263
264 #endif // SHARE_RUNTIME_SYNCHRONIZER_HPP
|
227 static size_t get_gvars_size();
228 static u_char* get_gvars_stw_random_addr();
229
230 static void handle_sync_on_value_based_class(Handle obj, JavaThread* locking_thread);
231 };
232
233 // ObjectLocker enforces balanced locking and can never throw an
234 // IllegalMonitorStateException. However, a pending exception may
235 // have to pass through, and we must also be able to deal with
236 // asynchronous exceptions. The caller is responsible for checking
237 // the thread's pending exception if needed.
238 // When using ObjectLocker the top native frames in the stack will
239 // not be seen in case we attempt preemption, since we start walking
240 // from the last Java anchor, so we disable it with NoPreemptMark.
241 class ObjectLocker : public StackObj {
242 private:
243 JavaThread* _thread;
244 Handle _obj;
245 BasicLock _lock;
246 NoPreemptMark _npm;
247 bool _skip_exit;
248 public:
249 ObjectLocker(Handle obj, TRAPS);
250 ~ObjectLocker();
251
252 // Monitor behavior
253 void wait_uninterruptibly(TRAPS);
254 void notify_all(TRAPS) { ObjectSynchronizer::notifyall(_obj, CHECK); }
255 };
256
257 // Interface to visit monitors
258 class ObjectMonitorsView {
259 public:
260 // Visit monitors that belong to the given thread
261 virtual void visit(MonitorClosure* closure, JavaThread* thread) = 0;
262 };
263
264 #endif // SHARE_RUNTIME_SYNCHRONIZER_HPP
|