< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page

 69 
 70   inline markWord  mark()          const;
 71   inline markWord  mark_acquire()  const;
 72   inline markWord* mark_addr() const;
 73 
 74   inline void set_mark(markWord m);
 75   static inline void set_mark(HeapWord* mem, markWord m);
 76 
 77   inline void release_set_mark(markWord m);
 78   inline markWord cas_set_mark(markWord new_mark, markWord old_mark);
 79   inline markWord cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order);
 80 
 81   // Used only to re-initialize the mark word (e.g., of promoted
 82   // objects during a GC) -- requires a valid klass pointer
 83   inline void init_mark();
 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 size_t 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.

235   static void verify_on(outputStream* st, oopDesc* oop_desc);
236   static void verify(oopDesc* oopDesc);
237 
238   // locking operations
239   inline bool is_locked()   const;
240   inline bool is_unlocked() const;
241 
242   // asserts and guarantees
243   static bool is_oop(oop obj, bool ignore_mark_word = false);
244   static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
245 
246   // garbage collection
247   inline bool is_gc_marked() const;
248 
249   // Forward pointer operations for scavenge
250   inline bool is_forwarded() const;
251 
252   void verify_forwardee(oop forwardee) NOT_DEBUG_RETURN;
253 
254   inline void forward_to(oop p);

255 
256   // Like "forward_to", but inserts the forwarding pointer atomically.
257   // Exactly one thread succeeds in inserting the forwarding pointer, and
258   // this call returns "NULL" for that thread; any other thread has the
259   // value of the forwarding pointer returned and does not modify "this".
260   inline oop forward_to_atomic(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);

261 
262   inline oop forwardee() const;

263 
264   // Age of object during scavenge
265   inline uint age() const;
266   inline void incr_age();
267 
268   template <typename OopClosureType>
269   inline void oop_iterate(OopClosureType* cl);
270 
271   template <typename OopClosureType>
272   inline void oop_iterate(OopClosureType* cl, MemRegion mr);
273 
274   template <typename OopClosureType>
275   inline size_t oop_iterate_size(OopClosureType* cl);
276 
277   template <typename OopClosureType>
278   inline size_t oop_iterate_size(OopClosureType* cl, MemRegion mr);
279 
280   template <typename OopClosureType>
281   inline void oop_iterate_backwards(OopClosureType* cl);
282 

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

 69 
 70   inline markWord  mark()          const;
 71   inline markWord  mark_acquire()  const;
 72   inline markWord* mark_addr() const;
 73 
 74   inline void set_mark(markWord m);
 75   static inline void set_mark(HeapWord* mem, markWord m);
 76 
 77   inline void release_set_mark(markWord m);
 78   inline markWord cas_set_mark(markWord new_mark, markWord old_mark);
 79   inline markWord cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order);
 80 
 81   // Used only to re-initialize the mark word (e.g., of promoted
 82   // objects during a GC) -- requires a valid klass pointer
 83   inline void init_mark();
 84 
 85   inline Klass* klass() const;
 86   inline Klass* klass_or_null() const;
 87   inline Klass* klass_or_null_acquire() const;
 88 
 89   narrowKlass narrow_klass_legacy() const { return _metadata._compressed_klass; }
 90   void set_narrow_klass(narrowKlass nk) NOT_CDS_JAVA_HEAP_RETURN;
 91   inline void set_klass(Klass* k);
 92   static inline void release_set_klass(HeapWord* mem, Klass* k);
 93 
 94   // For klass field compression
 95   inline int klass_gap() const;
 96   inline void set_klass_gap(int z);
 97   static inline void set_klass_gap(HeapWord* mem, int z);
 98 
 99   // size of object header, aligned to platform wordSize
100   static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
101 
102   // Returns whether this is an instance of k or an instance of a subclass of k
103   inline bool is_a(Klass* k) const;
104 
105   // Returns the actual oop size of the object
106   inline size_t size();
107 
108   // Sometimes (for complicated concurrency-related reasons), it is useful
109   // to be able to figure out the size of an object knowing its klass.

236   static void verify_on(outputStream* st, oopDesc* oop_desc);
237   static void verify(oopDesc* oopDesc);
238 
239   // locking operations
240   inline bool is_locked()   const;
241   inline bool is_unlocked() const;
242 
243   // asserts and guarantees
244   static bool is_oop(oop obj, bool ignore_mark_word = false);
245   static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
246 
247   // garbage collection
248   inline bool is_gc_marked() const;
249 
250   // Forward pointer operations for scavenge
251   inline bool is_forwarded() const;
252 
253   void verify_forwardee(oop forwardee) NOT_DEBUG_RETURN;
254 
255   inline void forward_to(oop p);
256   inline void forward_to_self();
257 
258   // Like "forward_to", but inserts the forwarding pointer atomically.
259   // Exactly one thread succeeds in inserting the forwarding pointer, and
260   // this call returns "NULL" for that thread; any other thread has the
261   // value of the forwarding pointer returned and does not modify "this".
262   inline oop forward_to_atomic(oop p, markWord compare, atomic_memory_order order = memory_order_conservative);
263   inline oop forward_to_self_atomic(markWord compare, atomic_memory_order order = memory_order_conservative);
264 
265   inline oop forwardee() const;
266   inline oop forwardee(markWord header) const;
267 
268   // Age of object during scavenge
269   inline uint age() const;
270   inline void incr_age();
271 
272   template <typename OopClosureType>
273   inline void oop_iterate(OopClosureType* cl);
274 
275   template <typename OopClosureType>
276   inline void oop_iterate(OopClosureType* cl, MemRegion mr);
277 
278   template <typename OopClosureType>
279   inline size_t oop_iterate_size(OopClosureType* cl);
280 
281   template <typename OopClosureType>
282   inline size_t oop_iterate_size(OopClosureType* cl, MemRegion mr);
283 
284   template <typename OopClosureType>
285   inline void oop_iterate_backwards(OopClosureType* cl);
286 

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