RFR: 8290840: Refactor the "os" class

Ioi Lam iklam at openjdk.org
Mon Jul 25 21:54:03 UTC 2022


On Mon, 25 Jul 2022 01:59:48 GMT, David Holmes <dholmes 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/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.

I meant to say:


// ... must be implemented in the following *four* files files:

// - src/hotspot/os/<os>/os_<os>.inline.hpp
// - src/hotspot/os_cpu/<os>_<cpu>/os_<os>_<cpu>.inline.hpp
//    [explanation for the hpp files]
// - src/hotspot/os/<os>/os_<os>.cpp
// - src/hotspot/os_cpu/<os>_<cpu>/os_<os>_<cpu>.cpp
//    [explanation for the cpp files]


I'll change the order of the text to make it clear.

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

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


More information about the hotspot-dev mailing list