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