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

Define os::Linux, os::win32, etc in their own headers

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 17
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      Today os.hpp includes os_linux.hpp

      https://github.com/openjdk/jdk/blob/399071369173921a9fee0cae88a5f7e44e26d33d/src/hotspot/share/runtime/os.hpp#L874

      https://github.com/openjdk/jdk/blob/399071369173921a9fee0cae88a5f7e44e26d33d/src/hotspot/os/linux/os_linux.hpp#L33

      This means that the definition of the os::Linux class is always included via os.hpp, but os::Linux is used only by Linux-specific files.

      To improve modularity and JDK build time, we should move the definition of os::Linux to its own header file that's not automatically included by os.hpp.

      C++ allows the definition of a nested class (os::Linux) to be outside of the definition of the enclosing class (os).

      https://en.cppreference.com/w/cpp/language/nested_types

      class enclose {
          class nested1; // forward declaration
          class nested2; // forward declaration
          class nested1 {}; // definition of nested class
      };
      class enclose::nested2 { }; // definition of nested class

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: