146 inline bool ObjectMonitor::is_free() const {
147 return _allocation_state == Free;
148 }
149
150 inline bool ObjectMonitor::is_active() const {
151 return !is_free();
152 }
153
154 inline bool ObjectMonitor::is_old() const {
155 return _allocation_state == Old;
156 }
157
158 inline bool ObjectMonitor::is_new() const {
159 return _allocation_state == New;
160 }
161
162 inline void ObjectMonitor::dec_ref_count() {
163 // The decrement only needs to be MO_ACQ_REL since the reference
164 // counter is volatile.
165 Atomic::dec(&_ref_count);
166 guarantee(_ref_count >= 0, "sanity check: ref_count=%d", _ref_count);
167 }
168
169 inline void ObjectMonitor::inc_ref_count() {
170 // The increment needs to be MO_SEQ_CST so that the reference
171 // counter update is seen as soon as possible in a race with the
172 // async deflation protocol.
173 Atomic::inc(&_ref_count);
174 guarantee(_ref_count > 0, "sanity check: ref_count=%d", _ref_count);
175 }
176
177 inline jint ObjectMonitor::ref_count() const {
178 return OrderAccess::load_acquire(&_ref_count);
179 }
180
181 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP
|
146 inline bool ObjectMonitor::is_free() const {
147 return _allocation_state == Free;
148 }
149
150 inline bool ObjectMonitor::is_active() const {
151 return !is_free();
152 }
153
154 inline bool ObjectMonitor::is_old() const {
155 return _allocation_state == Old;
156 }
157
158 inline bool ObjectMonitor::is_new() const {
159 return _allocation_state == New;
160 }
161
162 inline void ObjectMonitor::dec_ref_count() {
163 // The decrement only needs to be MO_ACQ_REL since the reference
164 // counter is volatile.
165 Atomic::dec(&_ref_count);
166 // Can be negative as part of async deflation protocol.
167 guarantee(AsyncDeflateIdleMonitors || _ref_count >= 0,
168 "sanity check: ref_count=%d", _ref_count);
169 }
170
171 inline void ObjectMonitor::inc_ref_count() {
172 // The increment needs to be MO_SEQ_CST so that the reference
173 // counter update is seen as soon as possible in a race with the
174 // async deflation protocol.
175 Atomic::inc(&_ref_count);
176 // Can be negative as part of async deflation protocol.
177 guarantee(AsyncDeflateIdleMonitors || _ref_count > 0,
178 "sanity check: ref_count=%d", _ref_count);
179 }
180
181 inline jint ObjectMonitor::ref_count() const {
182 return OrderAccess::load_acquire(&_ref_count);
183 }
184
185 #endif // SHARE_RUNTIME_OBJECTMONITOR_INLINE_HPP
|