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

8338924: C1: assert(0 <= i && i < _len) failed: illegal index 5 for length 5 #20732

Closed
wants to merge 12 commits into from

Conversation

matias9927
Copy link
Contributor

@matias9927 matias9927 commented Aug 27, 2024

The change in JDK-8335664 caused a crash when initializing basic blocks with -Xcomp. This change introduces a check to see if JSR is the last bytecode in its method so that expected behavior matches the previous patch. Verified with tier 1-6 tests.


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

  • JDK-8338924: C1: assert(0 <= i && i < _len) failed: illegal index 5 for length 5 (Bug - P4)

Reviewers

Contributors

  • Dean Long <dlong@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20732

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 27, 2024

👋 Welcome back matsaave! 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 Aug 27, 2024

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

8338924: C1: assert(0 <= i && i < _len) failed: illegal index 5 for length 5

Co-authored-by: Dean Long <dlong@openjdk.org>
Reviewed-by: kvn, thartmann

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 61 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.

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

@openjdk
Copy link

openjdk bot commented Aug 27, 2024

@matias9927 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 Aug 27, 2024
@dean-long
Copy link
Member

Please add a loop to the test so it triggers this issue without -Xcomp.

@matias9927 matias9927 changed the title 8338924: runtime/interpreter/LastJsrTest.java fails assert(0 <= i && i < _len) failed: illegal index 5 for length 5 8338924: C1: assert(0 <= i && i < _len) failed: illegal index 5 for length 5 Aug 29, 2024
@matias9927 matias9927 marked this pull request as ready for review August 29, 2024 17:16
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 29, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2024

Webrevs

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.

Just a comment.

*/

public class LastJsrTest {
public static void main(String[] args) {
LastJsr.test();
LastJsrReachable.test();
for (int i = 0; i < 1000; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you need 10,000 in your loop to trigger compilation?

Copy link
Member

Choose a reason for hiding this comment

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

Yes for C2, but this is enough for C1, the only compiler that needs this fix. I wanted to make sure C1 compilation was triggered by default without -Xcomp. Testing tiers that use -Xcomp will make sure it passes with C2.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok.

@matias9927
Copy link
Contributor Author

/contributor add @dean-long

@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@matias9927
Contributor Dean Long <dlong@openjdk.org> successfully added.

Comment on lines 31 to 34
* @run main/othervm LastJsrTest
* @run main/othervm
* -Xbatch
* LastJsrTest
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to keep old command too.
And I don't like spliting new command into several lines when it is very short.

Comment on lines 225 to 227

if (bci + Bytecodes::length_for(code) >= method_len) break;

Copy link
Contributor

Choose a reason for hiding this comment

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

Please, use code style which use {} and put body on separate line as you did in c1_GraphBuilder.cpp
You will not need empty lines around it then.

Comment on lines 238 to 240

if (bci + Bytecodes::length_for(code) >= method_len) break;

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@@ -24,17 +24,22 @@
/*
* @test
* @bug 8335664
* @bug 8338924
Copy link
Member

Choose a reason for hiding this comment

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

Drive-by comment: You can use @bug 8335664 8338924 instead.

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 3, 2024
@@ -1389,6 +1389,11 @@ void GraphBuilder::jsr(int dest) {
// If the bytecodes are strange (jumping out of a jsr block) then we
// might end up trying to re-parse a block containing a jsr which
// has already been activated. Watch for this case and bail out.
if (next_bci() >= method()->code_size()) {
// This can happen if the subroutine does not terminate with a ret,
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is incorrect here (should be 2 whitespace instead of 4).

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 otherwise.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 4, 2024
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Update is good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 4, 2024
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.

Still good.

@matias9927
Copy link
Contributor Author

Thanks for the reviews @TobiHartmann and @vnkozlov! Also thank you for the assistance @dean-long!
/integrate

@openjdk
Copy link

openjdk bot commented Sep 4, 2024

Going to push as commit 1353601.
Since your change was applied there have been 61 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 Sep 4, 2024
@openjdk openjdk bot closed this Sep 4, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 4, 2024
@openjdk
Copy link

openjdk bot commented Sep 4, 2024

@matias9927 Pushed as commit 1353601.

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

Successfully merging this pull request may close these issues.

5 participants