Skip to content

Conversation

@huishi-hs
Copy link

@huishi-hs huishi-hs commented Mar 17, 2021

…rray

C1 misses range check elimination opportunities for constant and NewMultiArray with fixed length now. This patch adds constant length node for load/store Indexed node when array is constant array or allocated with NewMultiArray and its first dimension length is constant.

Tested on linux x64 release/fastdebug with tier1 and tier2.

Regards
Hui


Progress

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

Issue

  • JDK-8263707: C1 RangeCheckEliminator support constant array and NewMultiArray

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3041

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 17, 2021

👋 Welcome back hshi! 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 Mar 17, 2021
@openjdk
Copy link

openjdk bot commented Mar 17, 2021

@huishi-hs The following label will be automatically applied to this pull request:

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label Mar 17, 2021
@mlbridge
Copy link

mlbridge bot commented Mar 17, 2021

Webrevs

@openjdk openjdk bot changed the title 8263707: C1 RangeCheckEliminator support constant array and NewMultiA… 8263707: C1 RangeCheckEliminator support constant array and NewMultiArray Mar 17, 2021
@huishi-hs
Copy link
Author

Could someone help review this PR?

@neliasso
Copy link

Do you have any test that exercises this code path?

@huishi-hs
Copy link
Author

huishi-hs commented Mar 23, 2021

Do you have any test that exercises this code path?

@neliasso

I have an example case in JBS https://bugs.openjdk.java.net/secure/attachment/93668/range_check.java. Do you suggest adding a test case to check if RC is removed as expected?

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Looks good to me. I've also executed some internal testing and it all passed.

assert(length->type()->as_IntConstant() != NULL, "array length must be integer");
set_constant(length->type()->as_IntConstant()->value());
} else if ((nma = x->array()->as_NewMultiArray()) != NULL) {
if ((length = nma->dims()->at(0)->as_Constant()) != NULL) {
Copy link
Member

Choose a reason for hiding this comment

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

The ifs could be merged.

Copy link
Author

Choose a reason for hiding this comment

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

ifs are merged in updated commit

@openjdk
Copy link

openjdk bot commented Mar 23, 2021

@huishi-hs 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:

8263707: C1 RangeCheckEliminator support constant array and NewMultiArray

Reviewed-by: thartmann, neliasso

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

  • b652198: 8264429: Test runtime/cds/appcds/VerifyWithDefaultArchive.java assumes OpenJDK build
  • 2c9365d: 8264271: Avoid creating non_oop_word oops
  • daeca3f: 8262958: (fs) UnixUserDefinedFileAttributeView cleanup
  • af02883: 8264191: Javadoc search is broken in Internet Explorer
  • 6e74c3a: 8264193: Remove TRAPS parameters for modules and defaultmethods
  • ee5e00b: 8264279: Shenandoah: Missing handshake after JDK-8263427
  • ac604a1: 8264374: Shenandoah: Remove leftover parallel reference processing argument
  • f3726a8: 8264020: Optimize double negation elimination
  • 4ffa41c: 8263615: Cleanup tightly_coupled_allocation
  • 4ea6abf: 8264324: Simplify allocation list management in OopStorage::reduce_deferred_updates
  • ... and 229 more: https://git.openjdk.java.net/jdk/compare/4517d72fc2b441d5054cefdc69b0c7fe3e37f2f4...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.

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 (@TobiHartmann, @neliasso) 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 Mar 23, 2021
@neliasso
Copy link

Do you have any test that exercises this code path?

@neliasso

I have an example case in JBS https://bugs.openjdk.java.net/secure/attachment/93668/range_check.java. Do you suggest adding a test case to check if RC is removed as expected?

Yes - please do that. Look at the tests in open/test/hotspot/jtreg/compiler/c1 (for example RangeCheckVerificationOfIR.java).

@huishi-hs
Copy link
Author

huishi-hs commented Mar 24, 2021

@neliasso

Test is added by checking if rangchecks are eliminated in given cases. -XX:+TraceRangeCheckElimination is added when launch C1 compilation, OutputAnalyzer is used to count how many RCs are eliminated. This test can only run with debug build.

Test passed with fast/slow debug on x86 and skipped for release build. Also test with -XX:+CSEArrayLength which is default on on aarch64 and other platform.

RangeCheckVerificationOfIR.java constructs all kinds of CFG with loops expect pass assertions in C1 code. Actually it doesn't dump IR and check.

@huishi-hs
Copy link
Author

May I proceed to sponsor state? @neliasso

Copy link

@neliasso neliasso left a comment

Choose a reason for hiding this comment

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

Looks good.

@neliasso
Copy link

May I proceed to sponsor state? @neliasso

Yes, please do that. I will sponsor your PR.

@huishi-hs
Copy link
Author

May I proceed to sponsor state? @neliasso

Yes, please do that. I will sponsor your PR.

Thanks for your help!

@openjdk
Copy link

openjdk bot commented Mar 30, 2021

@huishi-hs Only Committers are allowed to sponsor changes.

@huishi-hs
Copy link
Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 30, 2021
@openjdk
Copy link

openjdk bot commented Mar 30, 2021

@huishi-hs
Your change (at version 3831aa1) is now ready to be sponsored by a Committer.

@neliasso
Copy link

/sponsor

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

openjdk bot commented Mar 30, 2021

@neliasso @huishi-hs Since your change was applied there have been 240 commits pushed to the master branch:

  • 2ad6f2d: 8263896: Make not_suspended parameter from ObjectMonitor::exit() have default value
  • b652198: 8264429: Test runtime/cds/appcds/VerifyWithDefaultArchive.java assumes OpenJDK build
  • 2c9365d: 8264271: Avoid creating non_oop_word oops
  • daeca3f: 8262958: (fs) UnixUserDefinedFileAttributeView cleanup
  • af02883: 8264191: Javadoc search is broken in Internet Explorer
  • 6e74c3a: 8264193: Remove TRAPS parameters for modules and defaultmethods
  • ee5e00b: 8264279: Shenandoah: Missing handshake after JDK-8263427
  • ac604a1: 8264374: Shenandoah: Remove leftover parallel reference processing argument
  • f3726a8: 8264020: Optimize double negation elimination
  • 4ffa41c: 8263615: Cleanup tightly_coupled_allocation
  • ... and 230 more: https://git.openjdk.java.net/jdk/compare/4517d72fc2b441d5054cefdc69b0c7fe3e37f2f4...master

Your commit was automatically rebased without conflicts.

Pushed as commit 21e7402.

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

@huishi-hs huishi-hs deleted the C1_rangcheck branch April 2, 2021 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants