RFR: 8282475: SafeFetch should not rely on existence of Thread::current [v4]

Thomas Stuefe stuefe at openjdk.java.net
Wed Mar 9 11:55:05 UTC 2022


On Wed, 9 Mar 2022 11:00:15 GMT, David Holmes <dholmes at openjdk.org> wrote:

> @tstuefe do you have some examples of (3)? I don't like introducing a fake, seemingly general-purpose, API for something that is very much platform specific. I do dislike intensely the way the ThreadWX changes pollute shared code, and as has been said in other reviews of that code, there really should be a much cleaner/clearer place where these transitions occur - if we can find it.

Examples for platform specifics hidden behind a common facade with one or two platforms missing are very common, but I assume you mean implementations that are stubbed out almost everywhere, right?

 "os::os_exception_wrapper" is a very good example, hiding the details of SEH - which only exists on Windows - from generic code. It is an empty stub implementation on all platforms but Windows x86. On all other platforms (including windows aarch) we don't have that facility.

- "os::breakpoint" is a bit similar, since native breakpoint support only exists on Windows

- "os::set_native_thread_name" used to initially only exist on windows and linux, leaving out aix, mac and solaris.

I can dig deeper, but I remember generic wrappers with only a few or only one platform implementation being around. Especially when we still had Solaris around. 

I remember because like you I never was too fond of that pattern, but I find it often the smaller evil.

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

PR: https://git.openjdk.java.net/jdk/pull/7727


More information about the serviceability-dev mailing list