Skip to content

Conversation

@iklam
Copy link
Member

@iklam iklam commented Apr 1, 2021

We have many version of num_arguments() for the DCmd subclasses. They all have identical structure. We should templatize them to reduce duplicated code and avoid cut-and-paste errors.

It's still possible to write a customized num_arguments() function (although none of the existing cases needs to do that). The rules are described here:

class DCmd : public ResourceObj {
  ...
  // num_arguments() is used by the DCmdFactoryImpl::get_num_arguments() template functions.
  // - For subclasses of DCmdWithParser, it's calculated by DCmdParser::num_arguments().
  // - Other subclasses of DCmd have zero arguments by default. You can change this
  //   by defining your own version of MyDCmd::num_arguments().
  static int num_arguments()        { return 0; }


Progress

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

Issue

  • JDK-8264565: Templatize num_arguments() functions of DCmd subclasses

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3312

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 1, 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 bot commented Apr 1, 2021

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

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Apr 1, 2021
@iklam
Copy link
Member Author

iklam commented Apr 1, 2021

/label remove hotspot-runtime

@openjdk openjdk bot removed the hotspot-runtime hotspot-runtime-dev@openjdk.org label Apr 1, 2021
@iklam
Copy link
Member Author

iklam commented Apr 1, 2021

/label add hotspot

@openjdk
Copy link

openjdk bot commented Apr 1, 2021

@iklam
The hotspot-runtime label was successfully removed.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Apr 1, 2021
@openjdk
Copy link

openjdk bot commented Apr 1, 2021

@iklam
The hotspot label was successfully added.

@iklam iklam marked this pull request as ready for review April 1, 2021 18:07
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 1, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 1, 2021

Webrevs

@iklam
Copy link
Member Author

iklam commented Apr 1, 2021

For verification, I added code in an earlier commit (since removed) to print out the num_arguments() of each DCmd. The results are identical with and without this patch.

if (UseNewCode) {
tty->print_cr("CMD %s = %d", factory->name(), factory->num_arguments());
}

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

Wow cool and nice.

@openjdk
Copy link

openjdk bot commented Apr 2, 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:

8264565: Templatize num_arguments() functions of DCmd subclasses

Reviewed-by: coleenp, dholmes

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Pull request is ready to be integrated label Apr 2, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 5, 2021

Mailing list message from Ioi Lam on hotspot-dev:

Hi, could I have one more review for this?

Thanks
- Ioi

On 4/1/21 11:11 AM, Ioi Lam wrote:

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Looks like a good cleanup!

Thanks,
David

@iklam
Copy link
Member Author

iklam commented Apr 6, 2021

Thanks @coleenp and @dholmes-ora for the review.
/integrate

@openjdk openjdk bot closed this Apr 6, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 6, 2021
@openjdk
Copy link

openjdk bot commented Apr 6, 2021

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

  • 54b4070: 8264634: CollectCLDClosure collects duplicated CLDs when dumping dynamic archive
  • 43d4a6f: 8264564: AArch64: use MOVI instead of FMOV to zero FP register
  • dc608fd: 8264411: serviceability/jvmti/HeapMonitor tests intermittently fail due to large TLAB size
  • b1a225e: 8263565: NPE was thrown when sun.jvm.hotspot.rmi.serverNamePrefix was set
  • c41cd15: 8264686: ClhsdbTestConnectArgument.java should use SATestUtils::validateSADebugDPrivileges

Your commit was automatically rebased without conflicts.

Pushed as commit ff22353.

💡 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 hotspot-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants