192 markOop set_bias_epoch(int epoch) {
193 assert(has_bias_pattern(), "should not call this otherwise");
194 assert((epoch & (~epoch_mask)) == 0, "epoch overflow");
195 return markOop(mask_bits(value(), ~epoch_mask_in_place) | (epoch << epoch_shift));
196 }
197 markOop incr_bias_epoch() {
198 return set_bias_epoch((1 + bias_epoch()) & epoch_mask);
199 }
200 // Prototype mark for initialization
201 static markOop biased_locking_prototype() {
202 return markOop( biased_lock_pattern );
203 }
204
205 // lock accessors (note that these assume lock_shift == 0)
206 bool is_locked() const {
207 return (mask_bits(value(), lock_mask_in_place) != unlocked_value);
208 }
209 bool is_unlocked() const {
210 return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value);
211 }
212 bool is_marked() const {
213 return (mask_bits(value(), lock_mask_in_place) == marked_value);
214 }
215 bool is_neutral() const { return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value); }
216
217 // Special temporary state of the markOop while being inflated.
218 // Code that looks at mark outside a lock need to take this into account.
219 bool is_being_inflated() const { return (value() == 0); }
220
221 // Distinguished markword value - used when inflating over
222 // an existing stacklock. 0 indicates the markword is "BUSY".
223 // Lockword mutators that use a LD...CAS idiom should always
224 // check for and avoid overwriting a 0 value installed by some
225 // other thread. (They should spin or block instead. The 0 value
226 // is transient and *should* be short-lived).
227 static markOop INFLATING() { return (markOop) 0; } // inflate-in-progress
228
229 // Should this header be preserved during GC?
230 inline bool must_be_preserved(oop obj_containing_mark) const;
231 inline bool must_be_preserved_with_bias(oop obj_containing_mark) const;
|
192 markOop set_bias_epoch(int epoch) {
193 assert(has_bias_pattern(), "should not call this otherwise");
194 assert((epoch & (~epoch_mask)) == 0, "epoch overflow");
195 return markOop(mask_bits(value(), ~epoch_mask_in_place) | (epoch << epoch_shift));
196 }
197 markOop incr_bias_epoch() {
198 return set_bias_epoch((1 + bias_epoch()) & epoch_mask);
199 }
200 // Prototype mark for initialization
201 static markOop biased_locking_prototype() {
202 return markOop( biased_lock_pattern );
203 }
204
205 // lock accessors (note that these assume lock_shift == 0)
206 bool is_locked() const {
207 return (mask_bits(value(), lock_mask_in_place) != unlocked_value);
208 }
209 bool is_unlocked() const {
210 return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value);
211 }
212 // ObjectMonitor::install_displaced_markword_in_object() uses
213 // is_marked() on ObjectMonitor::_header as part of the restoration
214 // protocol for an object's header. In this usage, the mark bits are
215 // only ever set (and cleared) on the ObjectMonitor::_header field.
216 bool is_marked() const {
217 return (mask_bits(value(), lock_mask_in_place) == marked_value);
218 }
219 bool is_neutral() const { return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value); }
220
221 // Special temporary state of the markOop while being inflated.
222 // Code that looks at mark outside a lock need to take this into account.
223 bool is_being_inflated() const { return (value() == 0); }
224
225 // Distinguished markword value - used when inflating over
226 // an existing stacklock. 0 indicates the markword is "BUSY".
227 // Lockword mutators that use a LD...CAS idiom should always
228 // check for and avoid overwriting a 0 value installed by some
229 // other thread. (They should spin or block instead. The 0 value
230 // is transient and *should* be short-lived).
231 static markOop INFLATING() { return (markOop) 0; } // inflate-in-progress
232
233 // Should this header be preserved during GC?
234 inline bool must_be_preserved(oop obj_containing_mark) const;
235 inline bool must_be_preserved_with_bias(oop obj_containing_mark) const;
|