Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8265101: Remove unnecessary functions in os*.inline.hpp #3475

Conversation

iklam
Copy link
Member

@iklam iklam commented Apr 13, 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.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8265101: Remove unnecessary functions in os*.inline.hpp

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3475/head:pull/3475
$ git checkout pull/3475

Update a local copy of the PR:
$ git checkout pull/3475
$ git pull https://git.openjdk.java.net/jdk pull/3475/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3475

View PR using the GUI difftool:
$ git pr show -t 3475

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3475.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 13, 2021

👋 Welcome back iklam! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

@openjdk openjdk bot commented Apr 13, 2021

@iklam The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability hotspot labels Apr 13, 2021
@iklam
Copy link
Member Author

@iklam iklam commented Apr 13, 2021

/label remove serviceability

@openjdk openjdk bot removed the serviceability label Apr 13, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 13, 2021

@iklam
The serviceability label was successfully removed.

@iklam iklam marked this pull request as ready for review Apr 13, 2021
@openjdk openjdk bot added the rfr label Apr 13, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 13, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Hi Ioi,

This all seems fine to me. I agree these seem unlikely to need to be inlined for performance.

Thanks,
David

@openjdk
Copy link

@openjdk openjdk bot commented Apr 14, 2021

@iklam This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: dholmes, kbarrett

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 2 new commits pushed to the master branch:

  • 28c35ae: 8259288: Debug build failure with clang-10 due to -Wimplicit-int-float-conversion
  • ca6b1b4: 8171381: [TEST_BUG] [macos] javax/swing/JPopupMenu/7156657/bug7156657.java fails on OS X

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 14, 2021
@iklam
Copy link
Member Author

@iklam iklam commented Apr 22, 2021

Thanks @dholmes-ora and @kimbarrett for the review.
Tested again in mach5 build tiers 1-5.
/integrate

@openjdk openjdk bot closed this Apr 22, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 22, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 22, 2021

@iklam Since your change was applied there have been 2 commits pushed to the master branch:

  • 28c35ae: 8259288: Debug build failure with clang-10 due to -Wimplicit-int-float-conversion
  • ca6b1b4: 8171381: [TEST_BUG] [macos] javax/swing/JPopupMenu/7156657/bug7156657.java fails on OS X

Your commit was automatically rebased without conflicts.

Pushed as commit 33b6378.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot integrated
4 participants