294
295 protected:
296 // We don't typically expect or want the ctors or dtors to run.
297 // normal ObjectMonitors are type-stable and immortal.
298 ObjectMonitor() { ::memset((void*)this, 0, sizeof(*this)); }
299
300 ~ObjectMonitor() {
301 // TODO: Add asserts ...
302 // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
303 // _contentions == 0 _EntryList == NULL etc
304 }
305
306 private:
307 void Recycle() {
308 // TODO: add stronger asserts ...
309 // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
310 // _contentions == 0 EntryList == NULL
311 // _recursions == 0 _WaitSet == NULL
312 #ifdef ASSERT
313 stringStream ss;
314 #endif
315 assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
316 "recursions=" INTX_FORMAT, is_busy_to_string(&ss), _recursions);
317 _succ = NULL;
318 _EntryList = NULL;
319 _cxq = NULL;
320 _WaitSet = NULL;
321 _recursions = 0;
322 }
323
324 public:
325
326 void* object() const;
327 void* object_addr();
328 void set_object(void* obj);
329 void set_allocation_state(AllocationState s);
330 AllocationState allocation_state() const;
331 bool is_free() const;
332 bool is_old() const;
333 bool is_new() const;
334
335 // Returns true if the specified thread owns the ObjectMonitor. Otherwise
336 // returns false and throws IllegalMonitorStateException (IMSE).
|
294
295 protected:
296 // We don't typically expect or want the ctors or dtors to run.
297 // normal ObjectMonitors are type-stable and immortal.
298 ObjectMonitor() { ::memset((void*)this, 0, sizeof(*this)); }
299
300 ~ObjectMonitor() {
301 // TODO: Add asserts ...
302 // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
303 // _contentions == 0 _EntryList == NULL etc
304 }
305
306 private:
307 void Recycle() {
308 // TODO: add stronger asserts ...
309 // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
310 // _contentions == 0 EntryList == NULL
311 // _recursions == 0 _WaitSet == NULL
312 #ifdef ASSERT
313 stringStream ss;
314 assert((is_busy() | _recursions) == 0, "freeing in-use monitor: %s, "
315 "recursions=" INTX_FORMAT, is_busy_to_string(&ss), _recursions);
316 #endif
317 _succ = NULL;
318 _EntryList = NULL;
319 _cxq = NULL;
320 _WaitSet = NULL;
321 _recursions = 0;
322 }
323
324 public:
325
326 void* object() const;
327 void* object_addr();
328 void set_object(void* obj);
329 void set_allocation_state(AllocationState s);
330 AllocationState allocation_state() const;
331 bool is_free() const;
332 bool is_old() const;
333 bool is_new() const;
334
335 // Returns true if the specified thread owns the ObjectMonitor. Otherwise
336 // returns false and throws IllegalMonitorStateException (IMSE).
|