RFR: 8290840: Refactor the "os" class

David Holmes dholmes at openjdk.org
Mon Jul 25 02:06:48 UTC 2022


On Thu, 21 Jul 2022 19:45:13 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Please see [JDK-8290840](https://bugs.openjdk.org/browse/JDK-8290840) for the detailed proposal.
> 
> The `os` class, declared in os.hpp, forms the major part of the HotSpot porting interface. Its structure has gradually deteriorated over the years as new ports are created and new APIs are added.
> 
> This RFE tries to address the following:
> 
> - Clearly specify where a porting API should be declared and defined among the various `os*.cpp` and `os*.hpp` files.
> - Avoid the inappropriate inclusion of OS-specific APIs (such as the `os::Linux class`) by platform-independent source files.

src/hotspot/os/aix/os_aix.cpp line 3009:

> 3007: void os::print_active_locale(outputStream* st) {
> 3008:   os::Posix::print_active_locale(st);
> 3009: }

You should not need this indirection. The code in os::Posix::x should be the implementation os::x for the os class, but just defined in os_posix.cpp.

src/hotspot/share/runtime/os.hpp line 43:

> 41: // ===================================================================
> 42: //
> 43: // The "os" class defines a large part of the interfaces for porting HotSpot

s/a large part/a number of/

src/hotspot/share/runtime/os.hpp line 62:

> 60: // - src/hotspot/os/posix/os_posix.hpp
> 61: //
> 62: //   These headers declare of APIs that should be used only within the

delete "of"

src/hotspot/share/runtime/os.hpp line 86:

> 84: //
> 85: // - src/hotspot/os/<os>/os_<os>.inline.hpp
> 86: // - src/hotspot/os_cpu/<os>_<cpu>/os_<os>_<cpu>.inline.hpp

They have to be inline? Why? I would expect `os_<os>.cpp` to be able to define implementations of a platform specific os.hpp function.

-------------

PR: https://git.openjdk.org/jdk/pull/9600


More information about the hotspot-dev mailing list