46 inline void ObjectMonitor::set_header(markWord hdr) {
47 Atomic::store(hdr, &_header);
48 }
49
50 inline jint ObjectMonitor::waiters() const {
51 return _waiters;
52 }
53
54 inline void* ObjectMonitor::owner() const {
55 return _owner;
56 }
57
58 inline void ObjectMonitor::clear() {
59 assert(Atomic::load(&_header).value() != 0, "must be non-zero");
60 assert(_contentions == 0, "must be 0: contentions=%d", _contentions);
61 assert(_waiters == 0, "must be 0: waiters=%d", _waiters);
62 assert(_recursions == 0, "must be 0: recursions=" INTPTR_FORMAT, _recursions);
63 assert(_object != NULL, "must be non-NULL");
64 assert(_owner == NULL, "must be NULL: owner=" INTPTR_FORMAT, p2i(_owner));
65
66 Atomic::store(markWord(0), &_header);
67 _object = NULL;
68 }
69
70 inline void* ObjectMonitor::object() const {
71 return _object;
72 }
73
74 inline void* ObjectMonitor::object_addr() {
75 return (void *)(&_object);
76 }
77
78 inline void ObjectMonitor::set_object(void* obj) {
79 _object = obj;
80 }
81
82 inline bool ObjectMonitor::check(TRAPS) {
83 if (THREAD != _owner) {
84 if (THREAD->is_lock_owned((address) _owner)) {
85 _owner = THREAD; // regain ownership of inflated monitor
86 assert (_recursions == 0, "invariant") ;
|
46 inline void ObjectMonitor::set_header(markWord hdr) {
47 Atomic::store(hdr, &_header);
48 }
49
50 inline jint ObjectMonitor::waiters() const {
51 return _waiters;
52 }
53
54 inline void* ObjectMonitor::owner() const {
55 return _owner;
56 }
57
58 inline void ObjectMonitor::clear() {
59 assert(Atomic::load(&_header).value() != 0, "must be non-zero");
60 assert(_contentions == 0, "must be 0: contentions=%d", _contentions);
61 assert(_waiters == 0, "must be 0: waiters=%d", _waiters);
62 assert(_recursions == 0, "must be 0: recursions=" INTPTR_FORMAT, _recursions);
63 assert(_object != NULL, "must be non-NULL");
64 assert(_owner == NULL, "must be NULL: owner=" INTPTR_FORMAT, p2i(_owner));
65
66 Atomic::store(markWord(markWord::zero), &_header);
67 _object = NULL;
68 }
69
70 inline void* ObjectMonitor::object() const {
71 return _object;
72 }
73
74 inline void* ObjectMonitor::object_addr() {
75 return (void *)(&_object);
76 }
77
78 inline void ObjectMonitor::set_object(void* obj) {
79 _object = obj;
80 }
81
82 inline bool ObjectMonitor::check(TRAPS) {
83 if (THREAD != _owner) {
84 if (THREAD->is_lock_owned((address) _owner)) {
85 _owner = THREAD; // regain ownership of inflated monitor
86 assert (_recursions == 0, "invariant") ;
|