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
236 // old_value. Otherwise, does not change the _next_om field. Returns
237 // the prior value of the _next_om field.
238 inline ObjectMonitor* ObjectMonitor::try_set_next_om(ObjectMonitor* old_value, ObjectMonitor* new_value) {
239 return Atomic::cmpxchg(&_next_om, old_value, new_value);
240 }
241
242 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP
|
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 // Simply get _next_om field.
227 inline ObjectMonitor* ObjectMonitor::next_om() const {
228 return Atomic::load(&_next_om);
229 }
230
231 // Get _next_om field with acquire semantics.
232 inline ObjectMonitor* ObjectMonitor::next_om_acquire() const {
233 return Atomic::load_acquire(&_next_om);
234 }
235
236 // Simply set _next_om field to new_value.
237 inline void ObjectMonitor::set_next_om(ObjectMonitor* new_value) {
238 Atomic::store(&_next_om, new_value);
239 }
240
241 // Set _next_om field to new_value with release semantics.
242 inline void ObjectMonitor::release_set_next_om(ObjectMonitor* new_value) {
243 Atomic::release_store(&_next_om, new_value);
244 }
245
246 // Try to set _next_om field to new_value if the current value matches
247 // old_value. Otherwise, does not change the _next_om field. Returns
248 // the prior value of the _next_om field.
249 inline ObjectMonitor* ObjectMonitor::try_set_next_om(ObjectMonitor* old_value, ObjectMonitor* new_value) {
250 return Atomic::cmpxchg(&_next_om, old_value, new_value);
251 }
252
253 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP
|