Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8320052

Zero: Use __atomic built-ins for atomic RMW operations

XMLWordPrintable

    • b25

        GCC defines __sync* built-ins as legacy implementations of atomic support routines, and recommends using __atomic* built-ins in new code:
        https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

        The crucial difference between these two families of built-ins is that __atomic* 64-bit CAS is guaranteed to be supported ("The ‘__atomic’ builtins can be used with any integral scalar or pointer type that is 1, 2, 4, or 8 bytes in length"), whereas __sync* 64-bit CAS can be unimplemented. This is important for making sure JDK-8316961 works on all platforms, and allows JDK-8318776 to proceed.

        Upstream reports suggest PPC32 is one of the platforms that does not have __sync_val_compare_and_swap_8 implemented. My own testing shows these platforms have the __sync_val_compare_and_swap_8 unimplemented:
            zero-fastdebug-mipsel-linux-gnu-10
            zero-fastdebug-m68k-linux-gnu-10
            zero-fastdebug-powerpc-linux-gnu-10
            zero-fastdebug-sh4-linux-gnu-10

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: