< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page
@@ -26,10 +26,11 @@
  #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"

@@ -73,13 +74,16 @@
  
    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;
+ 
    // 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;

@@ -94,11 +98,18 @@
  
    // 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; }
+   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 in machine words

@@ -256,18 +267,21 @@
  
    // Forward pointer operations for scavenge
    inline bool is_forwarded() const;
  
    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();
  

@@ -307,16 +321,40 @@
  
    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);
  
    DEBUG_ONLY(bool size_might_change();)
< prev index next >