< prev index next > src/hotspot/share/oops/oop.hpp
Print this page
union _metadata {
Klass* _klass;
narrowKlass _compressed_klass;
} _metadata;
- public:
+ public:
inline markWord mark() const;
inline markWord mark_acquire() const;
inline markWord* mark_addr() const;
inline void set_mark(markWord m);
static inline void set_mark(HeapWord* mem, markWord m);
inline void release_set_mark(markWord m);
+ static inline void release_set_mark(HeapWord* mem, markWord m);
inline markWord cas_set_mark(markWord new_mark, markWord old_mark);
inline markWord cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order);
+ inline markWord resolve_mark() const;
+
+ // Returns the prototype mark that should be used for this object.
+ inline markWord prototype_mark() const;
+
// Used only to re-initialize the mark word (e.g., of promoted
// objects during a GC) -- requires a valid klass pointer
inline void init_mark();
inline Klass* klass() const;
inline int klass_gap() const;
inline void set_klass_gap(int z);
static inline void set_klass_gap(HeapWord* mem, int z);
// size of object header, aligned to platform wordSize
- static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
+ static int header_size() {
+ #ifdef _LP64
+ if (UseCompactObjectHeaders) {
+ return sizeof(markWord) / HeapWordSize;
+ } else
+ #endif
+ return sizeof(oopDesc)/HeapWordSize;
+ }
// Returns whether this is an instance of k or an instance of a subclass of k
inline bool is_a(Klass* k) const;
// Returns the actual oop size of the object
// Sometimes (for complicated concurrency-related reasons), it is useful
// to be able to figure out the size of an object knowing its klass.
inline int size_given_klass(Klass* klass);
+ // The following set of methods is used to access the mark-word and related
+ // properties when the object may be forwarded. Be careful where and when
+ // using this method. It assumes that the forwardee is installed in
+ // the header as a plain pointer (or self-forwarded). In particular,
+ // those methods can not deal with the sliding-forwarding that is used
+ // in Serial, G1 and Shenandoah full-GCs.
+ private:
+ inline Klass* forward_safe_klass_impl(markWord m) const;
+ public:
+ inline Klass* forward_safe_klass() const;
+ inline size_t forward_safe_size();
+ inline Klass* forward_safe_klass(markWord m) const;
+ inline void forward_safe_init_mark();
+
// type test operations (inlined in oop.inline.hpp)
inline bool is_instance() const;
inline bool is_array() const;
inline bool is_objArray() const;
inline bool is_typeArray() const;
inline bool is_forwarded() const;
void verify_forwardee(oop forwardee) NOT_DEBUG_RETURN;
inline void forward_to(oop p);
- inline bool cas_forward_to(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);
+ inline void forward_to_self();
// Like "forward_to", but inserts the forwarding pointer atomically.
// Exactly one thread succeeds in inserting the forwarding pointer, and
// this call returns "NULL" for that thread; any other thread has the
// value of the forwarding pointer returned and does not modify "this".
inline oop forward_to_atomic(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);
+ inline oop forward_to_self_atomic(markWord compare, atomic_memory_order order = memory_order_conservative);
inline oop forwardee() const;
+ inline oop forwardee(markWord header) const;
// Age of object during scavenge
inline uint age() const;
inline void incr_age();
static bool has_klass_gap();
// for code generation
static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); }
- static int klass_offset_in_bytes() { return offset_of(oopDesc, _metadata._klass); }
static int klass_gap_offset_in_bytes() {
assert(has_klass_gap(), "only applicable to compressed klass pointers");
+ assert(!UseCompactObjectHeaders, "don't use klass_offset_in_bytes() with compact headers");
return klass_offset_in_bytes() + sizeof(narrowKlass);
}
+ static int klass_offset_in_bytes() {
+ #ifdef _LP64
+ if (UseCompactObjectHeaders) {
+ STATIC_ASSERT(markWord::klass_shift % 8 == 0);
+ return mark_offset_in_bytes() + markWord::klass_shift / 8;
+ } else
+ #endif
+ return offset_of(oopDesc, _metadata._klass);
+ }
+
+ static int base_offset_in_bytes() {
+ #ifdef _LP64
+ if (UseCompactObjectHeaders) {
+ // With compact headers, the Klass* field is not used for the Klass*
+ // and is used for the object fields instead.
+ assert(sizeof(markWord) == 8, "sanity");
+ return sizeof(markWord);
+ } else if (UseCompressedClassPointers) {
+ return sizeof(markWord) + sizeof(narrowKlass);
+ } else
+ #endif
+ return sizeof(oopDesc);
+ }
+
// for error reporting
static void* load_klass_raw(oop obj);
static void* load_oop_raw(oop obj, int offset);
// Avoid include gc_globals.hpp in oop.inline.hpp
< prev index next >