< prev index next >
src/hotspot/share/oops/markOop.hpp
Print this page
*** 102,111 ****
--- 102,116 ----
class markWord {
private:
uintptr_t _value;
+ // Poison - prevent casts and pointer conversions.
+ // Use to_pointer and from_pointer instead.
+ template<typename T> operator T();
+ markWord(const volatile void*);
+
public:
explicit markWord(uintptr_t value) : _value(value) {}
markWord() { /* uninitialized */}
*** 113,122 ****
--- 118,130 ----
// destructable, copyable, and assignable.
static markWord from_pointer(void* ptr) {
return markWord((uintptr_t)ptr);
}
+ void* to_pointer() const {
+ return (void*)_value;
+ }
bool operator==(const markWord& other) const {
return _value == other._value;
}
bool operator!=(const markWord& other) const {
*** 125,134 ****
--- 133,144 ----
// Conversion
uintptr_t value() const { return _value; }
// Constants
+ static const uintptr_t zero = 0;
+
enum { age_bits = 4,
lock_bits = 2,
biased_lock_bits = 1,
max_hash_bits = BitsPerWord - age_bits - lock_bits - biased_lock_bits,
hash_bits = max_hash_bits > 31 ? 31 : max_hash_bits,
*** 241,251 ****
// an existing stacklock. 0 indicates the markword is "BUSY".
// Lockword mutators that use a LD...CAS idiom should always
// check for and avoid overwriting a 0 value installed by some
// other thread. (They should spin or block instead. The 0 value
// is transient and *should* be short-lived).
! static markWord INFLATING() { return markWord(0); } // inflate-in-progress
// Should this header be preserved during GC?
inline bool must_be_preserved(oop obj_containing_mark) const;
inline bool must_be_preserved_with_bias(oop obj_containing_mark) const;
--- 251,261 ----
// an existing stacklock. 0 indicates the markword is "BUSY".
// Lockword mutators that use a LD...CAS idiom should always
// check for and avoid overwriting a 0 value installed by some
// other thread. (They should spin or block instead. The 0 value
// is transient and *should* be short-lived).
! static markWord INFLATING() { return markWord(zero); } // inflate-in-progress
// Should this header be preserved during GC?
inline bool must_be_preserved(oop obj_containing_mark) const;
inline bool must_be_preserved_with_bias(oop obj_containing_mark) const;
< prev index next >