src/hotspot/share/oops/oop.inline.hpp
changeset 59247 56bf71d64d51
parent 59053 ba6c248cae19
child 59248 e92153ed8bdc
equal deleted inserted replaced
59246:fcad92f425c5 59247:56bf71d64d51
   108 Klass* oopDesc::klass_or_null_acquire() const volatile {
   108 Klass* oopDesc::klass_or_null_acquire() const volatile {
   109   if (UseCompressedClassPointers) {
   109   if (UseCompressedClassPointers) {
   110     // Workaround for non-const load_acquire parameter.
   110     // Workaround for non-const load_acquire parameter.
   111     const volatile narrowKlass* addr = &_metadata._compressed_klass;
   111     const volatile narrowKlass* addr = &_metadata._compressed_klass;
   112     volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr);
   112     volatile narrowKlass* xaddr = const_cast<volatile narrowKlass*>(addr);
   113     return CompressedKlassPointers::decode(OrderAccess::load_acquire(xaddr));
   113     return CompressedKlassPointers::decode(Atomic::load_acquire(xaddr));
   114   } else {
   114   } else {
   115     return OrderAccess::load_acquire(&_metadata._klass);
   115     return Atomic::load_acquire(&_metadata._klass);
   116   }
   116   }
   117 }
   117 }
   118 
   118 
   119 Klass** oopDesc::klass_addr(HeapWord* mem) {
   119 Klass** oopDesc::klass_addr(HeapWord* mem) {
   120   // Only used internally and with CMS and will not work with
   120   // Only used internally and with CMS and will not work with
   154 }
   154 }
   155 
   155 
   156 void oopDesc::release_set_klass(HeapWord* mem, Klass* klass) {
   156 void oopDesc::release_set_klass(HeapWord* mem, Klass* klass) {
   157   CHECK_SET_KLASS(klass);
   157   CHECK_SET_KLASS(klass);
   158   if (UseCompressedClassPointers) {
   158   if (UseCompressedClassPointers) {
   159     OrderAccess::release_store(compressed_klass_addr(mem),
   159     Atomic::release_store(compressed_klass_addr(mem),
   160                                CompressedKlassPointers::encode_not_null(klass));
   160                           CompressedKlassPointers::encode_not_null(klass));
   161   } else {
   161   } else {
   162     OrderAccess::release_store(klass_addr(mem), klass);
   162     Atomic::release_store(klass_addr(mem), klass);
   163   }
   163   }
   164 }
   164 }
   165 
   165 
   166 #undef CHECK_SET_KLASS
   166 #undef CHECK_SET_KLASS
   167 
   167 
   354 
   354 
   355 // Note that the forwardee is not the same thing as the displaced_mark.
   355 // Note that the forwardee is not the same thing as the displaced_mark.
   356 // The forwardee is used when copying during scavenge and mark-sweep.
   356 // The forwardee is used when copying during scavenge and mark-sweep.
   357 // It does need to clear the low two locking- and GC-related bits.
   357 // It does need to clear the low two locking- and GC-related bits.
   358 oop oopDesc::forwardee_acquire() const {
   358 oop oopDesc::forwardee_acquire() const {
   359   return (oop) OrderAccess::load_acquire(&_mark).decode_pointer();
   359   return (oop) Atomic::load_acquire(&_mark).decode_pointer();
   360 }
   360 }
   361 
   361 
   362 // The following method needs to be MT safe.
   362 // The following method needs to be MT safe.
   363 uint oopDesc::age() const {
   363 uint oopDesc::age() const {
   364   assert(!is_forwarded(), "Attempt to read age from forwarded mark");
   364   assert(!is_forwarded(), "Attempt to read age from forwarded mark");