提交 8a7b9d76 编写于 作者: X xlu

6618886: Anonymous objects can be destructed immediately and so should not be used

Reviewed-by: dholmes, kamg
上级 76e07c76
...@@ -69,15 +69,15 @@ void OSThread::pd_destroy() { ...@@ -69,15 +69,15 @@ void OSThread::pd_destroy() {
static intptr_t compare_and_exchange_current_callback ( static intptr_t compare_and_exchange_current_callback (
intptr_t callback, intptr_t *addr, intptr_t compare_value, Mutex *sync) { intptr_t callback, intptr_t *addr, intptr_t compare_value, Mutex *sync) {
if (VM_Version::supports_compare_and_exchange()) { if (VM_Version::supports_compare_and_exchange()) {
return Atomic::cmpxchg_ptr(callback, addr, compare_value); return Atomic::cmpxchg_ptr(callback, addr, compare_value);
} else { } else {
MutexLockerEx(sync, Mutex::_no_safepoint_check_flag); MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
if (*addr == compare_value) { if (*addr == compare_value) {
*addr = callback; *addr = callback;
return compare_value; return compare_value;
} else { } else {
return callback; return callback;
} }
} }
} }
...@@ -86,7 +86,7 @@ static intptr_t exchange_current_callback(intptr_t callback, intptr_t *addr, Mut ...@@ -86,7 +86,7 @@ static intptr_t exchange_current_callback(intptr_t callback, intptr_t *addr, Mut
if (VM_Version::supports_compare_and_exchange()) { if (VM_Version::supports_compare_and_exchange()) {
return Atomic::xchg_ptr(callback, addr); return Atomic::xchg_ptr(callback, addr);
} else { } else {
MutexLockerEx(sync, Mutex::_no_safepoint_check_flag); MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
intptr_t cb = *addr; intptr_t cb = *addr;
*addr = callback; *addr = callback;
return cb; return cb;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册