RFR: 8291945: Add OSInfo API for static OS information

David Holmes dholmes at openjdk.org
Fri Aug 5 04:20:45 UTC 2022


On Thu, 4 Aug 2022 23:18:35 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> As suggested by @tstuefe in the review of #9600, many of the `os` APIs simply return a value that was initialized during VM start up. E.g., `os::vm_page_size()`. I have added a new class `OSInfo` for managing such info
> 
> - Simplifies the per-OS implementation
> - Make the "init-only-once" check consistent
> - In some cases, the simpler `OSInfo` class can be used in lieu of the more complex `os` class. This improves HotSpot build time (e.g., relocInfo.hpp).
> 
> Note: I moved only 2 fields in this PR as a first step. If this works well I plan to move more fields in the future.

Seems reasonable, but I initially expected to see the os:: API removed and replaced by the OSInfo:: API, rather than OSInfo just being an internal implementation detail.

src/hotspot/share/runtime/osInfo.hpp line 31:

> 29: #include "utilities/debug.hpp"
> 30: 
> 31: // Static information about the operation system. Initialized exactly once

s/operation/operating

src/hotspot/share/runtime/stackValue.hpp line 32:

> 30: 
> 31: class BasicLock;
> 32: class frame;

Seems unrelated to this change. ?/

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

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


More information about the hotspot-dev mailing list