RFR: 8265101: Remove unnecessary functions in os*.inline.hpp [v2]

Ioi Lam iklam at openjdk.java.net
Thu Apr 22 05:44:00 UTC 2021


> Many functions like `os::write`, `os::exit`, `os::dll_unload`, etc, are implemented in various os*.inline.hpp files. This forces many .hpp and .cpp files to explicitly include "runtime/os.inline.hpp".
> 
> There's no performance reason to inline these functions. They will make a system call, whose overhead is way bigger than the cost of making an extra function call.
> 
> The full list methods moved from `os*inline.hpp` to `os_<platform>.cpp` are:
> 
> 
> os::dll_unload(void *lib)
> os::lseek(int fd, jlong offset, int whence)
> os::fsync(int fd)
> os::ftruncate(int fd, jlong length)
> os::read(int fd, void *buf, unsigned int nBytes)
> os::write(int fd, const void *buf, unsigned int nBytes)
> os::close(int fd)
> os::socket_close(int fd)
> os::socket(int domain, int type, int protocol)
> os::recv(int fd, char* buf, size_t nBytes, uint flags)
> os::send(int fd, char* buf, size_t nBytes, uint flags)
> os::raw_send(int fd, char* buf, size_t nBytes, uint flags)
> os::connect(int fd, struct sockaddr* him, socklen_t len)
> os::get_host_by_name(char* name)
> os::exit(int num)
> 
> 
> I also took this chance to remove unnecessary inclusion of os.hpp and os.inline.hpp from various files. I added some missing `#include` directives that were exposed as a result.
> 
> - **Notes for Reviewers**: please start from os*.{hpp,cpp} files first.
> - Tested with mach5: tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5. Also locally: aarch64, arm, ppc64, s390, x86, and zero.

Ioi Lam 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 six additional commits since the last revision:

 - Merge branch 'master' into 8265101-remove-unnecessary-os-inline-functions
 - Merge branch 'master' into 8265101-remove-unnecessary-os-inline-functions
 - fixed copyright
 - removed unnecessary include os.hpp
 - remove unnecessary include os.inline.hpp
 - step1

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3475/files
  - new: https://git.openjdk.java.net/jdk/pull/3475/files/399eefcc..67422c61

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

  Stats: 70475 lines in 1895 files changed: 31765 ins; 33832 del; 4878 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3475.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3475/head:pull/3475

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


More information about the hotspot-dev mailing list