< prev index next >

src/hotspot/share/oops/oop.hpp

Print this page




 110   inline bool is_objArray()            const;
 111   inline bool is_typeArray()           const;
 112 
 113   // type test operations that don't require inclusion of oop.inline.hpp.
 114   bool is_instance_noinline()          const;
 115   bool is_array_noinline()             const;
 116   bool is_objArray_noinline()          const;
 117   bool is_typeArray_noinline()         const;
 118 
 119  protected:
 120   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
 121 
 122  public:
 123   // field addresses in oop
 124   inline void* field_addr(int offset)     const;
 125   inline void* field_addr_raw(int offset) const;
 126 
 127   // Need this as public for garbage collection.
 128   template <class T> inline T* obj_field_addr_raw(int offset) const;
 129 
 130   inline static bool is_null(oop obj)       { return obj == NULL; }
 131   inline static bool is_null(narrowOop obj) { return obj == 0; }
 132 
 133   // Standard compare function returns negative value if o1 < o2
 134   //                                   0              if o1 == o2
 135   //                                   positive value if o1 > o2
 136   inline static int  compare(oop o1, oop o2) {
 137     void* o1_addr = (void*)o1;
 138     void* o2_addr = (void*)o2;
 139     if (o1_addr < o2_addr) {
 140       return -1;
 141     } else if (o1_addr > o2_addr) {
 142       return 1;
 143     } else {
 144       return 0;
 145     }
 146   }
 147 
 148   // Decode an oop pointer from a narrowOop if compressed.
 149   // These are overloaded for oop and narrowOop as are the other functions
 150   // below so that they can be called in template functions.
 151   static inline oop decode_heap_oop_not_null(oop v) { return v; }
 152   static inline oop decode_heap_oop_not_null(narrowOop v);
 153   static inline oop decode_heap_oop(oop v) { return v; }
 154   static inline oop decode_heap_oop(narrowOop v);
 155 
 156   // Encode an oop pointer to a narrow oop. The or_null versions accept
 157   // null oop pointer, others do not in order to eliminate the
 158   // null checking branches.
 159   static inline narrowOop encode_heap_oop_not_null(oop v);
 160   static inline narrowOop encode_heap_oop(oop v);
 161 
 162   // Load an oop out of the Java heap as is without decoding.
 163   // Called by GC to check for null before decoding.
 164   static inline narrowOop load_heap_oop(narrowOop* p);
 165   static inline oop       load_heap_oop(oop* p);
 166 
 167   // Load an oop out of Java heap and decode it to an uncompressed oop.
 168   static inline oop load_decode_heap_oop_not_null(narrowOop* p);
 169   static inline oop load_decode_heap_oop_not_null(oop* p);
 170   static inline oop load_decode_heap_oop(narrowOop* p);
 171   static inline oop load_decode_heap_oop(oop* p);
 172 
 173   // Store already encoded heap oop into the heap.
 174   static inline void store_heap_oop(narrowOop* p, narrowOop v);
 175   static inline void store_heap_oop(oop* p, oop v);
 176 
 177   // Encode oop if UseCompressedOops and store into the heap.
 178   static inline void encode_store_heap_oop_not_null(narrowOop* p, oop v);
 179   static inline void encode_store_heap_oop_not_null(oop* p, oop v);
 180   static inline void encode_store_heap_oop(narrowOop* p, oop v);
 181   static inline void encode_store_heap_oop(oop* p, oop v);
 182 
 183   // Access to fields in a instanceOop through these methods.
 184   template <DecoratorSet decorator>
 185   oop obj_field_access(int offset) const;
 186   oop obj_field(int offset) const;
 187   void obj_field_put(int offset, oop value);
 188   void obj_field_put_raw(int offset, oop value);
 189   void obj_field_put_volatile(int offset, oop value);
 190 
 191   Metadata* metadata_field(int offset) const;
 192   void metadata_field_put(int offset, Metadata* value);
 193 
 194   Metadata* metadata_field_acquire(int offset) const;
 195   void release_metadata_field_put(int offset, Metadata* value);
 196 
 197   jbyte byte_field(int offset) const;
 198   void byte_field_put(int offset, jbyte contents);
 199 
 200   jchar char_field(int offset) const;
 201   void char_field_put(int offset, jchar contents);
 202 


 329 #define OOP_ITERATE_SIZE_DECL(OopClosureType, nv_suffix)                \
 330   inline int oop_iterate_size(OopClosureType* blk);                     \
 331   inline int oop_iterate_size(OopClosureType* blk, MemRegion mr);  // Only in mr.
 332 
 333   ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_SIZE_DECL)
 334   ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_SIZE_DECL)
 335 
 336 
 337 #if INCLUDE_ALL_GCS
 338 
 339 #define OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix)  \
 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); }


 110   inline bool is_objArray()            const;
 111   inline bool is_typeArray()           const;
 112 
 113   // type test operations that don't require inclusion of oop.inline.hpp.
 114   bool is_instance_noinline()          const;
 115   bool is_array_noinline()             const;
 116   bool is_objArray_noinline()          const;
 117   bool is_typeArray_noinline()         const;
 118 
 119  protected:
 120   inline oop        as_oop() const { return const_cast<oopDesc*>(this); }
 121 
 122  public:
 123   // field addresses in oop
 124   inline void* field_addr(int offset)     const;
 125   inline void* field_addr_raw(int offset) const;
 126 
 127   // Need this as public for garbage collection.
 128   template <class T> inline T* obj_field_addr_raw(int offset) const;
 129 



 130   // Standard compare function returns negative value if o1 < o2
 131   //                                   0              if o1 == o2
 132   //                                   positive value if o1 > o2
 133   inline static int  compare(oop o1, oop o2) {
 134     void* o1_addr = (void*)o1;
 135     void* o2_addr = (void*)o2;
 136     if (o1_addr < o2_addr) {
 137       return -1;
 138     } else if (o1_addr > o2_addr) {
 139       return 1;
 140     } else {
 141       return 0;
 142     }
 143   }
 144 



































 145   // Access to fields in a instanceOop through these methods.
 146   template <DecoratorSet decorator>
 147   oop obj_field_access(int offset) const;
 148   oop obj_field(int offset) const;
 149   void obj_field_put(int offset, oop value);
 150   void obj_field_put_raw(int offset, oop value);
 151   void obj_field_put_volatile(int offset, oop value);
 152 
 153   Metadata* metadata_field(int offset) const;
 154   void metadata_field_put(int offset, Metadata* value);
 155 
 156   Metadata* metadata_field_acquire(int offset) const;
 157   void release_metadata_field_put(int offset, Metadata* value);
 158 
 159   jbyte byte_field(int offset) const;
 160   void byte_field_put(int offset, jbyte contents);
 161 
 162   jchar char_field(int offset) const;
 163   void char_field_put(int offset, jchar contents);
 164 


 291 #define OOP_ITERATE_SIZE_DECL(OopClosureType, nv_suffix)                \
 292   inline int oop_iterate_size(OopClosureType* blk);                     \
 293   inline int oop_iterate_size(OopClosureType* blk, MemRegion mr);  // Only in mr.
 294 
 295   ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_SIZE_DECL)
 296   ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_SIZE_DECL)
 297 
 298 
 299 #if INCLUDE_ALL_GCS
 300 
 301 #define OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix)  \
 302   inline void oop_iterate_backwards(OopClosureType* blk);
 303 
 304   ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL)
 305   ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL)
 306 
 307 #endif // INCLUDE_ALL_GCS
 308 
 309   inline int oop_iterate_no_header(OopClosure* bk);
 310   inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
 311 
 312   inline static bool is_instanceof_or_null(oop obj, Klass* klass);
 313 
 314   // identity hash; returns the identity hash key (computes it if necessary)
 315   // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a
 316   // safepoint if called on a biased object. Calling code must be aware of that.
 317   inline intptr_t identity_hash();
 318   intptr_t slow_identity_hash();
 319 
 320   // Alternate hashing code if string table is rehashed
 321   unsigned int new_hash(juint seed);
 322 
 323   // marks are forwarded to stack when object is locked
 324   inline bool    has_displaced_mark() const;
 325   inline markOop displaced_mark() const;
 326   inline void    set_displaced_mark(markOop m);
 327 
 328   static bool has_klass_gap();
 329 
 330   // for code generation
 331   static int mark_offset_in_bytes()      { return offset_of(oopDesc, _mark); }
 332   static int klass_offset_in_bytes()     { return offset_of(oopDesc, _metadata._klass); }
< prev index next >