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

Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • hotspot
    • None
    • b135

      The majority of atomic functions are inline and defined in the atomic.inline.hpp file. The .inline.hpp file should be included by the .cpp files that use the atomics. The .hpp file should not be included by other .hpp files unless actual atomic operations are referenced - in some cases this means those uses should themselves be moved into a .inline.hpp file.

      Due to this kind of problem we can experience unexpected compilation failures eg:

      In file included from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/memTracker.hpp:78:0,
                       from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/virtualMemoryTracker.cpp:28:
      /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/runtime/atomic.hpp:75:26: error: inline function 'static jint Atomic::add(jint, volatile jint*)' used but never defined [-Werror]

      This may only appear on particular platforms and may depend on whether precompiled headers are used.

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: