RFR: 8255040: Replace __sync_add_and_fetch with __atomic_add_fetch to avoid build errors with clang

Jie Fu jiefu at openjdk.java.net
Thu Oct 22 11:53:18 UTC 2020


Hi all,

It's time to replace __sync_add_and_fetch with __atomic_add_fetch to avoid build errors. 

After JDK-8252221, build errors with clang were observed [1] due to the use of __sync_add_and_fetch, which is legacy and will be deprecated in the future.
It can be reproduced by building macos-x86-zero or linux-x86-zero with clang.

The fix was prepared by learning from aarch64's implementation [2].
Please review it.

Thanks
Best regards,
Jie

[1] https://bugs.openjdk.java.net/browse/JDK-8255040
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.hpp#L39

-------------

Commit messages:
 - Replace __sync_add_and_fetch with __atomic_add_fetch to avoid build errors with clang

Changes: https://git.openjdk.java.net/jdk/pull/803/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=803&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255040
  Stats: 13 lines in 2 files changed: 9 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/803.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/803/head:pull/803

PR: https://git.openjdk.java.net/jdk/pull/803


More information about the hotspot-runtime-dev mailing list