< prev index next >

src/hotspot/share/oops/oop.inline.hpp

Print this page

 66   *(markWord*)(((char*)mem) + mark_offset_in_bytes()) = m;
 67 }
 68 
 69 void oopDesc::release_set_mark(HeapWord* mem, markWord m) {
 70   Atomic::release_store((markWord*)(((char*)mem) + mark_offset_in_bytes()), m);
 71 }
 72 
 73 void oopDesc::release_set_mark(markWord m) {
 74   Atomic::release_store(&_mark, m);
 75 }
 76 
 77 markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark) {
 78   return Atomic::cmpxchg(&_mark, old_mark, new_mark);
 79 }
 80 
 81 markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order) {
 82   return Atomic::cmpxchg(&_mark, old_mark, new_mark, order);
 83 }
 84 
 85 void oopDesc::init_mark() {
 86   set_mark(markWord::prototype());
 87 }
 88 
 89 Klass* oopDesc::klass() const {
 90   if (UseCompressedClassPointers) {
 91     return CompressedKlassPointers::decode_not_null(_metadata._compressed_klass);
 92   } else {
 93     return _metadata._klass;
 94   }
 95 }
 96 
 97 Klass* oopDesc::klass_or_null() const {
 98   if (UseCompressedClassPointers) {
 99     return CompressedKlassPointers::decode(_metadata._compressed_klass);
100   } else {
101     return _metadata._klass;
102   }
103 }
104 
105 Klass* oopDesc::klass_or_null_acquire() const {
106   if (UseCompressedClassPointers) {

192 
193       assert(s == klass->oop_size(this), "wrong array object size");
194     } else {
195       // Must be zero, so bite the bullet and take the virtual call.
196       s = klass->oop_size(this);
197     }
198   }
199 
200   assert(s > 0, "Oop size must be greater than zero, not " SIZE_FORMAT, s);
201   assert(is_object_aligned(s), "Oop size is not properly aligned: " SIZE_FORMAT, s);
202   return s;
203 }
204 
205 bool oopDesc::is_instance()    const { return klass()->is_instance_klass();             }
206 bool oopDesc::is_instanceRef() const { return klass()->is_reference_instance_klass();   }
207 bool oopDesc::is_stackChunk()  const { return klass()->is_stack_chunk_instance_klass(); }
208 bool oopDesc::is_array()       const { return klass()->is_array_klass();                }
209 bool oopDesc::is_objArray()    const { return klass()->is_objArray_klass();             }
210 bool oopDesc::is_typeArray()   const { return klass()->is_typeArray_klass();            }
211 















212 template<typename T>
213 T*       oopDesc::field_addr(int offset)     const { return reinterpret_cast<T*>(cast_from_oop<intptr_t>(as_oop()) + offset); }
214 
215 template <typename T>
216 size_t   oopDesc::field_offset(T* p) const { return pointer_delta((void*)p, (void*)this, 1); }
217 
218 template <DecoratorSet decorators>
219 inline oop  oopDesc::obj_field_access(int offset) const             { return HeapAccess<decorators>::oop_load_at(as_oop(), offset); }
220 inline oop  oopDesc::obj_field(int offset) const                    { return HeapAccess<>::oop_load_at(as_oop(), offset);  }
221 
222 inline void oopDesc::obj_field_put(int offset, oop value)           { HeapAccess<>::oop_store_at(as_oop(), offset, value); }
223 template <DecoratorSet decorators>
224 inline void oopDesc::obj_field_put_access(int offset, oop value)    { HeapAccess<decorators>::oop_store_at(as_oop(), offset, value); }
225 
226 inline jbyte oopDesc::byte_field(int offset) const                  { return *field_addr<jbyte>(offset);  }
227 inline void  oopDesc::byte_field_put(int offset, jbyte value)       { *field_addr<jbyte>(offset) = value; }
228 
229 inline jchar oopDesc::char_field(int offset) const                  { return *field_addr<jchar>(offset);  }
230 inline void  oopDesc::char_field_put(int offset, jchar value)       { *field_addr<jchar>(offset) = value; }
231 

 66   *(markWord*)(((char*)mem) + mark_offset_in_bytes()) = m;
 67 }
 68 
 69 void oopDesc::release_set_mark(HeapWord* mem, markWord m) {
 70   Atomic::release_store((markWord*)(((char*)mem) + mark_offset_in_bytes()), m);
 71 }
 72 
 73 void oopDesc::release_set_mark(markWord m) {
 74   Atomic::release_store(&_mark, m);
 75 }
 76 
 77 markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark) {
 78   return Atomic::cmpxchg(&_mark, old_mark, new_mark);
 79 }
 80 
 81 markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order) {
 82   return Atomic::cmpxchg(&_mark, old_mark, new_mark, order);
 83 }
 84 
 85 void oopDesc::init_mark() {
 86   set_mark(Klass::default_prototype_header(klass()));
 87 }
 88 
 89 Klass* oopDesc::klass() const {
 90   if (UseCompressedClassPointers) {
 91     return CompressedKlassPointers::decode_not_null(_metadata._compressed_klass);
 92   } else {
 93     return _metadata._klass;
 94   }
 95 }
 96 
 97 Klass* oopDesc::klass_or_null() const {
 98   if (UseCompressedClassPointers) {
 99     return CompressedKlassPointers::decode(_metadata._compressed_klass);
100   } else {
101     return _metadata._klass;
102   }
103 }
104 
105 Klass* oopDesc::klass_or_null_acquire() const {
106   if (UseCompressedClassPointers) {

192 
193       assert(s == klass->oop_size(this), "wrong array object size");
194     } else {
195       // Must be zero, so bite the bullet and take the virtual call.
196       s = klass->oop_size(this);
197     }
198   }
199 
200   assert(s > 0, "Oop size must be greater than zero, not " SIZE_FORMAT, s);
201   assert(is_object_aligned(s), "Oop size is not properly aligned: " SIZE_FORMAT, s);
202   return s;
203 }
204 
205 bool oopDesc::is_instance()    const { return klass()->is_instance_klass();             }
206 bool oopDesc::is_instanceRef() const { return klass()->is_reference_instance_klass();   }
207 bool oopDesc::is_stackChunk()  const { return klass()->is_stack_chunk_instance_klass(); }
208 bool oopDesc::is_array()       const { return klass()->is_array_klass();                }
209 bool oopDesc::is_objArray()    const { return klass()->is_objArray_klass();             }
210 bool oopDesc::is_typeArray()   const { return klass()->is_typeArray_klass();            }
211 
212 bool oopDesc::is_inline_type() const { return mark().is_inline_type(); }
213 #ifdef _LP64
214 bool oopDesc::is_flatArray() const {
215   markWord mrk = mark();
216   return (mrk.is_unlocked()) ? mrk.is_flat_array() : klass()->is_flatArray_klass();
217 }
218 bool oopDesc::is_null_free_array() const {
219   markWord mrk = mark();
220   return (mrk.is_unlocked()) ? mrk.is_null_free_array() : klass()->is_null_free_array_klass();
221 }
222 #else
223 bool oopDesc::is_flatArray()       const { return klass()->is_flatArray_klass(); }
224 bool oopDesc::is_null_free_array() const { return klass()->is_null_free_array_klass(); }
225 #endif
226 
227 template<typename T>
228 T*       oopDesc::field_addr(int offset)     const { return reinterpret_cast<T*>(cast_from_oop<intptr_t>(as_oop()) + offset); }
229 
230 template <typename T>
231 size_t   oopDesc::field_offset(T* p) const { return pointer_delta((void*)p, (void*)this, 1); }
232 
233 template <DecoratorSet decorators>
234 inline oop  oopDesc::obj_field_access(int offset) const             { return HeapAccess<decorators>::oop_load_at(as_oop(), offset); }
235 inline oop  oopDesc::obj_field(int offset) const                    { return HeapAccess<>::oop_load_at(as_oop(), offset);  }
236 
237 inline void oopDesc::obj_field_put(int offset, oop value)           { HeapAccess<>::oop_store_at(as_oop(), offset, value); }
238 template <DecoratorSet decorators>
239 inline void oopDesc::obj_field_put_access(int offset, oop value)    { HeapAccess<decorators>::oop_store_at(as_oop(), offset, value); }
240 
241 inline jbyte oopDesc::byte_field(int offset) const                  { return *field_addr<jbyte>(offset);  }
242 inline void  oopDesc::byte_field_put(int offset, jbyte value)       { *field_addr<jbyte>(offset) = value; }
243 
244 inline jchar oopDesc::char_field(int offset) const                  { return *field_addr<jchar>(offset);  }
245 inline void  oopDesc::char_field_put(int offset, jchar value)       { *field_addr<jchar>(offset) = value; }
246 
< prev index next >