Skip to content
Permalink
Browse files
8255040: Replace __sync_add_and_fetch with __atomic_add_fetch to avoi…
…d build errors with clang

Reviewed-by: dholmes, kbarrett
  • Loading branch information
DamonFool committed Oct 27, 2020
1 parent bcdeeaa commit d735f919195cd45d507cd228872b379d97072800
Showing with 13 additions and 4 deletions.
  1. +6 −2 src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp
  2. +7 −2 src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp
@@ -184,7 +184,9 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value,
#ifdef M68K
return add_using_helper<int>(m68k_add_and_fetch, dest, add_value);
#else
return __sync_add_and_fetch(dest, add_value);
D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
FULL_MEM_BARRIER;
return res;
#endif // M68K
#endif // ARM
}
@@ -196,7 +198,9 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(D volatile* dest, I add_value,
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));

return __sync_add_and_fetch(dest, add_value);
D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
FULL_MEM_BARRIER;
return res;
}

template<>
@@ -49,7 +49,9 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value,
STATIC_ASSERT(4 == sizeof(I));
STATIC_ASSERT(4 == sizeof(D));

return __sync_add_and_fetch(dest, add_value);
D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
FULL_MEM_BARRIER;
return res;
}

template<>
@@ -58,7 +60,10 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(D volatile* dest, I add_value,
atomic_memory_order order) const {
STATIC_ASSERT(8 == sizeof(I));
STATIC_ASSERT(8 == sizeof(D));
return __sync_add_and_fetch(dest, add_value);

D res = __atomic_add_fetch(dest, add_value, __ATOMIC_RELEASE);
FULL_MEM_BARRIER;
return res;
}

template<>

1 comment on commit d735f91

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on d735f91 Oct 27, 2020

Please sign in to comment.