RFR: 8290840: Refactor the "os" class [v3]
Thomas Stuefe
stuefe at openjdk.org
Tue Aug 2 07:15:07 UTC 2022
On Tue, 2 Aug 2022 06:50:51 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>
> I think we should avoid creating non-portable os::xxx APIs and then call them from shared code. There were some calls to os::Posix::xxx from the shared code that I fixed in this PR.
I don't think that's what I meant. I meant APIs that exist for all OSes but have different expressions on each OS. So the prototype should live in shared os. But I want to pull a different implementation for each OS.
This only affects inline functions. If the different implementations live in os_xx.cpp it works automatically through link time resolution.
I see there are only a few examples for what I meant. Many inline functions return platform dependend values that those live in variables in shared code (e.g. os::vm_page_size(), ...). Others are just not inline (os.create_thread(), ...). Which leaves us with the likes of `zero_page_read_protected()` etc, and I see you put them into os.inline.hpp and there you include the OS specific headers too.
I guess this can mostly be avoided. E.g. there is zero reason why `zero_page_read_protected()` cannot be a static boolean variable in os. For future RFEs.
-------------
PR: https://git.openjdk.org/jdk/pull/9600
More information about the hotspot-dev
mailing list