inline oop oopDesc::obj_field_acquire(int offset) const { return UseCompressedOops ? decode_heap_oop((narrowOop) OrderAccess::load_acquire(obj_field_addr<narrowOop>(offset))) : decode_heap_oop((oop) OrderAccess::load_ptr_acquire(obj_field_addr<oop>(offset))); }
inline void MacroAssembler::load_heap_oop(Register d, RegisterOrConstant offs, Register s1) { if (UseCompressedOops) { lwz(d, offs, s1); decode_heap_oop(d); } else { ld(d, offs, s1); } }
inline klassOop oopDesc::klass_or_null() const volatile { // can be NULL in CMS if (UseCompressedOops) { return (klassOop)decode_heap_oop(_metadata._compressed_klass); } else { return _metadata._klass; } }
oop oopDesc::list_ptr_from_klass() { // This is only to be used during GC, for from-space objects. if (UseCompressedClassPointers) { return decode_heap_oop((narrowOop)_metadata._compressed_klass); } else { // Special case for GC return (oop)(address)_metadata._klass; } }
// These functions are only used to exchange oop fields in instances, // not headers. inline oop oopDesc::atomic_exchange_oop(oop exchange_value, volatile HeapWord *dest) { if (UseCompressedOops) { // encode exchange value from oop to T narrowOop val = encode_heap_oop(exchange_value); narrowOop old = (narrowOop)Atomic::xchg(val, (narrowOop*)dest); // decode old from T to oop return decode_heap_oop(old); } else { return (oop)Atomic::xchg_ptr(exchange_value, (oop*)dest); } }
inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) { assert(!is_null(v), "oop value can never be zero"); assert(check_obj_alignment(v), "Address not aligned"); assert(Universe::heap()->is_in_reserved(v), "Address not in heap"); address base = Universe::narrow_oop_base(); int shift = Universe::narrow_oop_shift(); uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1)); assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); uint64_t result = pd >> shift; assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow"); assert(decode_heap_oop(result) == v, "reversibility"); return (narrowOop)result; }
inline oop oopDesc::load_decode_heap_oop(narrowOop* p) { return decode_heap_oop(*p); }