< prev index next >
src/hotspot/share/services/memoryPool.cpp
Print this page
*** 80,90 ****
// It creates a MemoryPool instance when the first time
// this function is called.
instanceOop MemoryPool::get_memory_pool_instance(TRAPS) {
// Must do an acquire so as to force ordering of subsequent
// loads from anything _memory_pool_obj points to or implies.
! instanceOop pool_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_pool_obj);
if (pool_obj == NULL) {
// It's ok for more than one thread to execute the code up to the locked region.
// Extra pool instances will just be gc'ed.
InstanceKlass* ik = Management::sun_management_ManagementFactoryHelper_klass(CHECK_NULL);
--- 80,90 ----
// It creates a MemoryPool instance when the first time
// this function is called.
instanceOop MemoryPool::get_memory_pool_instance(TRAPS) {
// Must do an acquire so as to force ordering of subsequent
// loads from anything _memory_pool_obj points to or implies.
! instanceOop pool_obj = OrderAccess::load_acquire(&_memory_pool_obj);
if (pool_obj == NULL) {
// It's ok for more than one thread to execute the code up to the locked region.
// Extra pool instances will just be gc'ed.
InstanceKlass* ik = Management::sun_management_ManagementFactoryHelper_klass(CHECK_NULL);
*** 121,131 ****
// _memory_pool_obj here because some other thread may have
// initialized it while we were executing the code before the lock.
//
// The lock has done an acquire, so the load can't float above it,
// but we need to do a load_acquire as above.
! pool_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_pool_obj);
if (pool_obj != NULL) {
return pool_obj;
}
// Get the address of the object we created via call_special.
--- 121,131 ----
// _memory_pool_obj here because some other thread may have
// initialized it while we were executing the code before the lock.
//
// The lock has done an acquire, so the load can't float above it,
// but we need to do a load_acquire as above.
! pool_obj = OrderAccess::load_acquire(&_memory_pool_obj);
if (pool_obj != NULL) {
return pool_obj;
}
// Get the address of the object we created via call_special.
*** 133,143 ****
// Use store barrier to make sure the memory accesses associated
// with creating the pool are visible before publishing its address.
// The unlock will publish the store to _memory_pool_obj because
// it does a release first.
! OrderAccess::release_store_ptr(&_memory_pool_obj, pool_obj);
}
}
return pool_obj;
}
--- 133,143 ----
// Use store barrier to make sure the memory accesses associated
// with creating the pool are visible before publishing its address.
// The unlock will publish the store to _memory_pool_obj because
// it does a release first.
! OrderAccess::release_store(&_memory_pool_obj, pool_obj);
}
}
return pool_obj;
}
< prev index next >