< prev index next >

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

Print this page

 99   log_trace(monitorinflation, owner)("release_clear_owner(): mid="
100                                      INTPTR_FORMAT ", old_value=" INTPTR_FORMAT,
101                                      p2i(this), p2i(old_value));
102 }
103 
104 // Simply set _owner field to new_value; current value must match old_value.
105 // (Simple means no memory sync needed.)
106 inline void ObjectMonitor::set_owner_from(void* old_value, void* new_value) {
107 #ifdef ASSERT
108   void* prev = Atomic::load(&_owner);
109   assert(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
110          ", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
111 #endif
112   Atomic::store(&_owner, new_value);
113   log_trace(monitorinflation, owner)("set_owner_from(): mid="
114                                      INTPTR_FORMAT ", old_value=" INTPTR_FORMAT
115                                      ", new_value=" INTPTR_FORMAT, p2i(this),
116                                      p2i(old_value), p2i(new_value));
117 }
118 
119 // Simply set _owner field to self; current value must match basic_lock_p.
120 inline void ObjectMonitor::set_owner_from_BasicLock(void* basic_lock_p, JavaThread* current) {
121 #ifdef ASSERT
122   void* prev = Atomic::load(&_owner);
123   assert(prev == basic_lock_p, "unexpected prev owner=" INTPTR_FORMAT
124          ", expected=" INTPTR_FORMAT, p2i(prev), p2i(basic_lock_p));
125 #endif
126   // Non-null owner field to non-null owner field is safe without
127   // cmpxchg() as long as all readers can tolerate either flavor.
128   Atomic::store(&_owner, current);
129   log_trace(monitorinflation, owner)("set_owner_from_BasicLock(): mid="
130                                      INTPTR_FORMAT ", basic_lock_p="
131                                      INTPTR_FORMAT ", new_value=" INTPTR_FORMAT,
132                                      p2i(this), p2i(basic_lock_p), p2i(current));
133 }
134 
135 // Try to set _owner field to new_value if the current value matches
136 // old_value. Otherwise, does not change the _owner field. Returns
137 // the prior value of the _owner field.
138 inline void* ObjectMonitor::try_set_owner_from(void* old_value, void* new_value) {
139   void* prev = Atomic::cmpxchg(&_owner, old_value, new_value);
140   if (prev == old_value) {
141     log_trace(monitorinflation, owner)("try_set_owner_from(): mid="
142                                        INTPTR_FORMAT ", prev=" INTPTR_FORMAT
143                                        ", new=" INTPTR_FORMAT, p2i(this),
144                                        p2i(prev), p2i(new_value));
145   }
146   return prev;
147 }
148 
149 // The _next_om field can be concurrently read and modified so we
150 // use Atomic operations to disable compiler optimizations that
151 // might try to elide loading and/or storing this field.
152 
153 // Simply get _next_om field.
154 inline ObjectMonitor* ObjectMonitor::next_om() const {

 99   log_trace(monitorinflation, owner)("release_clear_owner(): mid="
100                                      INTPTR_FORMAT ", old_value=" INTPTR_FORMAT,
101                                      p2i(this), p2i(old_value));
102 }
103 
104 // Simply set _owner field to new_value; current value must match old_value.
105 // (Simple means no memory sync needed.)
106 inline void ObjectMonitor::set_owner_from(void* old_value, void* new_value) {
107 #ifdef ASSERT
108   void* prev = Atomic::load(&_owner);
109   assert(prev == old_value, "unexpected prev owner=" INTPTR_FORMAT
110          ", expected=" INTPTR_FORMAT, p2i(prev), p2i(old_value));
111 #endif
112   Atomic::store(&_owner, new_value);
113   log_trace(monitorinflation, owner)("set_owner_from(): mid="
114                                      INTPTR_FORMAT ", old_value=" INTPTR_FORMAT
115                                      ", new_value=" INTPTR_FORMAT, p2i(this),
116                                      p2i(old_value), p2i(new_value));
117 }
118 
















119 // Try to set _owner field to new_value if the current value matches
120 // old_value. Otherwise, does not change the _owner field. Returns
121 // the prior value of the _owner field.
122 inline void* ObjectMonitor::try_set_owner_from(void* old_value, void* new_value) {
123   void* prev = Atomic::cmpxchg(&_owner, old_value, new_value);
124   if (prev == old_value) {
125     log_trace(monitorinflation, owner)("try_set_owner_from(): mid="
126                                        INTPTR_FORMAT ", prev=" INTPTR_FORMAT
127                                        ", new=" INTPTR_FORMAT, p2i(this),
128                                        p2i(prev), p2i(new_value));
129   }
130   return prev;
131 }
132 
133 // The _next_om field can be concurrently read and modified so we
134 // use Atomic operations to disable compiler optimizations that
135 // might try to elide loading and/or storing this field.
136 
137 // Simply get _next_om field.
138 inline ObjectMonitor* ObjectMonitor::next_om() const {
< prev index next >