Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265101

Remove unnecessary functions in os*.inline.hpp

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • b20

      https://github.com/openjdk/jdk/blob/3b576ed99d7664ea0fc851e66f9480a6f4638197/src/hotspot/os/posix/os_posix.inline.hpp#L47

      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)


            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: