< prev index next >

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

Print this page
rev 59856 : 8247280: more fencing needed in async deflation for non-TSO machines
Reviewed-by: dholmes


 174   log_trace(monitorinflation, owner)("set_owner_from_BasicLock(): mid="
 175                                      INTPTR_FORMAT ", basic_lock_p="
 176                                      INTPTR_FORMAT ", new_value=" INTPTR_FORMAT,
 177                                      p2i(this), p2i(basic_lock_p), p2i(self));
 178 }
 179 
 180 // Try to set _owner field to new_value if the current value matches
 181 // old_value. Otherwise, does not change the _owner field. Returns
 182 // the prior value of the _owner field.
 183 inline void* ObjectMonitor::try_set_owner_from(void* old_value, void* new_value) {
 184   void* prev = Atomic::cmpxchg(&_owner, old_value, new_value);
 185   if (prev == old_value) {
 186     log_trace(monitorinflation, owner)("try_set_owner_from(): mid="
 187                                        INTPTR_FORMAT ", prev=" INTPTR_FORMAT
 188                                        ", new=" INTPTR_FORMAT, p2i(this),
 189                                        p2i(prev), p2i(new_value));
 190   }
 191   return prev;
 192 }
 193 




 194 inline void ObjectMonitor::set_allocation_state(ObjectMonitor::AllocationState s) {
 195   _allocation_state = s;
 196 }
 197 
 198 inline ObjectMonitor::AllocationState ObjectMonitor::allocation_state() const {
 199   return _allocation_state;
 200 }
 201 




 202 inline bool ObjectMonitor::is_free() const {
 203   return _allocation_state == Free;
 204 }
 205 
 206 inline bool ObjectMonitor::is_old() const {
 207   return _allocation_state == Old;
 208 }
 209 
 210 inline bool ObjectMonitor::is_new() const {
 211   return _allocation_state == New;
 212 }
 213 
 214 // The _next_om field can be concurrently read and modified so we
 215 // use Atomic operations to disable compiler optimizations that
 216 // might try to elide loading and/or storing this field.
 217 
 218 inline ObjectMonitor* ObjectMonitor::next_om() const {
 219   return Atomic::load(&_next_om);
 220 }
 221 
 222 // Simply set _next_om field to new_value.
 223 inline void ObjectMonitor::set_next_om(ObjectMonitor* new_value) {
 224   Atomic::store(&_next_om, new_value);
 225 }
 226 
 227 // Try to set _next_om field to new_value if the current value matches


 174   log_trace(monitorinflation, owner)("set_owner_from_BasicLock(): mid="
 175                                      INTPTR_FORMAT ", basic_lock_p="
 176                                      INTPTR_FORMAT ", new_value=" INTPTR_FORMAT,
 177                                      p2i(this), p2i(basic_lock_p), p2i(self));
 178 }
 179 
 180 // Try to set _owner field to new_value if the current value matches
 181 // old_value. Otherwise, does not change the _owner field. Returns
 182 // the prior value of the _owner field.
 183 inline void* ObjectMonitor::try_set_owner_from(void* old_value, void* new_value) {
 184   void* prev = Atomic::cmpxchg(&_owner, old_value, new_value);
 185   if (prev == old_value) {
 186     log_trace(monitorinflation, owner)("try_set_owner_from(): mid="
 187                                        INTPTR_FORMAT ", prev=" INTPTR_FORMAT
 188                                        ", new=" INTPTR_FORMAT, p2i(this),
 189                                        p2i(prev), p2i(new_value));
 190   }
 191   return prev;
 192 }
 193 
 194 inline void ObjectMonitor::release_set_allocation_state(ObjectMonitor::AllocationState s) {
 195   Atomic::release_store((int*)&_allocation_state, (int)s);
 196 }
 197 
 198 inline void ObjectMonitor::set_allocation_state(ObjectMonitor::AllocationState s) {
 199   _allocation_state = s;
 200 }
 201 
 202 inline ObjectMonitor::AllocationState ObjectMonitor::allocation_state() const {
 203   return _allocation_state;
 204 }
 205 
 206 inline ObjectMonitor::AllocationState ObjectMonitor::allocation_state_acquire() const {
 207   return (AllocationState)Atomic::load_acquire((int*)&_allocation_state);
 208 }
 209 
 210 inline bool ObjectMonitor::is_free() const {
 211   return _allocation_state == Free;
 212 }
 213 
 214 inline bool ObjectMonitor::is_old() const {
 215   return allocation_state_acquire() == Old;
 216 }
 217 
 218 inline bool ObjectMonitor::is_new() const {
 219   return _allocation_state == New;
 220 }
 221 
 222 // The _next_om field can be concurrently read and modified so we
 223 // use Atomic operations to disable compiler optimizations that
 224 // might try to elide loading and/or storing this field.
 225 
 226 inline ObjectMonitor* ObjectMonitor::next_om() const {
 227   return Atomic::load(&_next_om);
 228 }
 229 
 230 // Simply set _next_om field to new_value.
 231 inline void ObjectMonitor::set_next_om(ObjectMonitor* new_value) {
 232   Atomic::store(&_next_om, new_value);
 233 }
 234 
 235 // Try to set _next_om field to new_value if the current value matches
< prev index next >