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

8265940: Enable C2's optimization for Math.pow(x, 0.5) on all platforms #3755

Closed
wants to merge 2 commits into from

Conversation

@DamonFool
Copy link
Member

@DamonFool DamonFool commented Apr 28, 2021

Hi all,

I'd like to enable C2's optimization for Math.pow(x, 0.5) on all platforms.

This is fine because:

  1. For x86, it will call the assembly stubs.
    This opt has already been implemented for x86_64 [1].
    And the x86_32 version is added in this patch.
  2. For non-x86, it will call the shared runtime c code [2], which does the same opt too.

Testing:

  • tier1~3 on Linux/{x86_32, x86_64}, no regression

Thanks,
Best regards,
Jie

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp#L838
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/sharedRuntimeTrans.cpp#L497


Progress

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

Issue

  • JDK-8265940: Enable C2's optimization for Math.pow(x, 0.5) on all platforms

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3755

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

Using diff file

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

@DamonFool
Copy link
Member Author

@DamonFool DamonFool commented Apr 28, 2021

/test
/label add hotspot-compiler
/cc hotspot-compiler

Loading

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 28, 2021

👋 Welcome back jiefu! 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.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Apr 28, 2021

@DamonFool
The hotspot-compiler label was successfully added.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Apr 28, 2021

@DamonFool The hotspot-compiler label was already applied.

Loading

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

@mlbridge mlbridge bot commented Apr 28, 2021

Webrevs

Loading

Copy link
Contributor

@neliasso neliasso left a comment

Looks good.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Apr 28, 2021

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

8265940: Enable C2's optimization for Math.pow(x, 0.5) on all platforms

Reviewed-by: neliasso, kvn

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 23 new commits pushed to the master branch:

  • 9605aed: 8266251: compiler.inlining.InlineAccessors shouldn't do testing in driver VM
  • 03d4149: 8266255: compiler/eliminateAutobox/TestEliminateBoxInDebugInfo.java uses wrong package name
  • 794cefe: 8241354: ZGC still crashes in containers with NUMA due to get_mempolicy is disabled by default
  • 23180f8: 8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API
  • f75dd80: 8266230: mark hotspot compiler/c2 tests which ignore VM flags
  • 9df6cc7: 8264678: Incomplete comment in build.tools.generatecharacter.GenerateCharacter
  • 73cfc26: 8266232: compiler.c1.TestRangeCheckEliminated should be run in driver mode
  • 3e1b90a: 8266157: Problem list several awt jtreg tests that fail on macOS 11
  • 3f9879f: 8266190: mark hotspot compiler/codecache tests which ignore VM flags
  • d12e01a: 8264472: Add a test group for running CDS tests with -XX:+VerifySharedSpaces
  • ... and 13 more: https://git.openjdk.java.net/jdk/compare/75a2354dc276e107d64516d20fc72bc7ef3d5f86...master

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.

Loading

@openjdk openjdk bot added the ready label Apr 28, 2021
@DamonFool
Copy link
Member Author

@DamonFool DamonFool commented Apr 28, 2021

Looks good.

Thanks @neliasso .

Loading

Copy link
Contributor

@vnkozlov vnkozlov left a comment

The fix looks good.

Loading

jccb(Assembler::notEqual, L_NOT_DOUBLE0DOT5);
jccb(Assembler::parity, L_NOT_DOUBLE0DOT5);
ucomisd(xmm0, ExternalAddress(DOUBLE0));
jccb(Assembler::belowEqual, L_NOT_DOUBLE0DOT5); // pow(x, 0.5) => sqrt(x) only for x > 0.0
Copy link
Contributor

@vnkozlov vnkozlov Apr 28, 2021

Choose a reason for hiding this comment

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

Add comment about why 0. case is skipped: -0.0 case.

Loading

Copy link
Member Author

@DamonFool DamonFool Apr 28, 2021

Choose a reason for hiding this comment

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

Add comment about why 0. case is skipped: -0.0 case.

Thanks @vnkozlov for your review.

Comments have been added.
Thanks.

Loading

}
#if defined(X86) && defined(_LP64)
else if (d->getd() == 0.5 && Matcher::match_rule_supported(Op_SqrtD)) {
} else if (d->getd() == 0.5 && Matcher::match_rule_supported(Op_SqrtD)) {
Copy link
Contributor

@vnkozlov vnkozlov Apr 28, 2021

Choose a reason for hiding this comment

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

Add the same comment at line #1654 explaining why 0. is excluded.

Loading

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Good.

Loading

@DamonFool
Copy link
Member Author

@DamonFool DamonFool commented Apr 29, 2021

/integrate

Loading

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

@openjdk openjdk bot commented Apr 29, 2021

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

  • 56cde70: 8266265: mark hotspot compiler/vectorization tests which ignore VM flags
  • 4937214: 8266174: -Wmisleading-indentation happens in libmlib_image sources
  • b305eff: 8266238: mark hotspot compiler/inlining tests which ignore VM flags
  • df3b2d0: 8266264: mark hotspot compiler/eliminateAutobox tests which ignore VM flags
  • 6b263e6: 8266256: compiler.vectorization.TestBufferVectorization does testing twice
  • 69155f4: 8266231: mark hotspot compiler/c1 tests which ignore VM flags
  • 0e225ef: 8197821: Test java/awt/font/TextLayout/LigatureCaretTest.java fails on Windows
  • a1c942c: 8266170: -Wnonnull happens in classLoaderData.inline.hpp
  • 4a9f231: 8266173: -Wmaybe-uninitialized happens in jni_util.c
  • 9605aed: 8266251: compiler.inlining.InlineAccessors shouldn't do testing in driver VM
  • ... and 22 more: https://git.openjdk.java.net/jdk/compare/75a2354dc276e107d64516d20fc72bc7ef3d5f86...master

Your commit was automatically rebased without conflicts.

Pushed as commit 91226fa.

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

Loading

@DamonFool DamonFool deleted the JDK-8265940 branch Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants