217 markWord set_bias_epoch(int epoch) {
218 assert(has_bias_pattern(), "should not call this otherwise");
219 assert((epoch & (~epoch_mask)) == 0, "epoch overflow");
220 return markWord(mask_bits(value(), ~epoch_mask_in_place) | (epoch << epoch_shift));
221 }
222 markWord incr_bias_epoch() {
223 return set_bias_epoch((1 + bias_epoch()) & epoch_mask);
224 }
225 // Prototype mark for initialization
226 static markWord biased_locking_prototype() {
227 return markWord( biased_lock_pattern );
228 }
229
230 // lock accessors (note that these assume lock_shift == 0)
231 bool is_locked() const {
232 return (mask_bits(value(), lock_mask_in_place) != unlocked_value);
233 }
234 bool is_unlocked() const {
235 return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value);
236 }
237 bool is_marked() const {
238 return (mask_bits(value(), lock_mask_in_place) == marked_value);
239 }
240 bool is_neutral() const { return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value); }
241
242 // Special temporary state of the markWord while being inflated.
243 // Code that looks at mark outside a lock need to take this into account.
244 bool is_being_inflated() const { return (value() == 0); }
245
246 // Distinguished markword value - used when inflating over
247 // an existing stacklock. 0 indicates the markword is "BUSY".
248 // Lockword mutators that use a LD...CAS idiom should always
249 // check for and avoid overwriting a 0 value installed by some
250 // other thread. (They should spin or block instead. The 0 value
251 // is transient and *should* be short-lived).
252 static markWord INFLATING() { return zero(); } // inflate-in-progress
253
254 // Should this header be preserved during GC?
255 template <typename KlassProxy>
256 inline bool must_be_preserved(KlassProxy klass) const;
|
217 markWord set_bias_epoch(int epoch) {
218 assert(has_bias_pattern(), "should not call this otherwise");
219 assert((epoch & (~epoch_mask)) == 0, "epoch overflow");
220 return markWord(mask_bits(value(), ~epoch_mask_in_place) | (epoch << epoch_shift));
221 }
222 markWord incr_bias_epoch() {
223 return set_bias_epoch((1 + bias_epoch()) & epoch_mask);
224 }
225 // Prototype mark for initialization
226 static markWord biased_locking_prototype() {
227 return markWord( biased_lock_pattern );
228 }
229
230 // lock accessors (note that these assume lock_shift == 0)
231 bool is_locked() const {
232 return (mask_bits(value(), lock_mask_in_place) != unlocked_value);
233 }
234 bool is_unlocked() const {
235 return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value);
236 }
237 // ObjectMonitor::install_displaced_markword_in_object() uses
238 // is_marked() on ObjectMonitor::_header as part of the restoration
239 // protocol for an object's header. In this usage, the mark bits are
240 // only ever set (and cleared) on the ObjectMonitor::_header field.
241 bool is_marked() const {
242 return (mask_bits(value(), lock_mask_in_place) == marked_value);
243 }
244 bool is_neutral() const { return (mask_bits(value(), biased_lock_mask_in_place) == unlocked_value); }
245
246 // Special temporary state of the markWord while being inflated.
247 // Code that looks at mark outside a lock need to take this into account.
248 bool is_being_inflated() const { return (value() == 0); }
249
250 // Distinguished markword value - used when inflating over
251 // an existing stacklock. 0 indicates the markword is "BUSY".
252 // Lockword mutators that use a LD...CAS idiom should always
253 // check for and avoid overwriting a 0 value installed by some
254 // other thread. (They should spin or block instead. The 0 value
255 // is transient and *should* be short-lived).
256 static markWord INFLATING() { return zero(); } // inflate-in-progress
257
258 // Should this header be preserved during GC?
259 template <typename KlassProxy>
260 inline bool must_be_preserved(KlassProxy klass) const;
|