< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page
rev 47400 : [mq]: cmpxchg_ptr
rev 47406 : [mq]: assembler_cmpxchg

*** 89,120 **** // Read once. volatile Bytecodes::Code c = bytecode_1(); assert(c == 0 || c == code || code == 0, "update must be consistent"); #endif // Need to flush pending stores here before bytecode is written. ! OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << bytecode_1_shift)); } void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) { #ifdef ASSERT // Read once. volatile Bytecodes::Code c = bytecode_2(); assert(c == 0 || c == code || code == 0, "update must be consistent"); #endif // Need to flush pending stores here before bytecode is written. ! OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << bytecode_2_shift)); } // Sets f1, ordering with previous writes. void ConstantPoolCacheEntry::release_set_f1(Metadata* f1) { assert(f1 != NULL, ""); ! OrderAccess::release_store_ptr((HeapWord*) &_f1, f1); } // Sets flags, but only if the value was previously zero. bool ConstantPoolCacheEntry::init_flags_atomic(intptr_t flags) { ! intptr_t result = Atomic::cmpxchg_ptr(flags, &_flags, 0); return (result == 0); } // Note that concurrent update of both bytecodes can leave one of them // reset to zero. This is harmless; the interpreter will simply re-resolve --- 89,120 ---- // Read once. volatile Bytecodes::Code c = bytecode_1(); assert(c == 0 || c == code || code == 0, "update must be consistent"); #endif // Need to flush pending stores here before bytecode is written. ! OrderAccess::release_store(&_indices, _indices | ((u_char)code << bytecode_1_shift)); } void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) { #ifdef ASSERT // Read once. volatile Bytecodes::Code c = bytecode_2(); assert(c == 0 || c == code || code == 0, "update must be consistent"); #endif // Need to flush pending stores here before bytecode is written. ! OrderAccess::release_store(&_indices, _indices | ((u_char)code << bytecode_2_shift)); } // Sets f1, ordering with previous writes. void ConstantPoolCacheEntry::release_set_f1(Metadata* f1) { assert(f1 != NULL, ""); ! OrderAccess::release_store(&_f1, f1); } // Sets flags, but only if the value was previously zero. bool ConstantPoolCacheEntry::init_flags_atomic(intptr_t flags) { ! intptr_t result = Atomic::cmpxchg(flags, &_flags, (intptr_t)0); return (result == 0); } // Note that concurrent update of both bytecodes can leave one of them // reset to zero. This is harmless; the interpreter will simply re-resolve
*** 152,162 **** // current value of _flags is 0, otherwise another thread may have // updated it and we don't want to overwrite that value. Don't // bother trying to update it once it's nonzero but always make // sure that the final parameter size agrees with what was passed. if (_flags == 0) { ! Atomic::cmpxchg_ptr((value & parameter_size_mask), &_flags, 0); } guarantee(parameter_size() == value, "size must not change: parameter_size=%d, value=%d", parameter_size(), value); } --- 152,163 ---- // current value of _flags is 0, otherwise another thread may have // updated it and we don't want to overwrite that value. Don't // bother trying to update it once it's nonzero but always make // sure that the final parameter size agrees with what was passed. if (_flags == 0) { ! intx newflags = (value & parameter_size_mask); ! Atomic::cmpxchg(newflags, &_flags, (intx)0); } guarantee(parameter_size() == value, "size must not change: parameter_size=%d, value=%d", parameter_size(), value); }
< prev index next >