< prev index next > src/hotspot/share/oops/oop.hpp
Print this page
#define SHARE_OOPS_OOP_HPP
#include "memory/iterator.hpp"
#include "memory/memRegion.hpp"
#include "oops/accessDecorators.hpp"
+ #include "oops/compressedKlass.hpp"
#include "oops/markWord.hpp"
#include "oops/metadata.hpp"
#include "runtime/atomic.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
class oopDesc {
friend class VMStructs;
friend class JVMCIVMStructs;
private:
volatile markWord _mark;
! union _metadata {
! Klass* _klass;
! narrowKlass _compressed_klass;
- } _metadata;
// There may be ordering constraints on the initialization of fields that
// make use of the C++ copy/assign incorrect.
NONCOPYABLE(oopDesc);
class oopDesc {
friend class VMStructs;
friend class JVMCIVMStructs;
private:
volatile markWord _mark;
! #ifndef _LP64
! Klass* _klass;
! #endif
// There may be ordering constraints on the initialization of fields that
// make use of the C++ copy/assign incorrect.
NONCOPYABLE(oopDesc);
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);
// Used only to re-initialize the mark word (e.g., of promoted
// objects during a GC) -- requires a valid klass pointer
inline Klass* klass() const;
inline Klass* klass_or_null() const;
inline Klass* klass_or_null_acquire() const;
! void set_narrow_klass(narrowKlass nk) NOT_CDS_JAVA_HEAP_RETURN;
inline void set_klass(Klass* k);
static inline void release_set_klass(HeapWord* mem, Klass* k);
!
- // For klass field compression
- static inline void set_klass_gap(HeapWord* mem, int z);
// size of object header, aligned to platform wordSize
static constexpr int header_size() { return sizeof(oopDesc)/HeapWordSize; }
// Returns whether this is an instance of k or an instance of a subclass of k
inline Klass* klass() const;
inline Klass* klass_or_null() const;
inline Klass* klass_or_null_acquire() const;
! #ifndef _LP64
inline void set_klass(Klass* k);
static inline void release_set_klass(HeapWord* mem, Klass* k);
! #endif
// size of object header, aligned to platform wordSize
static constexpr int header_size() { return sizeof(oopDesc)/HeapWordSize; }
// Returns whether this is an instance of k or an instance of a subclass of k
inline bool is_forwarded() const;
void verify_forwardee(oop forwardee) NOT_DEBUG_RETURN;
inline void forward_to(oop p);
+ 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();
// Checks if the mark word needs to be preserved
inline bool mark_must_be_preserved() const;
inline bool mark_must_be_preserved(markWord m) const;
- 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");
! return klass_offset_in_bytes() + sizeof(narrowKlass);
}
// 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
DEBUG_ONLY(bool get_UseParallelGC();)
DEBUG_ONLY(bool get_UseG1GC();)
};
// Checks if the mark word needs to be preserved
inline bool mark_must_be_preserved() const;
inline bool mark_must_be_preserved(markWord m) const;
// for code generation
static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); }
! static int klass_offset_in_bytes() {
! #ifdef _LP64
! STATIC_ASSERT(markWord::klass_shift % 8 == 0);
! return mark_offset_in_bytes() + markWord::klass_shift / 8;
+ #else
+ return offset_of(oopDesc, _klass);
+ #endif
}
// for error reporting
static void* load_klass_raw(oop obj);
static void* load_oop_raw(oop obj, int offset);
+ // Runtime entry
+ #ifdef _LP64
+ static narrowKlass load_nklass_runtime(oopDesc* o);
+ #endif
+
// Avoid include gc_globals.hpp in oop.inline.hpp
DEBUG_ONLY(bool get_UseParallelGC();)
DEBUG_ONLY(bool get_UseG1GC();)
};
< prev index next >