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

Ioi Lam iklam at openjdk.java.net
Tue Apr 13 20:49:19 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.

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

Commit messages:
 - fixed copyright
 - removed unnecessary include os.hpp
 - remove unnecessary include os.inline.hpp
 - step1

Changes: https://git.openjdk.java.net/jdk/pull/3475/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3475&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8265101
  Stats: 257 lines in 58 files changed: 109 ins; 98 del; 50 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