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