Skip to content

8297822: De-duplicate code in module jdk.sctp#11436

Closed
minborg wants to merge 6 commits intoopenjdk:masterfrom
minborg:sctp-dedup
Closed

8297822: De-duplicate code in module jdk.sctp#11436
minborg wants to merge 6 commits intoopenjdk:masterfrom
minborg:sctp-dedup

Conversation

@minborg
Copy link
Contributor

@minborg minborg commented Nov 30, 2022

This PR proposes merging logic and optimising three classes that exist for aix, macos and windows.

Optimisation will reduce byte code. Below is an example for one of the many methods optimised.

Before:

public void implCloseSelectableChannel() throws java.io.IOException;
  Code:
     0: new           #7                  // class java/lang/UnsupportedOperationException
     3: dup
     4: ldc           #11                 // String SCTP not supported on this platform
     6: invokespecial #13                 // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     9: athrow

After:

public void implCloseSelectableChannel() throws java.io.IOException;
  Code:
     0: invokestatic  #16                 // Method sun/nio/ch/sctp/UnsupportedUtil.sctpUnsupported:()Ljava/lang/UnsupportedOperationException;
     3: athrow

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11436/head:pull/11436
$ git checkout pull/11436

Update a local copy of the PR:
$ git checkout pull/11436
$ git pull https://git.openjdk.org/jdk pull/11436/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11436

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11436.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 30, 2022

👋 Welcome back pminborg! 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 openjdk bot added the rfr Pull request is ready for review label Nov 30, 2022
@openjdk
Copy link

openjdk bot commented Nov 30, 2022

@minborg The following label will be automatically applied to this pull request:

  • net

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

@openjdk openjdk bot added the net net-dev@openjdk.org label Nov 30, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 30, 2022

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see all the duplication go away.

@@ -0,0 +1,14 @@
package sun.nio.ch.sctp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need regular copyright header :-)

@AlanBateman
Copy link
Contributor

AlanBateman commented Nov 30, 2022

One thing to try is moving the files from src/jdk.sctp/windows/classes/sun/nio/ch/sctp to src/jdk.sctp/share/classes/sun/nio/ch/sctp and removing the src/jdk.sctp/windows, src/jdk.sctp/macosx, and src/jdk.sctp/aix tress. If that works then it would avoid needing to have 3 copies of the "unsupported" implementation and avoid include UnsupportedXXX classes in the Linux implementation.

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the copyrights (2022), some look like they went back in time.

@dfuch
Copy link
Member

dfuch commented Dec 1, 2022

Please make sure that all related tests (as well as tier1 and tier2) pass before integrating.

@openjdk
Copy link

openjdk bot commented Dec 1, 2022

@minborg 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:

8297822: De-duplicate code in module jdk.sctp

Reviewed-by: dfuchs, rriggs

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 116 new commits pushed to 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch, @RogerRiggs) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 1, 2022
Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better

@AlanBateman
Copy link
Contributor

The latest update looks quite good but you might want to update make/jdk.sctp/Java.gmk to exclude UnsupportedUtils on linux, meaning there is no need to compile/include that on a Linux build.

@minborg
Copy link
Contributor Author

minborg commented Dec 5, 2022

Please make sure that all related tests (as well as tier1 and tier2) pass before integrating.

We have run tests on a box where SCTP was enabled and they passed.

@minborg
Copy link
Contributor Author

minborg commented Dec 6, 2022

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 6, 2022
@openjdk
Copy link

openjdk bot commented Dec 6, 2022

@minborg
Your change (at version 6c5c1f4) is now ready to be sponsored by a Committer.

@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Dec 6, 2022
@dfuch
Copy link
Member

dfuch commented Dec 6, 2022

Hi Per, I will sponsor this PR after the RDP 1 fork (after the latest changes have been reviewed).

@minborg
Copy link
Contributor Author

minborg commented Dec 9, 2022

Can either of you please have a look at the make file @AlanBateman or @RogerRiggs ?

@AlanBateman
Copy link
Contributor

Can either of you please have a look at the make file @AlanBateman or @RogerRiggs ?

It looks right. SCTP used to be Solaris + Linux, now it's Linux only. If there is a low chance that it will remain the only port then we could move it to src/jdk.sctp/linux but no need to do that now.

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dfuch
Copy link
Member

dfuch commented Dec 12, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Dec 12, 2022

@dfuch The PR has been updated since the change author (@minborg) issued the integrate command - the author must perform this command again.

@minborg
Copy link
Contributor Author

minborg commented Dec 12, 2022

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Dec 12, 2022
@openjdk
Copy link

openjdk bot commented Dec 12, 2022

@minborg
Your change (at version 7e3aaf9) is now ready to be sponsored by a Committer.

@dfuch
Copy link
Member

dfuch commented Dec 12, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Dec 12, 2022

Going to push as commit 56c438b.
Since your change was applied there have been 116 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 12, 2022
@openjdk openjdk bot closed this Dec 12, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Dec 12, 2022
@openjdk
Copy link

openjdk bot commented Dec 12, 2022

@dfuch @minborg Pushed as commit 56c438b.

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

@magicus
Copy link
Member

magicus commented Dec 14, 2022

Please note that Skara does not update the list of labels when new files are added to a PR after it's creation. It is up to the committer and reviewer to be aware of such changes during the lifetime of a PR. In this case, it would have been appropriate to add the build label when the changes to the makefiles were introduced.

@dfuch
Copy link
Member

dfuch commented Dec 14, 2022

Oh - I didn't know that. Thanks for the reminder Magnus!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated net net-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

5 participants