< prev index next >

src/share/vm/runtime/objectMonitor.inline.hpp

Print this page

        

*** 47,67 **** inline jint ObjectMonitor::waiters() const { return _waiters; } inline void* ObjectMonitor::owner() const { ! return _owner; } inline void ObjectMonitor::clear() { assert(_header, "Fatal logic error in ObjectMonitor header!"); assert(_count == 0, "Fatal logic error in ObjectMonitor count!"); assert(_waiters == 0, "Fatal logic error in ObjectMonitor waiters!"); assert(_recursions == 0, "Fatal logic error in ObjectMonitor recursions!"); assert(_object != NULL, "Fatal logic error in ObjectMonitor object!"); assert(_owner == 0, "Fatal logic error in ObjectMonitor owner!"); _header = NULL; _object = NULL; } --- 47,69 ---- inline jint ObjectMonitor::waiters() const { return _waiters; } inline void* ObjectMonitor::owner() const { ! void* owner = _owner; ! return owner != (void*) -1 ? owner : NULL; } inline void ObjectMonitor::clear() { assert(_header, "Fatal logic error in ObjectMonitor header!"); assert(_count == 0, "Fatal logic error in ObjectMonitor count!"); assert(_waiters == 0, "Fatal logic error in ObjectMonitor waiters!"); assert(_recursions == 0, "Fatal logic error in ObjectMonitor recursions!"); assert(_object != NULL, "Fatal logic error in ObjectMonitor object!"); assert(_owner == 0, "Fatal logic error in ObjectMonitor owner!"); + set_allocation_state(Free); _header = NULL; _object = NULL; }
*** 91,101 **** } // return number of threads contending for this monitor inline jint ObjectMonitor::contentions() const { ! return _count; } // Do NOT set _count = 0. There is a race such that _count could // be set while inflating prior to setting _owner // Just use Atomic::inc/dec and assert 0 when monitor put on free list --- 93,104 ---- } // return number of threads contending for this monitor inline jint ObjectMonitor::contentions() const { ! jint count = _count; ! return count < 0 ? count + max_jint : count; } // Do NOT set _count = 0. There is a race such that _count could // be set while inflating prior to setting _owner // Just use Atomic::inc/dec and assert 0 when monitor put on free list
< prev index next >