8291945: Add OSInfo API for static OS information#9758
8291945: Add OSInfo API for static OS information#9758iklam wants to merge 5 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
Webrevs
|
dholmes-ora
left a comment
There was a problem hiding this comment.
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
Outdated
| #include "memory/allStatic.hpp" | ||
| #include "utilities/debug.hpp" | ||
|
|
||
| // Static information about the operation system. Initialized exactly once |
| #include "runtime/handles.hpp" | ||
|
|
||
| class BasicLock; | ||
| class frame; |
There was a problem hiding this comment.
Seems unrelated to this change. ?/
There was a problem hiding this comment.
This file was indirectly including frame.hpp via os.hpp. Since I removed os.hpp from this file, I needed to add a declaration for the frame class.
There was a problem hiding this comment.
I don't see any such removal in this file. ??
There was a problem hiding this comment.
Oh I was mistaken. What I did was removing os.hpp from relocInfo.hpp and safepointMechanismhpp. This exposed the fact that stackValue.hpp was using the frame class without a proper declaration.
I left os::vm_page_size() because:
So at this point, OSInfo is a just lower-level API if you just want to find out the value of some OS parameters. So far I've used it in two popular headers to avoid including os.hpp |
|
Okay I think it would be good to switch to the OSInfo API in the future, so that we reduce the scope of os even further and more clearly delineate an API to request services from the OS, and a simple query API for the OS. |
|
@iklam This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
src/hotspot/share/runtime/osInfo.hpp
Outdated
| // Returns the byte size of a virtual memory page | ||
| static int vm_page_size() { return _vm_page_size; } | ||
|
|
||
| // Returns the size in bytes of memory blocks which can be allocated. |
There was a problem hiding this comment.
Too vague and a bit misleading. Proposal:
Returns size, in bytes, of the granularity with which memory can be reserved using os::reserve_memory().
|
Thanks @dholmes-ora and @tstuefe for the review. |
|
Going to push as commit 9bfffa0. |
As suggested by @tstuefe in the review of #9600, many of the
osAPIs simply return a value that was initialized during VM start up. E.g.,os::vm_page_size(). I have added a new classOSInfofor managing such infoOSInfoclass can be used in lieu of the more complexosclass. 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.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9758/head:pull/9758$ git checkout pull/9758Update a local copy of the PR:
$ git checkout pull/9758$ git pull https://git.openjdk.org/jdk pull/9758/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9758View PR using the GUI difftool:
$ git pr show -t 9758Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9758.diff