RFR: 8246112: Remove build-time and run-time checks for clock_gettime and CLOCK_MONOTONIC [v3]

David Holmes dholmes at openjdk.java.net
Tue Jan 19 01:53:03 UTC 2021


> We are now confident that we have build-time and runtime support for clock_gettime and CLOCK_MONOTONIC on all our OpenJDK supported POSIX platforms - see bug report for some more details on different OS. Consequently we can simplify a lot of the code in this area and move common code to os_posix.
> 
> As of glibc 2.17 the necessary functions are in glibc rather than librt, but we (Oracle at least) aren't yet in position to set our minimum Linux version to support that. We still have supported platforms at glibc 2.12. So to address that we link librt at build time on Linux. This seems to work find for older and more modern Linuxes and also works for the Apline Linux with Musl variant.
> 
> The changes are in layered commits:
> 
> Step 1: Remove build time checks. SUPPORTS_CLOCK_MONOTONIC is assumed true and removed.
> Step 2: make supports_monotonic_clock always true and so remove checking in OS code
> Step 3: Replace gettimeofday by clock_gettime(CLOCK_REALTIME)
> Step 4: Move shared time functions to os_posix.cpp
> Step 5: Alway link librt on Linux so we don't rely on glibc > 2.17
> 
> Testing: tiers 1-3 for functional testing
>              built and checked (-Xlog:os) on Linux with glibc 2.12 and 2.17,  macOS 10.13.6 and 10.15.7

David Holmes has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:

 - Merge branch 'master' into 8246112-mono
 - Restrict librt linking to JVM - per Magnus's request
 - Merge branch 'master' into 8246112-mono
 - Alway link librt on Linux so we don't rely on glibc > 2.12
 - Step 4: Move shared time functions to os_posix.cpp
 - Step 3: Replace gettimeofday by clock_gettime(CLOCK_REALTIME)
 - Step 2: make supports_monotonic_clock always true and so remove checking it (in OS code)
 - 8246112: Remove build-time and run-time checks for clock_gettime and CLOCK_MONOTONIC
   
   Step 1: Remove build time checks. SUPPORTS_CLOCK_MONOTONIC is assumed true and removed.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2090/files
  - new: https://git.openjdk.java.net/jdk/pull/2090/files/b857faf6..e59676fd

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2090&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2090&range=01-02

  Stats: 14984 lines in 239 files changed: 2936 ins; 9648 del; 2400 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2090.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2090/head:pull/2090

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



More information about the build-dev mailing list