46 class ScanClosure;
47 class FastScanClosure;
48 class FilteringClosure;
49 class BarrierSet;
50 class CMSIsAliveClosure;
51
52 class PSPromotionManager;
53 class ParCompactionManager;
54
55 class oopDesc {
56 friend class VMStructs;
57 friend class JVMCIVMStructs;
58 private:
59 volatile markOop _mark;
60 union _metadata {
61 Klass* _klass;
62 narrowKlass _compressed_klass;
63 } _metadata;
64
65 public:
66 markOop mark() const;
67 markOop* mark_addr() const;
68
69 void set_mark(volatile markOop m);
70
71 inline void release_set_mark(markOop m);
72 inline markOop cas_set_mark(markOop new_mark, markOop old_mark);
73
74 // Used only to re-initialize the mark word (e.g., of promoted
75 // objects during a GC) -- requires a valid klass pointer
76 inline void init_mark();
77
78 inline Klass* klass() const;
79 inline Klass* klass_or_null() const volatile;
80 inline Klass* klass_or_null_acquire() const volatile;
81 inline Klass** klass_addr();
82 inline narrowKlass* compressed_klass_addr();
83
84 inline void set_klass(Klass* k);
85 inline void release_set_klass(Klass* k);
86
87 // For klass field compression
88 inline int klass_gap() const;
89 inline void set_klass_gap(int z);
90 // For when the klass pointer is being used as a linked list "next" field.
91 inline void set_klass_to_list_ptr(oop k);
92 inline oop list_ptr_from_klass();
93
94 // size of object header, aligned to platform wordSize
95 static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
96
256 void print_value_on(outputStream* st) const; // Second level print.
257 void print_address_on(outputStream* st) const; // Address printing
258
259 // printing on default output stream
260 void print();
261 void print_value();
262 void print_address();
263
264 // return the print strings
265 char* print_string();
266 char* print_value_string();
267
268 // verification operations
269 void verify_on(outputStream* st);
270 void verify();
271
272 // locking operations
273 inline bool is_locked() const;
274 inline bool is_unlocked() const;
275 inline bool has_bias_pattern() const;
276
277 // asserts and guarantees
278 static bool is_oop(oop obj, bool ignore_mark_word = false);
279 static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
280 #ifndef PRODUCT
281 inline bool is_unlocked_oop() const;
282 #endif
283
284 // garbage collection
285 inline bool is_gc_marked() const;
286
287 // Forward pointer operations for scavenge
288 inline bool is_forwarded() const;
289
290 inline void forward_to(oop p);
291 inline bool cas_forward_to(oop p, markOop compare);
292
293 #if INCLUDE_ALL_GCS
294 // Like "forward_to", but inserts the forwarding pointer atomically.
295 // Exactly one thread succeeds in inserting the forwarding pointer, and
340 inline void oop_iterate_backwards(OopClosureType* blk);
341
342 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL)
343 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL)
344
345 #endif // INCLUDE_ALL_GCS
346
347 inline int oop_iterate_no_header(OopClosure* bk);
348 inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
349
350 // identity hash; returns the identity hash key (computes it if necessary)
351 // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a
352 // safepoint if called on a biased object. Calling code must be aware of that.
353 inline intptr_t identity_hash();
354 intptr_t slow_identity_hash();
355
356 // Alternate hashing code if string table is rehashed
357 unsigned int new_hash(juint seed);
358
359 // marks are forwarded to stack when object is locked
360 inline bool has_displaced_mark() const;
361 inline markOop displaced_mark() const;
362 inline void set_displaced_mark(markOop m);
363
364 static bool has_klass_gap();
365
366 // for code generation
367 static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); }
368 static int klass_offset_in_bytes() { return offset_of(oopDesc, _metadata._klass); }
369 static int klass_gap_offset_in_bytes() {
370 assert(has_klass_gap(), "only applicable to compressed klass pointers");
371 return klass_offset_in_bytes() + sizeof(narrowKlass);
372 }
373
374 static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
375 };
376
377 #endif // SHARE_VM_OOPS_OOP_HPP
|
46 class ScanClosure;
47 class FastScanClosure;
48 class FilteringClosure;
49 class BarrierSet;
50 class CMSIsAliveClosure;
51
52 class PSPromotionManager;
53 class ParCompactionManager;
54
55 class oopDesc {
56 friend class VMStructs;
57 friend class JVMCIVMStructs;
58 private:
59 volatile markOop _mark;
60 union _metadata {
61 Klass* _klass;
62 narrowKlass _compressed_klass;
63 } _metadata;
64
65 public:
66 inline markOop mark() const;
67 inline markOop mark_raw() const;
68 inline markOop* mark_addr_raw() const;
69
70 inline void set_mark(volatile markOop m);
71 inline void set_mark_raw(volatile markOop m);
72
73 inline void release_set_mark(markOop m);
74 inline markOop cas_set_mark(markOop new_mark, markOop old_mark);
75 inline markOop cas_set_mark_raw(markOop new_mark, markOop old_mark);
76
77 // Used only to re-initialize the mark word (e.g., of promoted
78 // objects during a GC) -- requires a valid klass pointer
79 inline void init_mark();
80 inline void init_mark_raw();
81
82 inline Klass* klass() const;
83 inline Klass* klass_or_null() const volatile;
84 inline Klass* klass_or_null_acquire() const volatile;
85 inline Klass** klass_addr();
86 inline narrowKlass* compressed_klass_addr();
87
88 inline void set_klass(Klass* k);
89 inline void release_set_klass(Klass* k);
90
91 // For klass field compression
92 inline int klass_gap() const;
93 inline void set_klass_gap(int z);
94 // For when the klass pointer is being used as a linked list "next" field.
95 inline void set_klass_to_list_ptr(oop k);
96 inline oop list_ptr_from_klass();
97
98 // size of object header, aligned to platform wordSize
99 static int header_size() { return sizeof(oopDesc)/HeapWordSize; }
100
260 void print_value_on(outputStream* st) const; // Second level print.
261 void print_address_on(outputStream* st) const; // Address printing
262
263 // printing on default output stream
264 void print();
265 void print_value();
266 void print_address();
267
268 // return the print strings
269 char* print_string();
270 char* print_value_string();
271
272 // verification operations
273 void verify_on(outputStream* st);
274 void verify();
275
276 // locking operations
277 inline bool is_locked() const;
278 inline bool is_unlocked() const;
279 inline bool has_bias_pattern() const;
280 inline bool has_bias_pattern_raw() const;
281
282 // asserts and guarantees
283 static bool is_oop(oop obj, bool ignore_mark_word = false);
284 static bool is_oop_or_null(oop obj, bool ignore_mark_word = false);
285 #ifndef PRODUCT
286 inline bool is_unlocked_oop() const;
287 #endif
288
289 // garbage collection
290 inline bool is_gc_marked() const;
291
292 // Forward pointer operations for scavenge
293 inline bool is_forwarded() const;
294
295 inline void forward_to(oop p);
296 inline bool cas_forward_to(oop p, markOop compare);
297
298 #if INCLUDE_ALL_GCS
299 // Like "forward_to", but inserts the forwarding pointer atomically.
300 // Exactly one thread succeeds in inserting the forwarding pointer, and
345 inline void oop_iterate_backwards(OopClosureType* blk);
346
347 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL)
348 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL)
349
350 #endif // INCLUDE_ALL_GCS
351
352 inline int oop_iterate_no_header(OopClosure* bk);
353 inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
354
355 // identity hash; returns the identity hash key (computes it if necessary)
356 // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a
357 // safepoint if called on a biased object. Calling code must be aware of that.
358 inline intptr_t identity_hash();
359 intptr_t slow_identity_hash();
360
361 // Alternate hashing code if string table is rehashed
362 unsigned int new_hash(juint seed);
363
364 // marks are forwarded to stack when object is locked
365 inline bool has_displaced_mark_raw() const;
366 inline markOop displaced_mark_raw() const;
367 inline void set_displaced_mark_raw(markOop m);
368
369 static bool has_klass_gap();
370
371 // for code generation
372 static int mark_offset_in_bytes() { return offset_of(oopDesc, _mark); }
373 static int klass_offset_in_bytes() { return offset_of(oopDesc, _metadata._klass); }
374 static int klass_gap_offset_in_bytes() {
375 assert(has_klass_gap(), "only applicable to compressed klass pointers");
376 return klass_offset_in_bytes() + sizeof(narrowKlass);
377 }
378
379 static bool is_archive_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
380 };
381
382 #endif // SHARE_VM_OOPS_OOP_HPP
|