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