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

Move os::Linux to its own header file

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P4
    • 20
    • 17
    • hotspot

    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 (over 400 lines) 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

        Issue Links

          Activity

            People

              Unassigned Unassigned
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: