< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page

 84 
 85   inline Klass* klass() const;
 86   inline Klass* klass_or_null() const;
 87   inline Klass* klass_or_null_acquire() const;
 88 
 89   void set_narrow_klass(narrowKlass nk) NOT_CDS_JAVA_HEAP_RETURN;
 90   inline void set_klass(Klass* k);
 91   static inline void release_set_klass(HeapWord* mem, Klass* k);
 92 
 93   // For klass field compression
 94   inline int klass_gap() const;
 95   inline void set_klass_gap(int z);
 96   static inline void set_klass_gap(HeapWord* mem, int z);
 97 
 98   // size of object header, aligned to platform wordSize
 99   static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
100 
101   // Returns whether this is an instance of k or an instance of a subclass of k
102   inline bool is_a(Klass* k) const;
103 
104   // Returns the actual oop size of the object
105   inline int size();




106 
107   // Sometimes (for complicated concurrency-related reasons), it is useful
108   // to be able to figure out the size of an object knowing its klass.
109   inline int size_given_klass(Klass* klass);














110 
111   // type test operations (inlined in oop.inline.hpp)
112   inline bool is_instance()            const;
113   inline bool is_array()               const;
114   inline bool is_objArray()            const;
115   inline bool is_typeArray()           const;

116 
117   // type test operations that don't require inclusion of oop.inline.hpp.
118   bool is_instance_noinline()          const;
119   bool is_array_noinline()             const;
120   bool is_objArray_noinline()          const;
121   bool is_typeArray_noinline()         const;

122 
123  protected:
124   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
125 
126  public:
127   template<typename T>
128   inline T* field_addr(int offset) const;
129 
130   template <typename T> inline size_t field_offset(T* p) const;
131 
132   // Standard compare function returns negative value if o1 < o2
133   //                                   0              if o1 == o2
134   //                                   positive value if o1 > o2
135   inline static int  compare(oop o1, oop o2) {
136     void* o1_addr = (void*)o1;
137     void* o2_addr = (void*)o2;
138     if (o1_addr < o2_addr) {
139       return -1;
140     } else if (o1_addr > o2_addr) {
141       return 1;

295   inline void     set_displaced_mark(markWord m);
296 
297   // Checks if the mark word needs to be preserved
298   inline bool mark_must_be_preserved() const;
299   inline bool mark_must_be_preserved(markWord m) const;
300 
301   static bool has_klass_gap();
302 
303   // for code generation
304   static int mark_offset_in_bytes()      { return offset_of(oopDesc, _mark); }
305   static int klass_offset_in_bytes()     { return offset_of(oopDesc, _metadata._klass); }
306   static int klass_gap_offset_in_bytes() {
307     assert(has_klass_gap(), "only applicable to compressed klass pointers");
308     return klass_offset_in_bytes() + sizeof(narrowKlass);
309   }
310 
311   // for error reporting
312   static void* load_klass_raw(oop obj);
313   static void* load_oop_raw(oop obj, int offset);
314 
315   // Avoid include gc_globals.hpp in oop.inline.hpp
316   DEBUG_ONLY(bool get_UseParallelGC();)
317   DEBUG_ONLY(bool get_UseG1GC();)
318 };
319 
320 // An oopDesc is not initialized via a constructor.  Space is allocated in
321 // the Java heap, and static functions provided here on HeapWord* are used
322 // to fill in certain parts of that memory.  The allocated memory is then
323 // treated as referring to an oopDesc.  For that to be valid, the oopDesc
324 // class must have a trivial default constructor (C++14 3.8/1).
325 static_assert(std::is_trivially_default_constructible<oopDesc>::value, "required");
326 
327 #endif // SHARE_OOPS_OOP_HPP

 84 
 85   inline Klass* klass() const;
 86   inline Klass* klass_or_null() const;
 87   inline Klass* klass_or_null_acquire() const;
 88 
 89   void set_narrow_klass(narrowKlass nk) NOT_CDS_JAVA_HEAP_RETURN;
 90   inline void set_klass(Klass* k);
 91   static inline void release_set_klass(HeapWord* mem, Klass* k);
 92 
 93   // For klass field compression
 94   inline int klass_gap() const;
 95   inline void set_klass_gap(int z);
 96   static inline void set_klass_gap(HeapWord* mem, int z);
 97 
 98   // size of object header, aligned to platform wordSize
 99   static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
100 
101   // Returns whether this is an instance of k or an instance of a subclass of k
102   inline bool is_a(Klass* k) const;
103 
104   // Returns the actual oop size of the object in machine words
105   inline int size();
106   // Returns the size of the object after possible compression during GC promotion/compaction
107   inline int compact_size();
108   // Returns the given size in the common case where there is no special compact size
109   inline int compact_size(int size);
110 
111   // Sometimes (for complicated concurrency-related reasons), it is useful
112   // to be able to figure out the size of an object knowing its klass.
113   inline int size_given_klass(Klass* klass);
114   // Returns the size of the object after possible compression during GC promotion/compaction
115   inline int compact_size_given_klass(Klass* klass);
116   // Returns the given size in the common case where there is no special compact size
117   inline int compact_size_given_klass(Klass* klass, int size);
118 
119   // Copies the object
120   inline size_t copy_disjoint(HeapWord* to);
121   inline size_t copy_conjoint(HeapWord* to);
122   inline size_t copy_disjoint_compact(HeapWord* to);
123   inline size_t copy_conjoint_compact(HeapWord* to);
124   inline size_t copy_disjoint(HeapWord* to, size_t word_size);
125   inline size_t copy_disjoint_compact(HeapWord* to, size_t word_size);
126   inline size_t copy_conjoint(HeapWord* to, size_t word_size);
127   inline size_t copy_conjoint_compact(HeapWord* to, size_t word_size);
128 
129   // type test operations (inlined in oop.inline.hpp)
130   inline bool is_instance()            const;
131   inline bool is_array()               const;
132   inline bool is_objArray()            const;
133   inline bool is_typeArray()           const;
134   inline bool is_stackChunk()          const;
135 
136   // type test operations that don't require inclusion of oop.inline.hpp.
137   bool is_instance_noinline()          const;
138   bool is_array_noinline()             const;
139   bool is_objArray_noinline()          const;
140   bool is_typeArray_noinline()         const;
141   bool is_stackChunk_noinline()        const;
142 
143  protected:
144   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
145 
146  public:
147   template<typename T>
148   inline T* field_addr(int offset) const;
149 
150   template <typename T> inline size_t field_offset(T* p) const;
151 
152   // Standard compare function returns negative value if o1 < o2
153   //                                   0              if o1 == o2
154   //                                   positive value if o1 > o2
155   inline static int  compare(oop o1, oop o2) {
156     void* o1_addr = (void*)o1;
157     void* o2_addr = (void*)o2;
158     if (o1_addr < o2_addr) {
159       return -1;
160     } else if (o1_addr > o2_addr) {
161       return 1;

315   inline void     set_displaced_mark(markWord m);
316 
317   // Checks if the mark word needs to be preserved
318   inline bool mark_must_be_preserved() const;
319   inline bool mark_must_be_preserved(markWord m) const;
320 
321   static bool has_klass_gap();
322 
323   // for code generation
324   static int mark_offset_in_bytes()      { return offset_of(oopDesc, _mark); }
325   static int klass_offset_in_bytes()     { return offset_of(oopDesc, _metadata._klass); }
326   static int klass_gap_offset_in_bytes() {
327     assert(has_klass_gap(), "only applicable to compressed klass pointers");
328     return klass_offset_in_bytes() + sizeof(narrowKlass);
329   }
330 
331   // for error reporting
332   static void* load_klass_raw(oop obj);
333   static void* load_oop_raw(oop obj, int offset);
334 
335   DEBUG_ONLY(bool size_might_change();)


336 };
337 
338 // An oopDesc is not initialized via a constructor.  Space is allocated in
339 // the Java heap, and static functions provided here on HeapWord* are used
340 // to fill in certain parts of that memory.  The allocated memory is then
341 // treated as referring to an oopDesc.  For that to be valid, the oopDesc
342 // class must have a trivial default constructor (C++14 3.8/1).
343 static_assert(std::is_trivially_default_constructible<oopDesc>::value, "required");
344 
345 #endif // SHARE_OOPS_OOP_HPP
< prev index next >