< prev index next >

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

Print this page

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

179 
180       assert(s == klass->oop_size(this) || size_might_change(), "wrong array object size");
181     } else {
182       // Must be zero, so bite the bullet and take the virtual call.
183       s = klass->oop_size(this);
184     }
185   }
186 
187   assert(s > 0, "Oop size must be greater than zero, not " SIZE_FORMAT, s);
188   assert(is_object_aligned(s), "Oop size is not properly aligned: " SIZE_FORMAT, s);
189   return s;
190 }
191 
192 bool oopDesc::is_instance()    const { return klass()->is_instance_klass();             }
193 bool oopDesc::is_instanceRef() const { return klass()->is_reference_instance_klass();   }
194 bool oopDesc::is_stackChunk()  const { return klass()->is_stack_chunk_instance_klass(); }
195 bool oopDesc::is_array()       const { return klass()->is_array_klass();                }
196 bool oopDesc::is_objArray()    const { return klass()->is_objArray_klass();             }
197 bool oopDesc::is_typeArray()   const { return klass()->is_typeArray_klass();            }
198 















199 template<typename T>
200 T*       oopDesc::field_addr(int offset)     const { return reinterpret_cast<T*>(cast_from_oop<intptr_t>(as_oop()) + offset); }
201 
202 template <typename T>
203 size_t   oopDesc::field_offset(T* p) const { return pointer_delta((void*)p, (void*)this, 1); }
204 
205 template <DecoratorSet decorators>
206 inline oop  oopDesc::obj_field_access(int offset) const             { return HeapAccess<decorators>::oop_load_at(as_oop(), offset); }
207 inline oop  oopDesc::obj_field(int offset) const                    { return HeapAccess<>::oop_load_at(as_oop(), offset);  }
208 
209 inline void oopDesc::obj_field_put(int offset, oop value)           { HeapAccess<>::oop_store_at(as_oop(), offset, value); }
210 template <DecoratorSet decorators>
211 inline void oopDesc::obj_field_put_access(int offset, oop value)    { HeapAccess<decorators>::oop_store_at(as_oop(), offset, value); }
212 
213 inline jbyte oopDesc::byte_field(int offset) const                  { return *field_addr<jbyte>(offset);  }
214 inline void  oopDesc::byte_field_put(int offset, jbyte value)       { *field_addr<jbyte>(offset) = value; }
215 
216 inline jchar oopDesc::char_field(int offset) const                  { return *field_addr<jchar>(offset);  }
217 inline void  oopDesc::char_field_put(int offset, jchar value)       { *field_addr<jchar>(offset) = value; }
218 

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

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