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

Multiple platforms broken after 8186476: Generalize Atomic::add with templates

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • None
    • hotspot
    • None
    • b23
    • generic
    • linux

      After merging the changeset for JDK-8186476, the linux-zero build fails with:

      * For target hotspot_variant-zero_libjvm_objs_bitMap.o:
      (/bin/grep -v -e "^Note: including file:" < /tmp/glaubitz/hs/build/linux-x86_64-normal-zero-release/make-support/failure-logs/hotspot_variant-zero_libjvm_objs_bitMap.o.log || true) | /usr/bin/head -n 12
      In file included from /tmp/glaubitz/hs/hotspot/src/share/vm/runtime/atomic.hpp:342:0,
                       from /tmp/glaubitz/hs/hotspot/src/share/vm/memory/allocation.inline.hpp:28,
                       from /tmp/glaubitz/hs/hotspot/src/share/vm/utilities/bitMap.cpp:26:
      /tmp/glaubitz/hs/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp: In member function ‘D Atomic::PlatformAdd<byte_size>::add_and_fetch(I, volatile D*) const [with I = I; D = D; long unsigned int byte_size = 4ul]’:
      /tmp/glaubitz/hs/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp:181:29: error: there are no arguments to ‘STATIC_CAST’ that depend on a template parameter, so a declaration of ‘STATIC_CAST’ must be available [-fpermissive]
         STATIC_CAST(4 == sizeof(I));
                                   ^
      /tmp/glaubitz/hs/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp:181:29: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
      /tmp/glaubitz/hs/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp:182:29: error: there are no arguments to ‘STATIC_CAST’ that depend on a template parameter, so a declaration of ‘STATIC_CAST’ must be available [-fpermissive]
         STATIC_CAST(4 == sizeof(D));
                                   ^
      /tmp/glaubitz/hs/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp: In member function ‘D Atomic::PlatformAdd<byte_size>::add_and_fetch(I, volatile D*) const [with I = I; D = D; long unsigned int byte_size = 8ul]’:
      if test `/usr/bin/wc -l < /tmp/glaubitz/hs/build/linux-x86_64-normal-zero-release/make-support/failure-logs/hotspot_variant-zero_libjvm_objs_bitMap.o.log` -gt 12; then /bin/echo " ... (rest of output omitted)" ; fi
         ... (rest of output omitted)

      This is a result of the use of STATIC_CAST instead of STATIC_ASSERT in the changes for 8186476.

      Additionally, for linux-sparc, "template<>" is missing in one instance:

      diff -r f3413e6d6b8f src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp
      --- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp Mon Aug 28 16:40:01 2017 +0000
      +++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp Mon Aug 28 23:41:37 2017 +0300
      @@ -62,8 +62,8 @@
       template<>
       template<typename I, typename D>
       inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
      - STATIC_CAST(4 == sizeof(I));
      - STATIC_CAST(4 == sizeof(D));
      + STATIC_ASSERT(4 == sizeof(I));
      + STATIC_ASSERT(4 == sizeof(D));
       
         D rv;
         __asm__ volatile(
      @@ -81,10 +81,11 @@
         return rv;
       }
       
      +template<>
       template<typename I, typename D>
       inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
      - STATIC_CAST(8 == sizeof(I));
      - STATIC_CAST(8 == sizeof(D));
      + STATIC_ASSERT(8 == sizeof(I));
      + STATIC_ASSERT(8 == sizeof(D));
       
         D rv;
         __asm__ volatile(

            glaubitz John Paul Adrian Glaubitz
            glaubitz John Paul Adrian Glaubitz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: